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

Side by Side Diff: chrome/browser/autocomplete/zero_suggest_provider_unittest.cc

Issue 421663003: Move variations component code to variations namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix Created 6 years, 5 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 | Annotate | Revision Log
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 "chrome/browser/autocomplete/zero_suggest_provider.h" 5 #include "chrome/browser/autocomplete/zero_suggest_provider.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 void ZeroSuggestProviderTest::OnProviderUpdate(bool updated_matches) { 97 void ZeroSuggestProviderTest::OnProviderUpdate(bool updated_matches) {
98 } 98 }
99 99
100 void ZeroSuggestProviderTest::ResetFieldTrialList() { 100 void ZeroSuggestProviderTest::ResetFieldTrialList() {
101 // Destroy the existing FieldTrialList before creating a new one to avoid 101 // Destroy the existing FieldTrialList before creating a new one to avoid
102 // a DCHECK. 102 // a DCHECK.
103 field_trial_list_.reset(); 103 field_trial_list_.reset();
104 field_trial_list_.reset(new base::FieldTrialList( 104 field_trial_list_.reset(new base::FieldTrialList(
105 new metrics::SHA1EntropyProvider("foo"))); 105 new metrics::SHA1EntropyProvider("foo")));
106 chrome_variations::testing::ClearAllVariationParams(); 106 variations::testing::ClearAllVariationParams();
107 } 107 }
108 108
109 void ZeroSuggestProviderTest::CreatePersonalizedFieldTrial() { 109 void ZeroSuggestProviderTest::CreatePersonalizedFieldTrial() {
110 std::map<std::string, std::string> params; 110 std::map<std::string, std::string> params;
111 params[std::string(OmniboxFieldTrial::kZeroSuggestRule)] = "true"; 111 params[std::string(OmniboxFieldTrial::kZeroSuggestRule)] = "true";
112 params[std::string(OmniboxFieldTrial::kZeroSuggestVariantRule)] = 112 params[std::string(OmniboxFieldTrial::kZeroSuggestVariantRule)] =
113 "Personalized"; 113 "Personalized";
114 chrome_variations::AssociateVariationParams( 114 variations::AssociateVariationParams(
115 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params); 115 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params);
116 base::FieldTrialList::CreateFieldTrial( 116 base::FieldTrialList::CreateFieldTrial(
117 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A"); 117 OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
118 } 118 }
119 119
120 TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestCachingFirstRun) { 120 TEST_F(ZeroSuggestProviderTest, TestPsuggestZeroSuggestCachingFirstRun) {
121 CreatePersonalizedFieldTrial(); 121 CreatePersonalizedFieldTrial();
122 122
123 // Ensure the cache is empty. 123 // Ensure the cache is empty.
124 PrefService* prefs = profile_.GetPrefs(); 124 PrefService* prefs = profile_.GetPrefs();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 base::RunLoop().RunUntilIdle(); 233 base::RunLoop().RunUntilIdle();
234 234
235 // Expect that the matches have been cleared. 235 // Expect that the matches have been cleared.
236 ASSERT_TRUE(provider_->matches().empty()); 236 ASSERT_TRUE(provider_->matches().empty());
237 237
238 // Expect the new results have been stored. 238 // Expect the new results have been stored.
239 EXPECT_EQ(empty_response, 239 EXPECT_EQ(empty_response,
240 prefs->GetString(prefs::kZeroSuggestCachedResults)); 240 prefs->GetString(prefs::kZeroSuggestCachedResults));
241 } 241 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider_unittest.cc ('k') | chrome/browser/bookmarks/enhanced_bookmarks_features.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698