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

Side by Side Diff: chrome/browser/predictors/resource_prefetch_common_unittest.cc

Issue 2532933002: predictors: Remove unused field trial configuration parsing. (Closed)
Patch Set: . Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory>
6 #include <string>
7
8 #include "base/command_line.h"
5 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
6 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
7 #include "base/metrics/field_trial.h"
8 #include "base/metrics/statistics_recorder.h"
9 #include "chrome/browser/net/prediction_options.h" 11 #include "chrome/browser/net/prediction_options.h"
10 #include "chrome/browser/predictors/resource_prefetch_common.h" 12 #include "chrome/browser/predictors/resource_prefetch_common.h"
11 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 13 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
12 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
13 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
17 #include "components/prefs/pref_service.h" 18 #include "components/prefs/pref_service.h"
18 #include "components/variations/entropy_provider.h"
19 #include "content/public/test/test_browser_thread.h" 19 #include "content/public/test/test_browser_thread.h"
20 #include "net/base/network_change_notifier.h" 20 #include "net/base/network_change_notifier.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 using chrome_browser_net::NetworkPredictionOptions; 23 using chrome_browser_net::NetworkPredictionOptions;
24 using net::NetworkChangeNotifier; 24 using net::NetworkChangeNotifier;
25 25
26 namespace { 26 namespace {
27 27
28 class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier { 28 class MockNetworkChangeNotifierWIFI : public NetworkChangeNotifier {
29 public: 29 public:
30 ConnectionType GetCurrentConnectionType() const override { 30 ConnectionType GetCurrentConnectionType() const override {
31 return NetworkChangeNotifier::CONNECTION_WIFI; 31 return NetworkChangeNotifier::CONNECTION_WIFI;
32 } 32 }
33 }; 33 };
34 34
35 class MockNetworkChangeNotifier4G : public NetworkChangeNotifier { 35 class MockNetworkChangeNotifier4G : public NetworkChangeNotifier {
36 public: 36 public:
37 ConnectionType GetCurrentConnectionType() const override { 37 ConnectionType GetCurrentConnectionType() const override {
38 return NetworkChangeNotifier::CONNECTION_4G; 38 return NetworkChangeNotifier::CONNECTION_4G;
39 } 39 }
40 }; 40 };
41 41
42 } // namespace 42 } // namespace
43 43
44 namespace predictors { 44 namespace predictors {
45 45
46 class ResourcePrefetchCommonTest : public testing::Test { 46 class ResourcePrefetchCommonTest : public testing::Test {
47 public: 47 public:
48 ResourcePrefetchCommonTest(); 48 ResourcePrefetchCommonTest();
49 void SetUp() override;
50
51 void CreateTestFieldTrial(const std::string& name,
52 const std::string& group_name) {
53 base::FieldTrial* trial = base::FieldTrialList::CreateFieldTrial(
54 name, group_name);
55 trial->group();
56 }
57 49
58 void SetPreference(NetworkPredictionOptions value) { 50 void SetPreference(NetworkPredictionOptions value) {
59 profile_->GetPrefs()->SetInteger(prefs::kNetworkPredictionOptions, value); 51 profile_->GetPrefs()->SetInteger(prefs::kNetworkPredictionOptions, value);
60 } 52 }
61 53
62 void TestIsPrefetchDisabled(ResourcePrefetchPredictorConfig& config) { 54 void SetCommandLineValue(const std::string& value) {
55 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
56 switches::kSpeculativeResourcePrefetching, value);
57 }
58
59 void TestIsPrefetchDisabled(const ResourcePrefetchPredictorConfig& config) {
63 EXPECT_FALSE(config.IsLearningEnabled()); 60 EXPECT_FALSE(config.IsLearningEnabled());
64 EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get())); 61 EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get()));
65 EXPECT_FALSE(config.IsURLLearningEnabled()); 62 EXPECT_FALSE(config.IsURLLearningEnabled());
66 EXPECT_FALSE(config.IsHostLearningEnabled()); 63 EXPECT_FALSE(config.IsHostLearningEnabled());
67 EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get())); 64 EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get()));
68 EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get())); 65 EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get()));
69 } 66 }
70 67
71 void TestIsPrefetchEnabled(ResourcePrefetchPredictorConfig& config) { 68 void TestIsPrefetchEnabled(const ResourcePrefetchPredictorConfig& config) {
72 EXPECT_TRUE(config.IsLearningEnabled()); 69 EXPECT_TRUE(config.IsLearningEnabled());
73 EXPECT_TRUE(config.IsPrefetchingEnabled(profile_.get())); 70 EXPECT_TRUE(config.IsPrefetchingEnabled(profile_.get()));
74 EXPECT_TRUE(config.IsURLLearningEnabled()); 71 EXPECT_TRUE(config.IsURLLearningEnabled());
75 EXPECT_TRUE(config.IsHostLearningEnabled()); 72 EXPECT_TRUE(config.IsHostLearningEnabled());
76 EXPECT_TRUE(config.IsURLPrefetchingEnabled(profile_.get())); 73 EXPECT_TRUE(config.IsURLPrefetchingEnabled(profile_.get()));
77 EXPECT_TRUE(config.IsHostPrefetchingEnabled(profile_.get())); 74 EXPECT_TRUE(config.IsHostPrefetchingEnabled(profile_.get()));
78 } 75 }
79 76
80 void TestIsPrefetchLearning(ResourcePrefetchPredictorConfig& config) { 77 void TestIsPrefetchLearning(const ResourcePrefetchPredictorConfig& config) {
81 EXPECT_TRUE(config.IsLearningEnabled()); 78 EXPECT_TRUE(config.IsLearningEnabled());
82 EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get())); 79 EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get()));
83 EXPECT_TRUE(config.IsURLLearningEnabled()); 80 EXPECT_TRUE(config.IsURLLearningEnabled());
84 EXPECT_TRUE(config.IsHostLearningEnabled()); 81 EXPECT_TRUE(config.IsHostLearningEnabled());
85 EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get())); 82 EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get()));
86 EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get())); 83 EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get()));
87 } 84 }
88 85
89 void TestIsDefaultExtraConfig(ResourcePrefetchPredictorConfig& config) { 86 void TestIsDefaultExtraConfig(const ResourcePrefetchPredictorConfig& config) {
90 EXPECT_FALSE(config.IsLowConfidenceForTest()); 87 EXPECT_FALSE(config.IsLowConfidenceForTest());
91 EXPECT_FALSE(config.IsHighConfidenceForTest()); 88 EXPECT_FALSE(config.IsHighConfidenceForTest());
92 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest()); 89 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
93 EXPECT_FALSE(config.IsSmallDBEnabledForTest()); 90 EXPECT_FALSE(config.IsSmallDBEnabledForTest());
94 } 91 }
95 92
96 protected: 93 protected:
97 base::MessageLoop loop_; 94 base::MessageLoop loop_;
98 content::TestBrowserThread ui_thread_; 95 content::TestBrowserThread ui_thread_;
99 std::unique_ptr<TestingProfile> profile_; 96 std::unique_ptr<TestingProfile> profile_;
100
101 private:
102 std::unique_ptr<base::FieldTrialList> field_trial_list_;
103 }; 97 };
104 98
105 ResourcePrefetchCommonTest::ResourcePrefetchCommonTest() 99 ResourcePrefetchCommonTest::ResourcePrefetchCommonTest()
106 : loop_(base::MessageLoop::TYPE_DEFAULT), 100 : loop_(base::MessageLoop::TYPE_DEFAULT),
107 ui_thread_(content::BrowserThread::UI, &loop_), 101 ui_thread_(content::BrowserThread::UI, &loop_),
108 profile_(new TestingProfile()) { } 102 profile_(new TestingProfile()) { }
109 103
110 void ResourcePrefetchCommonTest::SetUp() { 104 TEST_F(ResourcePrefetchCommonTest, IsDisabledByDefault) {
pasko 2016/11/28 16:31:13 On related note: I am not sure the clutter around
Benoit L 2016/11/28 17:09:55 This will become a bit more complex with the exter
111 field_trial_list_.reset(new base::FieldTrialList(
112 base::MakeUnique<metrics::SHA1EntropyProvider>(
113 "ResourcePrefetchCommonTest")));
114 base::StatisticsRecorder::Initialize();
115 }
116
117 TEST_F(ResourcePrefetchCommonTest, FieldTrialNotSpecified) {
118 ResourcePrefetchPredictorConfig config; 105 ResourcePrefetchPredictorConfig config;
119 EXPECT_FALSE( 106 EXPECT_FALSE(
120 IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); 107 IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
121 TestIsPrefetchDisabled(config); 108 TestIsPrefetchDisabled(config);
pasko 2016/11/28 16:31:13 This is becoming the single callsite for this func
Benoit L 2016/11/28 17:09:55 Done.
122 }
123
124 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingDisabled) {
125 CreateTestFieldTrial("SpeculativeResourcePrefetching",
126 "Prefetching=Disabled");
127 ResourcePrefetchPredictorConfig config;
128 EXPECT_FALSE(
129 IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
130 TestIsPrefetchDisabled(config);
131 }
132
133 TEST_F(ResourcePrefetchCommonTest, FieldTrialLearningHost) {
134 CreateTestFieldTrial("SpeculativeResourcePrefetching",
135 "Prefetching=Learning:Predictor=Host");
136 ResourcePrefetchPredictorConfig config;
137 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
138 EXPECT_TRUE(config.IsLearningEnabled());
139 EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get()));
140 EXPECT_FALSE(config.IsURLLearningEnabled());
141 EXPECT_TRUE(config.IsHostLearningEnabled());
142 EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get()));
143 EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get()));
144 TestIsDefaultExtraConfig(config); 109 TestIsDefaultExtraConfig(config);
145 } 110 }
146 111
147 TEST_F(ResourcePrefetchCommonTest, FieldTrialLearningURL) { 112 TEST_F(ResourcePrefetchCommonTest, EnableLearning) {
148 CreateTestFieldTrial("SpeculativeResourcePrefetching", 113 SetCommandLineValue("learning");
149 "Prefetching=Learning:Predictor=Url");
150 ResourcePrefetchPredictorConfig config;
151 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
152 EXPECT_TRUE(config.IsLearningEnabled());
153 EXPECT_FALSE(config.IsPrefetchingEnabled(profile_.get()));
154 EXPECT_TRUE(config.IsURLLearningEnabled());
155 EXPECT_FALSE(config.IsHostLearningEnabled());
156 EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get()));
157 EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get()));
158 TestIsDefaultExtraConfig(config);
159 }
160
161 TEST_F(ResourcePrefetchCommonTest, FieldTrialLearning) {
162 CreateTestFieldTrial("SpeculativeResourcePrefetching",
163 "Prefetching=Learning");
164 ResourcePrefetchPredictorConfig config; 114 ResourcePrefetchPredictorConfig config;
165 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); 115 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
166 TestIsPrefetchLearning(config); 116 TestIsPrefetchLearning(config);
167 TestIsDefaultExtraConfig(config); 117 TestIsDefaultExtraConfig(config);
168 } 118 }
169 119
170 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingHost) { 120 TEST_F(ResourcePrefetchCommonTest, EnablePrefetch) {
171 CreateTestFieldTrial("SpeculativeResourcePrefetching", 121 SetCommandLineValue("enabled");
172 "Prefetching=Enabled:Predictor=Host");
173 ResourcePrefetchPredictorConfig config;
174 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
175 EXPECT_TRUE(config.IsLearningEnabled());
176 EXPECT_TRUE(config.IsPrefetchingEnabled(profile_.get()));
177 EXPECT_FALSE(config.IsURLLearningEnabled());
178 EXPECT_TRUE(config.IsHostLearningEnabled());
179 EXPECT_FALSE(config.IsURLPrefetchingEnabled(profile_.get()));
180 EXPECT_TRUE(config.IsHostPrefetchingEnabled(profile_.get()));
181 TestIsDefaultExtraConfig(config);
182 }
183
184 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingURL) {
185 CreateTestFieldTrial("SpeculativeResourcePrefetching",
186 "Prefetching=Enabled:Predictor=Url");
187 ResourcePrefetchPredictorConfig config;
188 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
189 EXPECT_TRUE(config.IsLearningEnabled());
190 EXPECT_TRUE(config.IsPrefetchingEnabled(profile_.get()));
191 EXPECT_TRUE(config.IsURLLearningEnabled());
192 EXPECT_FALSE(config.IsHostLearningEnabled());
193 EXPECT_TRUE(config.IsURLPrefetchingEnabled(profile_.get()));
194 EXPECT_FALSE(config.IsHostPrefetchingEnabled(profile_.get()));
195 TestIsDefaultExtraConfig(config);
196 }
197
198 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetching) {
199 CreateTestFieldTrial("SpeculativeResourcePrefetching", "Prefetching=Enabled");
200 ResourcePrefetchPredictorConfig config; 122 ResourcePrefetchPredictorConfig config;
201 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); 123 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
202 TestIsPrefetchEnabled(config); 124 TestIsPrefetchEnabled(config);
203 TestIsDefaultExtraConfig(config); 125 TestIsDefaultExtraConfig(config);
204 } 126 }
205 127
206 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingLowConfidence) { 128
207 CreateTestFieldTrial("SpeculativeResourcePrefetching", 129 // Verifies whether prefetching in the field trial is disabled according to
pasko 2016/11/28 16:31:13 Should we remove the mention of the field trial?
Benoit L 2016/11/28 17:09:55 Done.
208 "Prefetching=Enabled:Confidence=Low"); 130 // the network type. But learning should not be disabled by network.
131 TEST_F(ResourcePrefetchCommonTest, RespectsNetworkSettings) {
132 SetCommandLineValue("enabled");
209 ResourcePrefetchPredictorConfig config; 133 ResourcePrefetchPredictorConfig config;
210 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); 134 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
211 TestIsPrefetchEnabled(config); 135 TestIsPrefetchEnabled(config);
212 EXPECT_TRUE(config.IsLowConfidenceForTest()); 136 TestIsDefaultExtraConfig(config);
213 EXPECT_FALSE(config.IsHighConfidenceForTest());
214 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
215 EXPECT_FALSE(config.IsSmallDBEnabledForTest());
216 }
217
218 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingHighConfidence) {
219 CreateTestFieldTrial("SpeculativeResourcePrefetching",
220 "Prefetching=Enabled:Confidence=High");
221 ResourcePrefetchPredictorConfig config;
222 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
223 TestIsPrefetchEnabled(config);
224 EXPECT_FALSE(config.IsLowConfidenceForTest());
225 EXPECT_TRUE(config.IsHighConfidenceForTest());
226 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
227 EXPECT_FALSE(config.IsSmallDBEnabledForTest());
228 }
229
230 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingMoreResources) {
231 CreateTestFieldTrial("SpeculativeResourcePrefetching",
232 "Prefetching=Learning:MoreResources=Enabled");
233 ResourcePrefetchPredictorConfig config;
234 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
235 TestIsPrefetchLearning(config);
236 EXPECT_FALSE(config.IsLowConfidenceForTest());
237 EXPECT_FALSE(config.IsHighConfidenceForTest());
238 EXPECT_TRUE(config.IsMoreResourcesEnabledForTest());
239 EXPECT_FALSE(config.IsSmallDBEnabledForTest());
240 }
241
242 TEST_F(ResourcePrefetchCommonTest, FieldTrialLearningSmallDB) {
243 CreateTestFieldTrial("SpeculativeResourcePrefetching",
244 "Prefetching=Learning:SmallDB=Enabled");
245 ResourcePrefetchPredictorConfig config;
246 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
247 TestIsPrefetchLearning(config);
248 EXPECT_FALSE(config.IsLowConfidenceForTest());
249 EXPECT_FALSE(config.IsHighConfidenceForTest());
250 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
251 EXPECT_TRUE(config.IsSmallDBEnabledForTest());
252 }
253
254 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingSmallDB) {
255 CreateTestFieldTrial("SpeculativeResourcePrefetching",
256 "Prefetching=Enabled:SmallDB=Enabled");
257 ResourcePrefetchPredictorConfig config;
258 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
259 TestIsPrefetchEnabled(config);
260 EXPECT_FALSE(config.IsLowConfidenceForTest());
261 EXPECT_FALSE(config.IsHighConfidenceForTest());
262 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
263 EXPECT_TRUE(config.IsSmallDBEnabledForTest());
264 }
265
266 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingSmallDBLowConfidence) {
267 CreateTestFieldTrial("SpeculativeResourcePrefetching",
268 "Prefetching=Enabled:SmallDB=Enabled:Confidence=Low");
269 ResourcePrefetchPredictorConfig config;
270 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
271 TestIsPrefetchEnabled(config);
272 EXPECT_TRUE(config.IsLowConfidenceForTest());
273 EXPECT_FALSE(config.IsHighConfidenceForTest());
274 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
275 EXPECT_TRUE(config.IsSmallDBEnabledForTest());
276 }
277
278 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingSmallDBHighConfidence) {
279 CreateTestFieldTrial("SpeculativeResourcePrefetching",
280 "Prefetching=Enabled:SmallDB=Enabled:Confidence=High");
281 ResourcePrefetchPredictorConfig config;
282 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
283 TestIsPrefetchEnabled(config);
284 EXPECT_FALSE(config.IsLowConfidenceForTest());
285 EXPECT_TRUE(config.IsHighConfidenceForTest());
286 EXPECT_FALSE(config.IsMoreResourcesEnabledForTest());
287 EXPECT_TRUE(config.IsSmallDBEnabledForTest());
288 }
289
290 // Verifies whether prefetching in the field trial is disabled according to
291 // the network type. But learning should not be disabled by network.
292 TEST_F(ResourcePrefetchCommonTest, FieldTrialPrefetchingDisabledByNetwork) {
293 CreateTestFieldTrial("SpeculativeResourcePrefetching",
294 "Prefetching=Enabled");
295 ResourcePrefetchPredictorConfig config;
296 EXPECT_TRUE(IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
297 TestIsPrefetchEnabled(config);
298 137
299 // Set preference to WIFI_ONLY: prefetch when not on cellular. 138 // Set preference to WIFI_ONLY: prefetch when not on cellular.
300 SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_WIFI_ONLY); 139 SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_WIFI_ONLY);
301 { 140 {
302 std::unique_ptr<NetworkChangeNotifier> mock( 141 std::unique_ptr<NetworkChangeNotifier> mock(
303 new MockNetworkChangeNotifierWIFI); 142 new MockNetworkChangeNotifierWIFI);
304 TestIsPrefetchEnabled(config); 143 TestIsPrefetchEnabled(config);
305 } 144 }
306 { 145 {
307 std::unique_ptr<NetworkChangeNotifier> mock( 146 std::unique_ptr<NetworkChangeNotifier> mock(
308 new MockNetworkChangeNotifier4G); 147 new MockNetworkChangeNotifier4G);
309 TestIsPrefetchLearning(config); 148 TestIsPrefetchLearning(config);
310 } 149 }
311 150
312 // Set preference to NEVER: never prefetch. 151 // Set preference to NEVER: never prefetch.
313 SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_NEVER); 152 SetPreference(NetworkPredictionOptions::NETWORK_PREDICTION_NEVER);
314 { 153 {
315 std::unique_ptr<NetworkChangeNotifier> mock( 154 std::unique_ptr<NetworkChangeNotifier> mock(
316 new MockNetworkChangeNotifierWIFI); 155 new MockNetworkChangeNotifierWIFI);
317 TestIsPrefetchLearning(config); 156 TestIsPrefetchLearning(config);
318 } 157 }
319 { 158 {
320 std::unique_ptr<NetworkChangeNotifier> mock( 159 std::unique_ptr<NetworkChangeNotifier> mock(
321 new MockNetworkChangeNotifier4G); 160 new MockNetworkChangeNotifier4G);
322 TestIsPrefetchLearning(config); 161 TestIsPrefetchLearning(config);
323 } 162 }
324 } 163 }
325 164
326 } // namespace predictors 165 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698