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_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | |
19 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 20 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
20 #include "chrome/browser/autocomplete/history_url_provider.h" | 21 #include "chrome/browser/autocomplete/history_url_provider.h" |
21 #include "chrome/browser/autocomplete/in_memory_url_index.h" | 22 #include "chrome/browser/autocomplete/in_memory_url_index.h" |
22 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" | 23 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" |
23 #include "chrome/browser/autocomplete/url_index_private_data.h" | 24 #include "chrome/browser/autocomplete/url_index_private_data.h" |
24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
25 #include "chrome/browser/history/history_service_factory.h" | 26 #include "chrome/browser/history/history_service_factory.h" |
26 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" | 27 #include "chrome/browser/search_engines/chrome_template_url_service_client.h" |
27 #include "chrome/browser/search_engines/template_url_service_factory.h" | 28 #include "chrome/browser/search_engines/template_url_service_factory.h" |
28 #include "chrome/test/base/testing_browser_process.h" | 29 #include "chrome/test/base/testing_browser_process.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 profile_->CreateBookmarkModel(true); | 230 profile_->CreateBookmarkModel(true); |
230 bookmarks::test::WaitForBookmarkModelToLoad( | 231 bookmarks::test::WaitForBookmarkModelToLoad( |
231 BookmarkModelFactory::GetForProfile(profile_.get())); | 232 BookmarkModelFactory::GetForProfile(profile_.get())); |
232 profile_->BlockUntilHistoryIndexIsRefreshed(); | 233 profile_->BlockUntilHistoryIndexIsRefreshed(); |
233 history_service_ = HistoryServiceFactory::GetForProfile( | 234 history_service_ = HistoryServiceFactory::GetForProfile( |
234 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); | 235 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); |
235 EXPECT_TRUE(history_service_); | 236 EXPECT_TRUE(history_service_); |
236 InMemoryURLIndex* index = | 237 InMemoryURLIndex* index = |
237 InMemoryURLIndexFactory::GetForProfile(profile_.get()); | 238 InMemoryURLIndexFactory::GetForProfile(profile_.get()); |
238 EXPECT_TRUE(index); | 239 EXPECT_TRUE(index); |
239 provider_ = new HistoryQuickProvider(profile_.get(), index); | 240 provider_ = new HistoryQuickProvider( |
241 scoped_ptr<AutocompleteProviderClient>( | |
242 new ChromeAutocompleteProviderClient(profile_.get())), | |
Peter Kasting
2015/06/12 16:20:23
Note that if you move the ChromeAutocompleteProvid
blundell
2015/06/15 08:51:33
Obsolete now.
| |
243 profile_.get(), index); | |
240 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 244 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
241 profile_.get(), &HistoryQuickProviderTest::CreateTemplateURLService); | 245 profile_.get(), &HistoryQuickProviderTest::CreateTemplateURLService); |
242 FillData(); | 246 FillData(); |
243 index->RebuildFromHistory(history_backend()->db()); | 247 index->RebuildFromHistory(history_backend()->db()); |
244 } | 248 } |
245 | 249 |
246 void HistoryQuickProviderTest::TearDown() { | 250 void HistoryQuickProviderTest::TearDown() { |
247 provider_ = NULL; | 251 provider_ = NULL; |
248 } | 252 } |
249 | 253 |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
829 | 833 |
830 TEST_F(HQPOrderingTest, TEAMatch) { | 834 TEST_F(HQPOrderingTest, TEAMatch) { |
831 std::vector<std::string> expected_urls; | 835 std::vector<std::string> expected_urls; |
832 expected_urls.push_back("http://www.teamliquid.net/"); | 836 expected_urls.push_back("http://www.teamliquid.net/"); |
833 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 837 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
834 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 838 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
835 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 839 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
836 ASCIIToUTF16("www.teamliquid.net"), | 840 ASCIIToUTF16("www.teamliquid.net"), |
837 ASCIIToUTF16("mliquid.net")); | 841 ASCIIToUTF16("mliquid.net")); |
838 } | 842 } |
OLD | NEW |