Commit 5f1039f1 authored by Alexandr Ilin's avatar Alexandr Ilin Committed by Commit Bot

predictors: Enable the new preconnect predictor by default

The old predictor is automatically disabled when the new one is enabled.

Change-Id: Ia5c1a79dbeb0e096720fc3d50da3dc707b3761a6
Reviewed-on: https://chromium-review.googlesource.com/1042388Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
Commit-Queue: Alexandr Ilin <alexilin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555766}
parent c72d0d25
...@@ -39,7 +39,7 @@ const char kPreconnectMode[] = "preconnect"; ...@@ -39,7 +39,7 @@ const char kPreconnectMode[] = "preconnect";
const char kNoPreconnectMode[] = "no-preconnect"; const char kNoPreconnectMode[] = "no-preconnect";
const base::Feature kSpeculativePreconnectFeature{ const base::Feature kSpeculativePreconnectFeature{
kSpeculativePreconnectFeatureName, base::FEATURE_DISABLED_BY_DEFAULT}; kSpeculativePreconnectFeatureName, base::FEATURE_ENABLED_BY_DEFAULT};
bool MaybeEnableSpeculativePreconnect(LoadingPredictorConfig* config) { bool MaybeEnableSpeculativePreconnect(LoadingPredictorConfig* config) {
if (!base::FeatureList::IsEnabled(kSpeculativePreconnectFeature)) if (!base::FeatureList::IsEnabled(kSpeculativePreconnectFeature))
...@@ -47,6 +47,9 @@ bool MaybeEnableSpeculativePreconnect(LoadingPredictorConfig* config) { ...@@ -47,6 +47,9 @@ bool MaybeEnableSpeculativePreconnect(LoadingPredictorConfig* config) {
std::string mode_value = base::GetFieldTrialParamValueByFeature( std::string mode_value = base::GetFieldTrialParamValueByFeature(
kSpeculativePreconnectFeature, kModeParamName); kSpeculativePreconnectFeature, kModeParamName);
if (mode_value.empty())
mode_value = kPreconnectMode;
if (mode_value == kLearningMode) { if (mode_value == kLearningMode) {
if (config) { if (config) {
config->mode |= LoadingPredictorConfig::LEARNING; config->mode |= LoadingPredictorConfig::LEARNING;
......
...@@ -66,12 +66,14 @@ class LoadingPredictorConfigTest : public testing::Test { ...@@ -66,12 +66,14 @@ class LoadingPredictorConfigTest : public testing::Test {
LoadingPredictorConfigTest::LoadingPredictorConfigTest() LoadingPredictorConfigTest::LoadingPredictorConfigTest()
: profile_(new TestingProfile()) {} : profile_(new TestingProfile()) {}
TEST_F(LoadingPredictorConfigTest, IsDisabledByDefault) { TEST_F(LoadingPredictorConfigTest, IsEnabledByDefault) {
LoadingPredictorConfig config; LoadingPredictorConfig config;
EXPECT_FALSE(MaybeEnableSpeculativePreconnect(&config)); EXPECT_TRUE(MaybeEnableSpeculativePreconnect(&config));
EXPECT_FALSE(config.IsLearningEnabled()); EXPECT_TRUE(config.IsLearningEnabled());
EXPECT_FALSE(config.IsPreconnectEnabledForSomeOrigin(profile_.get())); EXPECT_TRUE(config.should_disable_other_preconnects);
EXPECT_FALSE(IsNetPredictorEnabled());
EXPECT_TRUE(config.IsPreconnectEnabledForSomeOrigin(profile_.get()));
} }
TEST_F(LoadingPredictorConfigTest, EnablePreconnectLearning) { TEST_F(LoadingPredictorConfigTest, EnablePreconnectLearning) {
......
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