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

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

Issue 2358723002: Convert FieldTrialList to Accept a std::unique_ptr (Closed)
Patch Set: Change Comment nullptr to null Created 4 years, 3 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 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 "base/memory/ptr_util.h"
5 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
6 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
7 #include "base/metrics/statistics_recorder.h" 8 #include "base/metrics/statistics_recorder.h"
8 #include "chrome/browser/net/prediction_options.h" 9 #include "chrome/browser/net/prediction_options.h"
9 #include "chrome/browser/predictors/resource_prefetch_common.h" 10 #include "chrome/browser/predictors/resource_prefetch_common.h"
10 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 11 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
11 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" 12 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 std::unique_ptr<base::FieldTrialList> field_trial_list_; 102 std::unique_ptr<base::FieldTrialList> field_trial_list_;
102 }; 103 };
103 104
104 ResourcePrefetchCommonTest::ResourcePrefetchCommonTest() 105 ResourcePrefetchCommonTest::ResourcePrefetchCommonTest()
105 : loop_(base::MessageLoop::TYPE_DEFAULT), 106 : loop_(base::MessageLoop::TYPE_DEFAULT),
106 ui_thread_(content::BrowserThread::UI, &loop_), 107 ui_thread_(content::BrowserThread::UI, &loop_),
107 profile_(new TestingProfile()) { } 108 profile_(new TestingProfile()) { }
108 109
109 void ResourcePrefetchCommonTest::SetUp() { 110 void ResourcePrefetchCommonTest::SetUp() {
110 field_trial_list_.reset(new base::FieldTrialList( 111 field_trial_list_.reset(new base::FieldTrialList(
111 new metrics::SHA1EntropyProvider("ResourcePrefetchCommonTest"))); 112 base::MakeUnique<metrics::SHA1EntropyProvider>(
113 "ResourcePrefetchCommonTest")));
112 base::StatisticsRecorder::Initialize(); 114 base::StatisticsRecorder::Initialize();
113 } 115 }
114 116
115 TEST_F(ResourcePrefetchCommonTest, FieldTrialNotSpecified) { 117 TEST_F(ResourcePrefetchCommonTest, FieldTrialNotSpecified) {
116 ResourcePrefetchPredictorConfig config; 118 ResourcePrefetchPredictorConfig config;
117 EXPECT_FALSE( 119 EXPECT_FALSE(
118 IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config)); 120 IsSpeculativeResourcePrefetchingEnabled(profile_.get(), &config));
119 TestIsPrefetchDisabled(config); 121 TestIsPrefetchDisabled(config);
120 } 122 }
121 123
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 TestIsPrefetchLearning(config); 317 TestIsPrefetchLearning(config);
316 } 318 }
317 { 319 {
318 std::unique_ptr<NetworkChangeNotifier> mock( 320 std::unique_ptr<NetworkChangeNotifier> mock(
319 new MockNetworkChangeNotifier4G); 321 new MockNetworkChangeNotifier4G);
320 TestIsPrefetchLearning(config); 322 TestIsPrefetchLearning(config);
321 } 323 }
322 } 324 }
323 325
324 } // namespace predictors 326 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698