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

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

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/history_url_provider.h" 5 #include "chrome/browser/autocomplete/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 168
169 // AutocompleteProviderListener: 169 // AutocompleteProviderListener:
170 void OnProviderUpdate(bool updated_matches) override; 170 void OnProviderUpdate(bool updated_matches) override;
171 171
172 protected: 172 protected:
173 static KeyedService* CreateTemplateURLService( 173 static KeyedService* CreateTemplateURLService(
174 content::BrowserContext* context) { 174 content::BrowserContext* context) {
175 Profile* profile = static_cast<Profile*>(context); 175 Profile* profile = static_cast<Profile*>(context);
176 return new TemplateURLService( 176 return new TemplateURLService(
177 profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, 177 profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL,
178 scoped_ptr<TemplateURLServiceClient>( 178 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient(
179 new ChromeTemplateURLServiceClient( 179 HistoryServiceFactory::GetForProfile(
180 HistoryServiceFactory::GetForProfile( 180 profile, ServiceAccessType::EXPLICIT_ACCESS))),
181 profile, Profile::EXPLICIT_ACCESS))),
182 NULL, NULL, base::Closure()); 181 NULL, NULL, base::Closure());
183 } 182 }
184 183
185 // testing::Test 184 // testing::Test
186 void SetUp() override { 185 void SetUp() override {
187 ASSERT_TRUE(SetUpImpl(false)); 186 ASSERT_TRUE(SetUpImpl(false));
188 } 187 }
189 void TearDown() override; 188 void TearDown() override;
190 189
191 // Does the real setup. 190 // Does the real setup.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 bool HistoryURLProviderTest::SetUpImpl(bool no_db) { 251 bool HistoryURLProviderTest::SetUpImpl(bool no_db) {
253 profile_.reset(new TestingProfile()); 252 profile_.reset(new TestingProfile());
254 if (!(profile_->CreateHistoryService(true, no_db))) 253 if (!(profile_->CreateHistoryService(true, no_db)))
255 return false; 254 return false;
256 if (!no_db) { 255 if (!no_db) {
257 profile_->BlockUntilHistoryProcessesPendingRequests(); 256 profile_->BlockUntilHistoryProcessesPendingRequests();
258 profile_->BlockUntilHistoryIndexIsRefreshed(); 257 profile_->BlockUntilHistoryIndexIsRefreshed();
259 } 258 }
260 profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en-US,en,ko"); 259 profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en-US,en,ko");
261 history_service_ = HistoryServiceFactory::GetForProfile( 260 history_service_ = HistoryServiceFactory::GetForProfile(
262 profile_.get(), Profile::EXPLICIT_ACCESS); 261 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS);
263 262
264 autocomplete_ = new HistoryURLProvider(this, profile_.get()); 263 autocomplete_ = new HistoryURLProvider(this, profile_.get());
265 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 264 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
266 profile_.get(), &HistoryURLProviderTest::CreateTemplateURLService); 265 profile_.get(), &HistoryURLProviderTest::CreateTemplateURLService);
267 FillData(); 266 FillData();
268 return true; 267 return true;
269 } 268 }
270 269
271 void HistoryURLProviderTest::TearDown() { 270 void HistoryURLProviderTest::TearDown() {
272 autocomplete_ = NULL; 271 autocomplete_ = NULL;
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 // Test the experiment (scoring enabled). 1021 // Test the experiment (scoring enabled).
1023 autocomplete_->scoring_params_.experimental_scoring_enabled = true; 1022 autocomplete_->scoring_params_.experimental_scoring_enabled = true;
1024 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), 1023 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input),
1025 std::string(), false, output, max_matches)); 1024 std::string(), false, output, max_matches));
1026 for (int j = 0; j < max_matches; ++j) { 1025 for (int j = 0; j < max_matches; ++j) {
1027 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, 1026 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance,
1028 matches_[j].relevance); 1027 matches_[j].relevance);
1029 } 1028 }
1030 } 1029 }
1031 } 1030 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | chrome/browser/autocomplete/search_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698