Commit a23b3e93 authored by Robert Ogden's avatar Robert Ogden Committed by Commit Bot

Promote DRP ClientConfig fetching to its own feature and enable

With the pending rollouts of some features that use the client config,
we should enable everybody to fetch it by default, but leave a kill
switch.

Bug: 1048736
Change-Id: I6f88289173425551c10a0fa44dcc144570a2618b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2107561Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Robert Ogden <robertogden@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751078}
parent c9bcd832
...@@ -110,7 +110,6 @@ ClientConfig CreateEmptyConfig() { ...@@ -110,7 +110,6 @@ ClientConfig CreateEmptyConfig() {
return CreateEmptyProxyConfig(kSessionKey, 1000, 0, 0.5f, false); return CreateEmptyProxyConfig(kSessionKey, 1000, 0, 0.5f, false);
} }
class TestSettingsObserver : public DataReductionProxySettingsObserver { class TestSettingsObserver : public DataReductionProxySettingsObserver {
public: public:
TestSettingsObserver() = default; TestSettingsObserver() = default;
...@@ -533,7 +532,6 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ...@@ -533,7 +532,6 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest,
EXPECT_EQ(result, kDummyBody); EXPECT_EQ(result, kDummyBody);
} }
IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest,
ProxyNotUsedWhenDisabled) { ProxyNotUsedWhenDisabled) {
net::EmbeddedTestServer test_server; net::EmbeddedTestServer test_server;
...@@ -627,8 +625,6 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ...@@ -627,8 +625,6 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest,
EXPECT_EQ(GetBody(), kDummyBody); EXPECT_EQ(GetBody(), kDummyBody);
} }
// Test that enabling the holdback disables the proxy and that the client config // Test that enabling the holdback disables the proxy and that the client config
// is fetched when lite page redirect preview is enabled. // is fetched when lite page redirect preview is enabled.
class DataReductionProxyWithHoldbackBrowsertest class DataReductionProxyWithHoldbackBrowsertest
...@@ -636,39 +632,36 @@ class DataReductionProxyWithHoldbackBrowsertest ...@@ -636,39 +632,36 @@ class DataReductionProxyWithHoldbackBrowsertest
public DataReductionProxyBrowsertest { public DataReductionProxyBrowsertest {
public: public:
DataReductionProxyWithHoldbackBrowsertest() DataReductionProxyWithHoldbackBrowsertest()
: DataReductionProxyBrowsertest(), : // Consider the holdback as enabled if holdback is enabled or the
// Consider the holdback as enabled if holdback is enabled or the // |enable_config_service_fetches_| is enabled.
// |force_enable_config_service_fetches_| is enabled.
data_reduction_proxy_holdback_enabled_(std::get<2>(GetParam()) || data_reduction_proxy_holdback_enabled_(std::get<2>(GetParam()) ||
std::get<0>(GetParam())), std::get<0>(GetParam())),
lite_page_redirect_previews_enabled_(std::get<1>(GetParam())), lite_page_redirect_previews_enabled_(std::get<1>(GetParam())),
force_enable_config_service_fetches_(std::get<2>(GetParam())) {} enable_config_service_fetches_(std::get<2>(GetParam())) {}
void SetUp() override { void SetUp() override {
if (force_enable_config_service_fetches_) { data_reduction_proxy_holdback_feature_list_.InitWithFeatureState(
scoped_feature_list_.InitAndEnableFeatureWithParameters( data_reduction_proxy::features::kDataReductionProxyHoldback,
data_reduction_proxy::features::kDataReductionProxyHoldback, data_reduction_proxy_holdback_enabled_);
{{"force_enable_config_service_fetches", "true"}});
} fetch_client_config_feature_list_.InitWithFeatureState(
if (!force_enable_config_service_fetches_ && data_reduction_proxy::features::kFetchClientConfig,
data_reduction_proxy_holdback_enabled_) { enable_config_service_fetches_);
scoped_feature_list_.InitAndEnableFeature(
data_reduction_proxy::features::kDataReductionProxyHoldback); previews_lite_page_redirect_feature_list_.InitWithFeatureState(
} previews::features::kLitePageServerPreviews,
if (lite_page_redirect_previews_enabled_) { lite_page_redirect_previews_enabled_);
previews_lite_page_redirect_feature_list_.InitAndEnableFeature(
previews::features::kLitePageServerPreviews);
}
InProcessBrowserTest::SetUp(); InProcessBrowserTest::SetUp();
} }
const bool data_reduction_proxy_holdback_enabled_; const bool data_reduction_proxy_holdback_enabled_;
const bool lite_page_redirect_previews_enabled_; const bool lite_page_redirect_previews_enabled_;
const bool force_enable_config_service_fetches_; const bool enable_config_service_fetches_;
private: private:
base::test::ScopedFeatureList scoped_feature_list_; base::test::ScopedFeatureList data_reduction_proxy_holdback_feature_list_;
base::test::ScopedFeatureList fetch_client_config_feature_list_;
base::test::ScopedFeatureList previews_lite_page_redirect_feature_list_; base::test::ScopedFeatureList previews_lite_page_redirect_feature_list_;
}; };
...@@ -717,7 +710,6 @@ class DataReductionProxyExpBrowsertest : public DataReductionProxyBrowsertest { ...@@ -717,7 +710,6 @@ class DataReductionProxyExpBrowsertest : public DataReductionProxyBrowsertest {
} }
}; };
class DataReductionProxyExpFeatureBrowsertest class DataReductionProxyExpFeatureBrowsertest
: public DataReductionProxyBrowsertest { : public DataReductionProxyBrowsertest {
public: public:
...@@ -741,7 +733,6 @@ class DataReductionProxyExpFeatureBrowsertest ...@@ -741,7 +733,6 @@ class DataReductionProxyExpFeatureBrowsertest
const std::string experiment_name = "foo_feature_experiment"; const std::string experiment_name = "foo_feature_experiment";
}; };
// Threadsafe log for recording a sequence of events as newline separated text. // Threadsafe log for recording a sequence of events as newline separated text.
class EventLog { class EventLog {
public: public:
...@@ -859,7 +850,6 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ...@@ -859,7 +850,6 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest,
EXPECT_FALSE(observer.last_initiator_origin().has_value()); EXPECT_FALSE(observer.last_initiator_origin().has_value());
} }
// Simulate clicking on a same-site link. // Simulate clicking on a same-site link.
{ {
content::TestNavigationObserver observer( content::TestNavigationObserver observer(
...@@ -883,5 +873,4 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest, ...@@ -883,5 +873,4 @@ IN_PROC_BROWSER_TEST_F(DataReductionProxyBrowsertest,
} }
} }
} // namespace data_reduction_proxy } // namespace data_reduction_proxy
...@@ -131,11 +131,11 @@ class IsolatedPrerenderBrowserTest ...@@ -131,11 +131,11 @@ class IsolatedPrerenderBrowserTest
} }
void SetUp() override { void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(features::kIsolatePrerenders); scoped_feature_list_.InitWithFeatures(
{features::kIsolatePrerenders,
holdback_scoped_feature_list_.InitAndEnableFeatureWithParameters( data_reduction_proxy::features::kDataReductionProxyHoldback,
data_reduction_proxy::features::kDataReductionProxyHoldback, data_reduction_proxy::features::kFetchClientConfig},
{{"force_enable_config_service_fetches", "true"}}); {});
InProcessBrowserTest::SetUp(); InProcessBrowserTest::SetUp();
} }
...@@ -276,7 +276,6 @@ class IsolatedPrerenderBrowserTest ...@@ -276,7 +276,6 @@ class IsolatedPrerenderBrowserTest
} }
base::test::ScopedFeatureList scoped_feature_list_; base::test::ScopedFeatureList scoped_feature_list_;
base::test::ScopedFeatureList holdback_scoped_feature_list_;
std::unique_ptr<net::EmbeddedTestServer> origin_server_; std::unique_ptr<net::EmbeddedTestServer> origin_server_;
std::unique_ptr<net::EmbeddedTestServer> config_server_; std::unique_ptr<net::EmbeddedTestServer> config_server_;
size_t origin_server_request_with_cookies_ = 0; size_t origin_server_request_with_cookies_ = 0;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
namespace data_reduction_proxy { namespace data_reduction_proxy {
namespace features { namespace features {
// Enables the data saver promo for low memory Android devices. // Enables the data saver promo for low memory Android devices.
const base::Feature kDataReductionProxyLowMemoryDevicePromo{ const base::Feature kDataReductionProxyLowMemoryDevicePromo{
"DataReductionProxyLowMemoryDevicePromo", "DataReductionProxyLowMemoryDevicePromo",
...@@ -27,9 +26,8 @@ const base::Feature kDataReductionProxyHoldback{ ...@@ -27,9 +26,8 @@ const base::Feature kDataReductionProxyHoldback{
// Enables data reduction proxy when network service is enabled. // Enables data reduction proxy when network service is enabled.
const base::Feature kDataReductionProxyEnabledWithNetworkService{ const base::Feature kDataReductionProxyEnabledWithNetworkService{
"DataReductionProxyEnabledWithNetworkService", "DataReductionProxyEnabledWithNetworkService",
base::FEATURE_ENABLED_BY_DEFAULT base::FEATURE_ENABLED_BY_DEFAULT};
};
// Enables block action of all proxies when 502 is received with no // Enables block action of all proxies when 502 is received with no
// Chrome-Proxy header. The block duration is configurable via field trial with // Chrome-Proxy header. The block duration is configurable via field trial with
...@@ -67,5 +65,9 @@ const base::Feature kDataReductionProxyAggressiveConfigFetch{ ...@@ -67,5 +65,9 @@ const base::Feature kDataReductionProxyAggressiveConfigFetch{
const base::Feature kReportSaveDataSavings{"ReportSaveDataSavings", const base::Feature kReportSaveDataSavings{"ReportSaveDataSavings",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Enables fetching the Client Config for server-based Lite Mode features.
const base::Feature kFetchClientConfig{"DataReductionProxyFetchClientConfig",
base::FEATURE_ENABLED_BY_DEFAULT};
} // namespace features } // namespace features
} // namespace data_reduction_proxy } // namespace data_reduction_proxy
...@@ -21,6 +21,7 @@ extern const base::Feature kDataReductionProxyDisableProxyFailedWarmup; ...@@ -21,6 +21,7 @@ extern const base::Feature kDataReductionProxyDisableProxyFailedWarmup;
extern const base::Feature kDataReductionProxyServerExperiments; extern const base::Feature kDataReductionProxyServerExperiments;
extern const base::Feature kDataReductionProxyAggressiveConfigFetch; extern const base::Feature kDataReductionProxyAggressiveConfigFetch;
extern const base::Feature kReportSaveDataSavings; extern const base::Feature kReportSaveDataSavings;
extern const base::Feature kFetchClientConfig;
} // namespace features } // namespace features
} // namespace data_reduction_proxy } // namespace data_reduction_proxy
......
...@@ -91,16 +91,10 @@ bool IsIncludedInHoldbackFieldTrial() { ...@@ -91,16 +91,10 @@ bool IsIncludedInHoldbackFieldTrial() {
} }
bool ForceEnableClientConfigServiceForAllDataSaverUsers() { bool ForceEnableClientConfigServiceForAllDataSaverUsers() {
// Client config is enabled for all data users that are not in the return base::FeatureList::IsEnabled(
// kDataReductionProxyHoldback. Users that have kDataReductionProxyHoldback data_reduction_proxy::features::kFetchClientConfig);
// enabled have config service client enabled only if
// |force_enable_config_service_fetches| is set to true.
return GetFieldTrialParamByFeatureAsBool(
data_reduction_proxy::features::kDataReductionProxyHoldback,
"force_enable_config_service_fetches", false);
} }
bool IsForcePingbackEnabledViaFlags() { bool IsForcePingbackEnabledViaFlags() {
return base::CommandLine::ForCurrentProcess()->HasSwitch( return base::CommandLine::ForCurrentProcess()->HasSwitch(
data_reduction_proxy::switches::kEnableDataReductionProxyForcePingback); data_reduction_proxy::switches::kEnableDataReductionProxyForcePingback);
...@@ -288,8 +282,6 @@ std::string GetDataSaverServerExperiments() { ...@@ -288,8 +282,6 @@ std::string GetDataSaverServerExperiments() {
features::kDataReductionProxyServerExperiments, kExperimentsOption); features::kDataReductionProxyServerExperiments, kExperimentsOption);
} }
bool IsEnabledWithNetworkService() { bool IsEnabledWithNetworkService() {
return base::FeatureList::IsEnabled( return base::FeatureList::IsEnabled(
data_reduction_proxy::features:: data_reduction_proxy::features::
......
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