| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 << "Results did not contain '" << expected << "' but should have."; | 208 << "Results did not contain '" << expected << "' but should have."; |
| 209 } | 209 } |
| 210 | 210 |
| 211 | 211 |
| 212 void HistoryQuickProviderTest::RunTest(const string16 text, | 212 void HistoryQuickProviderTest::RunTest(const string16 text, |
| 213 std::vector<std::string> expected_urls, | 213 std::vector<std::string> expected_urls, |
| 214 bool can_inline_top_result, | 214 bool can_inline_top_result, |
| 215 string16 expected_fill_into_edit) { | 215 string16 expected_fill_into_edit) { |
| 216 SCOPED_TRACE(text); // Minimal hint to query being run. | 216 SCOPED_TRACE(text); // Minimal hint to query being run. |
| 217 MessageLoop::current()->RunUntilIdle(); | 217 MessageLoop::current()->RunUntilIdle(); |
| 218 AutocompleteInput input(text, string16(), false, false, true, | 218 AutocompleteInput input(text, string16::npos, string16(), false, false, true, |
| 219 AutocompleteInput::ALL_MATCHES); | 219 AutocompleteInput::ALL_MATCHES); |
| 220 provider_->Start(input, false); | 220 provider_->Start(input, false); |
| 221 EXPECT_TRUE(provider_->done()); | 221 EXPECT_TRUE(provider_->done()); |
| 222 | 222 |
| 223 ac_matches_ = provider_->matches(); | 223 ac_matches_ = provider_->matches(); |
| 224 | 224 |
| 225 // We should have gotten back at most AutocompleteProvider::kMaxMatches. | 225 // We should have gotten back at most AutocompleteProvider::kMaxMatches. |
| 226 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); | 226 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); |
| 227 | 227 |
| 228 // If the number of expected and actual matches aren't equal then we need | 228 // If the number of expected and actual matches aren't equal then we need |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 } | 574 } |
| 575 | 575 |
| 576 TEST_F(HQPOrderingTest, TEAMatch) { | 576 TEST_F(HQPOrderingTest, TEAMatch) { |
| 577 std::vector<std::string> expected_urls; | 577 std::vector<std::string> expected_urls; |
| 578 expected_urls.push_back("http://www.teamliquid.net/"); | 578 expected_urls.push_back("http://www.teamliquid.net/"); |
| 579 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 579 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
| 580 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 580 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
| 581 RunTest(ASCIIToUTF16("tea"), expected_urls, true, | 581 RunTest(ASCIIToUTF16("tea"), expected_urls, true, |
| 582 ASCIIToUTF16("www.teamliquid.net")); | 582 ASCIIToUTF16("www.teamliquid.net")); |
| 583 } | 583 } |
| OLD | NEW |