Index: chrome/browser/predictors/resource_prefetch_common_unittest.cc |
diff --git a/chrome/browser/predictors/resource_prefetch_common_unittest.cc b/chrome/browser/predictors/resource_prefetch_common_unittest.cc |
index 836e42289a03da307eaa0674ff35fb5e60854c44..5dff8e358f690d7f36873f4ddb4e81887da64a3b 100644 |
--- a/chrome/browser/predictors/resource_prefetch_common_unittest.cc |
+++ b/chrome/browser/predictors/resource_prefetch_common_unittest.cc |
@@ -5,7 +5,6 @@ |
#include <memory> |
#include <string> |
-#include "base/command_line.h" |
#include "base/memory/ptr_util.h" |
#include "base/message_loop/message_loop.h" |
#include "chrome/browser/net/prediction_options.h" |
@@ -92,7 +91,8 @@ TEST_F(ResourcePrefetchCommonTest, IsDisabledByDefault) { |
EXPECT_FALSE(config.IsLearningEnabled()); |
EXPECT_FALSE(config.IsPrefetchingEnabledForOrigin(profile_.get(), |
PrefetchOrigin::EXTERNAL)); |
- EXPECT_FALSE(config.IsLearningEnabled()); |
alexilin
2017/03/01 12:57:57
Second check of the same thing. Looks like a bug.
|
+ EXPECT_FALSE(config.IsPrefetchingEnabledForOrigin( |
+ profile_.get(), PrefetchOrigin::NAVIGATION)); |
TestIsDefaultExtraConfig(config); |
} |
@@ -133,6 +133,48 @@ TEST_F(ResourcePrefetchCommonTest, EnablePrefetchExternalOnly) { |
TestIsDefaultExtraConfig(config); |
} |
+TEST_F(ResourcePrefetchCommonTest, EnableUrlLearning) { |
+ variations::testing::VariationParamsManager params_manager( |
+ "dummy-trial", |
+ {{kModeParamName, kLearningMode}, {kKeyTypeParamName, kUrlKeyType}}, |
+ {kSpeculativeResourcePrefetchingFeatureName}); |
+ |
+ ResourcePrefetchPredictorConfig config; |
+ EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); |
+ TestIsPrefetchLearning(config); |
+ EXPECT_TRUE(config.IsURLLearningEnabled()); |
+ EXPECT_FALSE(config.IsHostLearningEnabled()); |
+ TestIsDefaultExtraConfig(config); |
+} |
+ |
+TEST_F(ResourcePrefetchCommonTest, EnableHostLearning) { |
+ variations::testing::VariationParamsManager params_manager( |
+ "dummy-trial", |
+ {{kModeParamName, kLearningMode}, {kKeyTypeParamName, kHostKeyType}}, |
+ {kSpeculativeResourcePrefetchingFeatureName}); |
+ |
+ ResourcePrefetchPredictorConfig config; |
+ EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); |
+ TestIsPrefetchLearning(config); |
+ EXPECT_FALSE(config.IsURLLearningEnabled()); |
+ EXPECT_TRUE(config.IsHostLearningEnabled()); |
+ TestIsDefaultExtraConfig(config); |
+} |
+ |
+TEST_F(ResourcePrefetchCommonTest, EnableBothLearning) { |
+ variations::testing::VariationParamsManager params_manager( |
+ "dummy-trial", |
+ {{kModeParamName, kLearningMode}, {kKeyTypeParamName, kBothKeyType}}, |
+ {kSpeculativeResourcePrefetchingFeatureName}); |
+ |
+ ResourcePrefetchPredictorConfig config; |
+ EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); |
+ TestIsPrefetchLearning(config); |
+ EXPECT_TRUE(config.IsURLLearningEnabled()); |
+ EXPECT_TRUE(config.IsHostLearningEnabled()); |
+ TestIsDefaultExtraConfig(config); |
+} |
+ |
// Verifies whether prefetching is disabled according to the network type. But |
// learning should not be disabled by network. |
TEST_F(ResourcePrefetchCommonTest, RespectsNetworkSettings) { |