| 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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 } | 201 } |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 void HistoryURLProviderTest::OnProviderUpdate(bool updated_matches) { | 204 void HistoryURLProviderTest::OnProviderUpdate(bool updated_matches) { |
| 205 if (autocomplete_->done()) | 205 if (autocomplete_->done()) |
| 206 base::MessageLoop::current()->Quit(); | 206 base::MessageLoop::current()->Quit(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void HistoryURLProviderTest::SetUpImpl(bool no_db) { | 209 void HistoryURLProviderTest::SetUpImpl(bool no_db) { |
| 210 profile_.reset(new TestingProfile()); | 210 profile_.reset(new TestingProfile()); |
| 211 profile_->CreateHistoryService(true, no_db); | 211 ASSERT_TRUE(profile_->CreateHistoryService(true, no_db)); |
| 212 if (!no_db) { | 212 if (!no_db) { |
| 213 profile_->BlockUntilHistoryProcessesPendingRequests(); | 213 profile_->BlockUntilHistoryProcessesPendingRequests(); |
| 214 profile_->BlockUntilHistoryIndexIsRefreshed(); | 214 profile_->BlockUntilHistoryIndexIsRefreshed(); |
| 215 } | 215 } |
| 216 history_service_ = | 216 history_service_ = |
| 217 HistoryServiceFactory::GetForProfile(profile_.get(), | 217 HistoryServiceFactory::GetForProfile(profile_.get(), |
| 218 Profile::EXPLICIT_ACCESS); | 218 Profile::EXPLICIT_ACCESS); |
| 219 | 219 |
| 220 autocomplete_ = new HistoryURLProvider(this, profile_.get(), "en-US,en,ko"); | 220 autocomplete_ = new HistoryURLProvider(this, profile_.get(), "en-US,en,ko"); |
| 221 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 221 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 EXPECT_EQ(test_cases[i].offsets[match_index], | 863 EXPECT_EQ(test_cases[i].offsets[match_index], |
| 864 match.contents_class[match_index].offset); | 864 match.contents_class[match_index].offset); |
| 865 EXPECT_EQ(ACMatchClassification::URL | | 865 EXPECT_EQ(ACMatchClassification::URL | |
| 866 (match_index == test_cases[i].match_classification_index ? | 866 (match_index == test_cases[i].match_classification_index ? |
| 867 ACMatchClassification::MATCH : 0), | 867 ACMatchClassification::MATCH : 0), |
| 868 match.contents_class[match_index].style); | 868 match.contents_class[match_index].style); |
| 869 } | 869 } |
| 870 EXPECT_EQ(npos, test_cases[i].offsets[match.contents_class.size()]); | 870 EXPECT_EQ(npos, test_cases[i].offsets[match.contents_class.size()]); |
| 871 } | 871 } |
| 872 } | 872 } |
| OLD | NEW |