OLD | NEW |
---|---|
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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | |
15 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 16 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
16 #include "chrome/browser/autocomplete/history_quick_provider.h" | 17 #include "chrome/browser/autocomplete/history_quick_provider.h" |
17 #include "chrome/browser/history/history_service_factory.h" | 18 #include "chrome/browser/history/history_service_factory.h" |
18 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" | 19 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" |
19 #include "chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "chrome/browser/search_engines/template_url_service_factory.h" |
20 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
21 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
22 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
23 #include "components/history/core/browser/history_service.h" | 24 #include "components/history/core/browser/history_service.h" |
24 #include "components/history/core/browser/url_database.h" | 25 #include "components/history/core/browser/url_database.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 if (!(profile_->CreateHistoryService(true, no_db))) | 255 if (!(profile_->CreateHistoryService(true, no_db))) |
255 return false; | 256 return false; |
256 if (!no_db) { | 257 if (!no_db) { |
257 profile_->BlockUntilHistoryProcessesPendingRequests(); | 258 profile_->BlockUntilHistoryProcessesPendingRequests(); |
258 profile_->BlockUntilHistoryIndexIsRefreshed(); | 259 profile_->BlockUntilHistoryIndexIsRefreshed(); |
259 } | 260 } |
260 profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en-US,en,ko"); | 261 profile_->GetPrefs()->SetString(prefs::kAcceptLanguages, "en-US,en,ko"); |
261 history_service_ = HistoryServiceFactory::GetForProfile( | 262 history_service_ = HistoryServiceFactory::GetForProfile( |
262 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); | 263 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); |
263 | 264 |
264 autocomplete_ = new HistoryURLProvider(this, profile_.get()); | 265 autocomplete_ = new HistoryURLProvider( |
266 scoped_ptr<AutocompleteProviderClient>( | |
267 new ChromeAutocompleteProviderClient(profile_.get())), | |
Peter Kasting
2015/06/12 16:20:23
...as does this change
blundell
2015/06/15 08:51:33
Obsolete now.
| |
268 | |
269 this, profile_.get()); | |
265 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 270 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
266 profile_.get(), &HistoryURLProviderTest::CreateTemplateURLService); | 271 profile_.get(), &HistoryURLProviderTest::CreateTemplateURLService); |
267 FillData(); | 272 FillData(); |
268 return true; | 273 return true; |
269 } | 274 } |
270 | 275 |
271 void HistoryURLProviderTest::TearDown() { | 276 void HistoryURLProviderTest::TearDown() { |
272 autocomplete_ = NULL; | 277 autocomplete_ = NULL; |
273 } | 278 } |
274 | 279 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1060 // Test the experiment (scoring enabled). | 1065 // Test the experiment (scoring enabled). |
1061 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1066 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
1062 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), | 1067 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), |
1063 std::string(), false, output, max_matches)); | 1068 std::string(), false, output, max_matches)); |
1064 for (int j = 0; j < max_matches; ++j) { | 1069 for (int j = 0; j < max_matches; ++j) { |
1065 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1070 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
1066 matches_[j].relevance); | 1071 matches_[j].relevance); |
1067 } | 1072 } |
1068 } | 1073 } |
1069 } | 1074 } |
OLD | NEW |