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

Side by Side Diff: components/omnibox/browser/zero_suggest_provider_unittest.cc

Issue 2358723002: Convert FieldTrialList to Accept a std::unique_ptr (Closed)
Patch Set: Change Comment nullptr to null Created 4 years, 2 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 "components/omnibox/browser/zero_suggest_provider.h" 5 #include "components/omnibox/browser/zero_suggest_provider.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 216 }
217 217
218 void ZeroSuggestProviderTest::OnProviderUpdate(bool updated_matches) { 218 void ZeroSuggestProviderTest::OnProviderUpdate(bool updated_matches) {
219 } 219 }
220 220
221 void ZeroSuggestProviderTest::ResetFieldTrialList() { 221 void ZeroSuggestProviderTest::ResetFieldTrialList() {
222 // Destroy the existing FieldTrialList before creating a new one to avoid 222 // Destroy the existing FieldTrialList before creating a new one to avoid
223 // a DCHECK. 223 // a DCHECK.
224 field_trial_list_.reset(); 224 field_trial_list_.reset();
225 field_trial_list_.reset(new base::FieldTrialList( 225 field_trial_list_.reset(new base::FieldTrialList(
226 new metrics::SHA1EntropyProvider("foo"))); 226 base::MakeUnique<metrics::SHA1EntropyProvider>("foo")));
227 variations::testing::ClearAllVariationParams(); 227 variations::testing::ClearAllVariationParams();
228 } 228 }
229 229
230 void ZeroSuggestProviderTest::CreatePersonalizedFieldTrial() { 230 void ZeroSuggestProviderTest::CreatePersonalizedFieldTrial() {
231 std::map<std::string, std::string> params; 231 std::map<std::string, std::string> params;
232 params[std::string(OmniboxFieldTrial::kZeroSuggestRule)] = "true"; 232 params[std::string(OmniboxFieldTrial::kZeroSuggestRule)] = "true";
233 params[std::string(OmniboxFieldTrial::kZeroSuggestVariantRule)] = 233 params[std::string(OmniboxFieldTrial::kZeroSuggestVariantRule)] =
234 "Personalized"; 234 "Personalized";
235 variations::AssociateVariationParams( 235 variations::AssociateVariationParams(
236 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params); 236 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 base::RunLoop().RunUntilIdle(); 454 base::RunLoop().RunUntilIdle();
455 455
456 // Expect that the matches have been cleared. 456 // Expect that the matches have been cleared.
457 ASSERT_TRUE(provider_->matches().empty()); 457 ASSERT_TRUE(provider_->matches().empty());
458 458
459 // Expect the new results have been stored. 459 // Expect the new results have been stored.
460 EXPECT_EQ(empty_response, 460 EXPECT_EQ(empty_response,
461 prefs->GetString(omnibox::kZeroSuggestCachedResults)); 461 prefs->GetString(omnibox::kZeroSuggestCachedResults));
462 } 462 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698