| 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..93f35ad9646fc14f99da3389a3d50eef866e2b63 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"
|
| @@ -71,6 +70,7 @@ class ResourcePrefetchCommonTest : public testing::Test {
|
| EXPECT_FALSE(config.IsHighConfidenceForTest());
|
| EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
|
| EXPECT_FALSE(config.IsSmallDBEnabledForTest());
|
| + EXPECT_FALSE(config.is_url_learning_enabled);
|
| }
|
|
|
| protected:
|
| @@ -92,7 +92,8 @@ TEST_F(ResourcePrefetchCommonTest, IsDisabledByDefault) {
|
| EXPECT_FALSE(config.IsLearningEnabled());
|
| EXPECT_FALSE(config.IsPrefetchingEnabledForOrigin(profile_.get(),
|
| PrefetchOrigin::EXTERNAL));
|
| - EXPECT_FALSE(config.IsLearningEnabled());
|
| + EXPECT_FALSE(config.IsPrefetchingEnabledForOrigin(
|
| + profile_.get(), PrefetchOrigin::NAVIGATION));
|
|
|
| TestIsDefaultExtraConfig(config);
|
| }
|
| @@ -133,6 +134,18 @@ TEST_F(ResourcePrefetchCommonTest, EnablePrefetchExternalOnly) {
|
| TestIsDefaultExtraConfig(config);
|
| }
|
|
|
| +TEST_F(ResourcePrefetchCommonTest, EnableUrlLearning) {
|
| + variations::testing::VariationParamsManager params_manager(
|
| + "dummy-trial",
|
| + {{kModeParamName, kLearningMode}, {kEnableUrlLearningParamName, "true"}},
|
| + {kSpeculativeResourcePrefetchingFeatureName});
|
| +
|
| + ResourcePrefetchPredictorConfig config;
|
| + EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
|
| + TestIsPrefetchLearning(config);
|
| + EXPECT_TRUE(config.is_url_learning_enabled);
|
| +}
|
| +
|
| // Verifies whether prefetching is disabled according to the network type. But
|
| // learning should not be disabled by network.
|
| TEST_F(ResourcePrefetchCommonTest, RespectsNetworkSettings) {
|
|
|