Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5394)

Unified Diff: chrome/browser/predictors/resource_prefetch_common_unittest.cc

Issue 2729563002: predictors: Disable URL-based learning by default. (Closed)
Patch Set: Fix missed initialization. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « chrome/browser/predictors/resource_prefetch_common.cc ('k') | chrome/browser/predictors/resource_prefetch_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698