Commit 84b5cba2 authored by Sky Malice's avatar Sky Malice Committed by Commit Bot

[Feed] Set USE_TIMEOUT_SCHEDULER.

When the NTP was open and an article fetch completed, it would cause
the list of articles to flicker and be completely replaced. This change
removes the flicker, and only articles below the edge of the screen are
replaced.

Bug: 911489
Change-Id: Id87b221e142533a0bf448a0efe2cdcdf43209dc0
Reviewed-on: https://chromium-review.googlesource.com/c/1363959
Commit-Queue: Sky Malice <skym@chromium.org>
Reviewed-by: default avatarFilip Gorski <fgorski@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614790}
parent 277fefe9
......@@ -59,6 +59,10 @@ public final class FeedConfiguration {
/** Default value for triggering immediate pagination. */
public static final boolean TRIGGER_IMMEDIATE_PAGINATION_DEFAULT = false;
private static final String USE_TIMEOUT_SCHEDULER = "use_timeout_scheduler";
/** Default value for the type of scheduler handling. */
public static final boolean USE_TIMEOUT_SCHEDULER_DEFAULT = true;
private static final String VIEW_LOG_THRESHOLD = "view_log_threshold";
/** Default value for logging view threshold. */
public static final double VIEW_LOG_THRESHOLD_DEFAULT = 0.66d;
......@@ -139,6 +143,17 @@ public final class FeedConfiguration {
TRIGGER_IMMEDIATE_PAGINATION_DEFAULT);
}
/**
* @return Whether the Feed's session handling should use logic to deal with timeouts and
* placing new results below the fold.
*/
@VisibleForTesting
static boolean getUseTimeoutScheduler() {
return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, USE_TIMEOUT_SCHEDULER,
USE_TIMEOUT_SCHEDULER_DEFAULT);
}
/** @return How much of a card must be on screen to generate a UMA log view. */
@VisibleForTesting
static double getViewLogThreshold() {
......@@ -166,6 +181,7 @@ public final class FeedConfiguration {
.put(ConfigKey.SESSION_LIFETIME_MS, FeedConfiguration.getSessionLifetimeMs())
.put(ConfigKey.TRIGGER_IMMEDIATE_PAGINATION,
FeedConfiguration.getTriggerImmediatePagination())
.put(ConfigKey.USE_TIMEOUT_SCHEDULER, FeedConfiguration.getUseTimeoutScheduler())
.put(ConfigKey.VIEW_LOG_THRESHOLD, FeedConfiguration.getViewLogThreshold())
.build();
}
......
......@@ -51,6 +51,7 @@ public class FeedConfigurationTest {
Assert.assertEquals(FeedConfiguration.SESSION_LIFETIME_MS_DEFAULT,
FeedConfiguration.getSessionLifetimeMs());
Assert.assertFalse(FeedConfiguration.getTriggerImmediatePagination());
Assert.assertTrue(FeedConfiguration.getUseTimeoutScheduler());
Assert.assertEquals(FeedConfiguration.VIEW_LOG_THRESHOLD_DEFAULT,
FeedConfiguration.getViewLogThreshold(), ASSERT_EQUALS_DOUBLE_DELTA);
}
......@@ -142,6 +143,16 @@ public class FeedConfigurationTest {
Assert.assertTrue(FeedConfiguration.getTriggerImmediatePagination());
}
@Test
@Feature({"Feed"})
@CommandLineFlags.
Add({"enable-features=InterestFeedContentSuggestions<Trial", "force-fieldtrials=Trial/Group",
"force-fieldtrial-params=Trial.Group:use_timeout_scheduler/false"})
public void
testUseTimeoutScheduler() {
Assert.assertFalse(FeedConfiguration.getUseTimeoutScheduler());
}
@Test
@Feature({"Feed"})
@CommandLineFlags.
......@@ -177,6 +188,7 @@ public class FeedConfigurationTest {
configuration.getValueOrDefault(ConfigKey.SESSION_LIFETIME_MS, 0l));
Assert.assertFalse(
configuration.getValueOrDefault(ConfigKey.TRIGGER_IMMEDIATE_PAGINATION, true));
Assert.assertTrue(configuration.getValueOrDefault(ConfigKey.USE_TIMEOUT_SCHEDULER, false));
Assert.assertEquals(Double.valueOf(FeedConfiguration.VIEW_LOG_THRESHOLD_DEFAULT),
configuration.getValueOrDefault(ConfigKey.VIEW_LOG_THRESHOLD, 0d),
ASSERT_EQUALS_DOUBLE_DELTA);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment