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> |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 EXPECT_EQ(1U, matches_.erase(expected)) | 206 EXPECT_EQ(1U, matches_.erase(expected)) |
207 << "Results did not contain '" << expected << "' but should have."; | 207 << "Results did not contain '" << expected << "' but should have."; |
208 } | 208 } |
209 | 209 |
210 | 210 |
211 void HistoryQuickProviderTest::RunTest(const string16 text, | 211 void HistoryQuickProviderTest::RunTest(const string16 text, |
212 std::vector<std::string> expected_urls, | 212 std::vector<std::string> expected_urls, |
213 bool can_inline_top_result, | 213 bool can_inline_top_result, |
214 string16 expected_fill_into_edit) { | 214 string16 expected_fill_into_edit) { |
215 SCOPED_TRACE(text); // Minimal hint to query being run. | 215 SCOPED_TRACE(text); // Minimal hint to query being run. |
216 MessageLoop::current()->RunAllPending(); | 216 MessageLoop::current()->RunUntilIdle(); |
217 AutocompleteInput input(text, string16(), false, false, true, | 217 AutocompleteInput input(text, string16(), false, false, true, |
218 AutocompleteInput::ALL_MATCHES); | 218 AutocompleteInput::ALL_MATCHES); |
219 provider_->Start(input, false); | 219 provider_->Start(input, false); |
220 EXPECT_TRUE(provider_->done()); | 220 EXPECT_TRUE(provider_->done()); |
221 | 221 |
222 ac_matches_ = provider_->matches(); | 222 ac_matches_ = provider_->matches(); |
223 | 223 |
224 // We should have gotten back at most AutocompleteProvider::kMaxMatches. | 224 // We should have gotten back at most AutocompleteProvider::kMaxMatches. |
225 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); | 225 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); |
226 | 226 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } | 563 } |
564 | 564 |
565 TEST_F(HQPOrderingTest, TEAMatch) { | 565 TEST_F(HQPOrderingTest, TEAMatch) { |
566 std::vector<std::string> expected_urls; | 566 std::vector<std::string> expected_urls; |
567 expected_urls.push_back("http://www.teamliquid.net/"); | 567 expected_urls.push_back("http://www.teamliquid.net/"); |
568 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 568 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
569 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 569 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
570 RunTest(ASCIIToUTF16("tea"), expected_urls, true, | 570 RunTest(ASCIIToUTF16("tea"), expected_urls, true, |
571 ASCIIToUTF16("www.teamliquid.net")); | 571 ASCIIToUTF16("www.teamliquid.net")); |
572 } | 572 } |
OLD | NEW |