| 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 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/history/in_memory_url_index.h" | 29 #include "chrome/browser/history/in_memory_url_index.h" |
| 30 #include "chrome/browser/history/url_database.h" | 30 #include "chrome/browser/history/url_database.h" |
| 31 #include "chrome/browser/history/url_index_private_data.h" | 31 #include "chrome/browser/history/url_index_private_data.h" |
| 32 #include "chrome/browser/search_engines/template_url.h" | 32 #include "chrome/browser/search_engines/template_url.h" |
| 33 #include "chrome/browser/search_engines/template_url_service.h" | 33 #include "chrome/browser/search_engines/template_url_service.h" |
| 34 #include "chrome/browser/search_engines/template_url_service_factory.h" | 34 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 35 #include "chrome/common/pref_names.h" | 35 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/test/base/testing_browser_process.h" | 36 #include "chrome/test/base/testing_browser_process.h" |
| 37 #include "chrome/test/base/testing_profile.h" | 37 #include "chrome/test/base/testing_profile.h" |
| 38 #include "components/bookmarks/test/bookmark_test_helpers.h" | 38 #include "components/bookmarks/test/bookmark_test_helpers.h" |
| 39 #include "components/metrics/proto/omnibox_event.pb.h" |
| 39 #include "content/public/browser/notification_service.h" | 40 #include "content/public/browser/notification_service.h" |
| 40 #include "content/public/test/test_browser_thread.h" | 41 #include "content/public/test/test_browser_thread.h" |
| 41 #include "content/public/test/test_utils.h" | 42 #include "content/public/test/test_utils.h" |
| 42 #include "sql/transaction.h" | 43 #include "sql/transaction.h" |
| 43 #include "testing/gtest/include/gtest/gtest.h" | 44 #include "testing/gtest/include/gtest/gtest.h" |
| 44 | 45 |
| 45 using base::ASCIIToUTF16; | 46 using base::ASCIIToUTF16; |
| 46 using base::Time; | 47 using base::Time; |
| 47 using base::TimeDelta; | 48 using base::TimeDelta; |
| 48 | 49 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 256 |
| 256 void HistoryQuickProviderTest::RunTest(const base::string16 text, | 257 void HistoryQuickProviderTest::RunTest(const base::string16 text, |
| 257 bool prevent_inline_autocomplete, | 258 bool prevent_inline_autocomplete, |
| 258 std::vector<std::string> expected_urls, | 259 std::vector<std::string> expected_urls, |
| 259 bool can_inline_top_result, | 260 bool can_inline_top_result, |
| 260 base::string16 expected_fill_into_edit, | 261 base::string16 expected_fill_into_edit, |
| 261 base::string16 expected_autocompletion) { | 262 base::string16 expected_autocompletion) { |
| 262 SCOPED_TRACE(text); // Minimal hint to query being run. | 263 SCOPED_TRACE(text); // Minimal hint to query being run. |
| 263 base::MessageLoop::current()->RunUntilIdle(); | 264 base::MessageLoop::current()->RunUntilIdle(); |
| 264 AutocompleteInput input(text, base::string16::npos, base::string16(), | 265 AutocompleteInput input(text, base::string16::npos, base::string16(), |
| 265 GURL(), AutocompleteInput::INVALID_SPEC, | 266 GURL(), metrics::OmniboxEventProto::INVALID_SPEC, |
| 266 prevent_inline_autocomplete, false, true, true); | 267 prevent_inline_autocomplete, false, true, true); |
| 267 provider_->Start(input, false); | 268 provider_->Start(input, false); |
| 268 EXPECT_TRUE(provider_->done()); | 269 EXPECT_TRUE(provider_->done()); |
| 269 | 270 |
| 270 ac_matches_ = provider_->matches(); | 271 ac_matches_ = provider_->matches(); |
| 271 | 272 |
| 272 // We should have gotten back at most AutocompleteProvider::kMaxMatches. | 273 // We should have gotten back at most AutocompleteProvider::kMaxMatches. |
| 273 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); | 274 EXPECT_LE(ac_matches_.size(), AutocompleteProvider::kMaxMatches); |
| 274 | 275 |
| 275 // If the number of expected and actual matches aren't equal then we need | 276 // If the number of expected and actual matches aren't equal then we need |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 | 731 |
| 731 TEST_F(HQPOrderingTest, TEAMatch) { | 732 TEST_F(HQPOrderingTest, TEAMatch) { |
| 732 std::vector<std::string> expected_urls; | 733 std::vector<std::string> expected_urls; |
| 733 expected_urls.push_back("http://www.teamliquid.net/"); | 734 expected_urls.push_back("http://www.teamliquid.net/"); |
| 734 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 735 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
| 735 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 736 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
| 736 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 737 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
| 737 ASCIIToUTF16("www.teamliquid.net"), | 738 ASCIIToUTF16("www.teamliquid.net"), |
| 738 ASCIIToUTF16("mliquid.net")); | 739 ASCIIToUTF16("mliquid.net")); |
| 739 } | 740 } |
| OLD | NEW |