Commit 130b503a authored by Sky Malice's avatar Sky Malice Committed by Commit Bot

[Feed] Add configuration for a parity More button.

Bug: 992556
Change-Id: I6db46d4606948821a4faf30861e16180fff226c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1752164Reviewed-by: default avatarDan H <harringtond@chromium.org>
Commit-Queue: Sky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686454}
parent 7bd1e28d
......@@ -46,6 +46,10 @@ public final class FeedConfiguration {
/** Default value for initial non cached page size. */
public static final long INITIAL_NON_CACHED_PAGE_SIZE_DEFAULT = 10;
private static final String LIMIT_PAGE_UPDATES_IN_HEAD = "limit_page_updates_in_head";
/** Default value for whether to update HEAD when making a page request. */
public static final boolean LIMIT_PAGE_UPDATES_IN_HEAD_DEFAULT = false;
private static final String LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS =
"logging_immediate_content_threshold_ms";
/** Default value for logging immediate content threshold. */
......@@ -151,6 +155,14 @@ public final class FeedConfiguration {
(int) INITIAL_NON_CACHED_PAGE_SIZE_DEFAULT);
}
/** @return Whether to update HEAD when making a page request. */
@VisibleForTesting
static boolean getLimitPageUpdatesInHead() {
return ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, LIMIT_PAGE_UPDATES_IN_HEAD,
LIMIT_PAGE_UPDATES_IN_HEAD_DEFAULT);
}
/**
* @return How long before showing content after opening NTP is no longer considered immediate
* in UMA.
......@@ -290,6 +302,8 @@ public final class FeedConfiguration {
.put(ConfigKey.FEED_UI_ENABLED, FeedConfiguration.getFeedUiEnabled())
.put(ConfigKey.INITIAL_NON_CACHED_PAGE_SIZE,
FeedConfiguration.getInitialNonCachedPageSize())
.put(ConfigKey.LIMIT_PAGE_UPDATES_IN_HEAD,
FeedConfiguration.getLimitPageUpdatesInHead())
.put(ConfigKey.LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS,
FeedConfiguration.getLoggingImmediateContentThresholdMs())
.put(ConfigKey.MANAGE_INTERESTS_ENABLED,
......
......@@ -46,6 +46,8 @@ public class FeedConfigurationTest {
FeedConfiguration.FEED_UI_ENABLED_DEFAULT, FeedConfiguration.getFeedUiEnabled());
Assert.assertEquals(FeedConfiguration.INITIAL_NON_CACHED_PAGE_SIZE_DEFAULT,
FeedConfiguration.getInitialNonCachedPageSize());
Assert.assertEquals(FeedConfiguration.LIMIT_PAGE_UPDATES_IN_HEAD_DEFAULT,
FeedConfiguration.getLimitPageUpdatesInHead());
Assert.assertEquals(FeedConfiguration.LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS_DEFAULT,
FeedConfiguration.getLoggingImmediateContentThresholdMs());
Assert.assertEquals(FeedConfiguration.MANAGE_INTERESTS_ENABLED_DEFAULT,
......@@ -138,6 +140,16 @@ public class FeedConfigurationTest {
Assert.assertEquals(100, FeedConfiguration.getInitialNonCachedPageSize());
}
@Test
@Feature({"Feed"})
@CommandLineFlags.
Add({"enable-features=InterestFeedContentSuggestions<Trial", "force-fieldtrials=Trial/Group",
"force-fieldtrial-params=Trial.Group:limit_page_updates_in_head/true"})
public void
testLimitPageUpdatesInHead() {
Assert.assertTrue(FeedConfiguration.getLimitPageUpdatesInHead());
}
@Test
@Feature({"Feed"})
@CommandLineFlags.
......@@ -294,6 +306,8 @@ public class FeedConfigurationTest {
Assert.assertFalse(configuration.getValueOrDefault(ConfigKey.FEED_UI_ENABLED, true));
Assert.assertEquals((long) FeedConfiguration.INITIAL_NON_CACHED_PAGE_SIZE_DEFAULT,
configuration.getValueOrDefault(ConfigKey.INITIAL_NON_CACHED_PAGE_SIZE, 0));
Assert.assertFalse(
configuration.getValueOrDefault(ConfigKey.LIMIT_PAGE_UPDATES_IN_HEAD, true));
Assert.assertEquals((long) FeedConfiguration.LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS_DEFAULT,
configuration.getValueOrDefault(
ConfigKey.LOGGING_IMMEDIATE_CONTENT_THRESHOLD_MS, 0l));
......
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