| 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 "components/omnibox/history_quick_provider.h" | 5 #include "components/omnibox/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> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 profile_.reset(new TestingProfile()); | 229 profile_.reset(new TestingProfile()); |
| 230 client_.reset(new ChromeAutocompleteProviderClient(profile_.get())); | 230 client_.reset(new ChromeAutocompleteProviderClient(profile_.get())); |
| 231 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); | 231 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); |
| 232 profile_->CreateBookmarkModel(true); | 232 profile_->CreateBookmarkModel(true); |
| 233 bookmarks::test::WaitForBookmarkModelToLoad( | 233 bookmarks::test::WaitForBookmarkModelToLoad( |
| 234 BookmarkModelFactory::GetForProfile(profile_.get())); | 234 BookmarkModelFactory::GetForProfile(profile_.get())); |
| 235 profile_->BlockUntilHistoryIndexIsRefreshed(); | 235 profile_->BlockUntilHistoryIndexIsRefreshed(); |
| 236 history_service_ = HistoryServiceFactory::GetForProfile( | 236 history_service_ = HistoryServiceFactory::GetForProfile( |
| 237 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); | 237 profile_.get(), ServiceAccessType::EXPLICIT_ACCESS); |
| 238 EXPECT_TRUE(history_service_); | 238 EXPECT_TRUE(history_service_); |
| 239 provider_ = new HistoryQuickProvider(client_.get()); |
| 240 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 241 profile_.get(), &HistoryQuickProviderTest::CreateTemplateURLService); |
| 242 FillData(); |
| 239 InMemoryURLIndex* index = | 243 InMemoryURLIndex* index = |
| 240 InMemoryURLIndexFactory::GetForProfile(profile_.get()); | 244 InMemoryURLIndexFactory::GetForProfile(profile_.get()); |
| 241 EXPECT_TRUE(index); | 245 EXPECT_TRUE(index); |
| 242 provider_ = new HistoryQuickProvider(client_.get(), index); | |
| 243 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | |
| 244 profile_.get(), &HistoryQuickProviderTest::CreateTemplateURLService); | |
| 245 FillData(); | |
| 246 index->RebuildFromHistory(history_backend()->db()); | 246 index->RebuildFromHistory(history_backend()->db()); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void HistoryQuickProviderTest::TearDown() { | 249 void HistoryQuickProviderTest::TearDown() { |
| 250 provider_ = NULL; | 250 provider_ = NULL; |
| 251 } | 251 } |
| 252 | 252 |
| 253 void HistoryQuickProviderTest::GetTestData(size_t* data_count, | 253 void HistoryQuickProviderTest::GetTestData(size_t* data_count, |
| 254 TestURLInfo** test_data) { | 254 TestURLInfo** test_data) { |
| 255 DCHECK(data_count); | 255 DCHECK(data_count); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 | 831 |
| 832 TEST_F(HQPOrderingTest, TEAMatch) { | 832 TEST_F(HQPOrderingTest, TEAMatch) { |
| 833 std::vector<std::string> expected_urls; | 833 std::vector<std::string> expected_urls; |
| 834 expected_urls.push_back("http://www.teamliquid.net/"); | 834 expected_urls.push_back("http://www.teamliquid.net/"); |
| 835 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 835 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
| 836 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 836 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
| 837 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 837 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
| 838 ASCIIToUTF16("www.teamliquid.net"), | 838 ASCIIToUTF16("www.teamliquid.net"), |
| 839 ASCIIToUTF16("mliquid.net")); | 839 ASCIIToUTF16("mliquid.net")); |
| 840 } | 840 } |
| OLD | NEW |