OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/search_provider.h" | 5 #include "components/omnibox/search_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 term_match.contents_class[1].style); | 1117 term_match.contents_class[1].style); |
1118 } | 1118 } |
1119 | 1119 |
1120 // Verifies AutocompleteControllers return results (including keyword | 1120 // Verifies AutocompleteControllers return results (including keyword |
1121 // results) in the right order and set descriptions for them correctly. | 1121 // results) in the right order and set descriptions for them correctly. |
1122 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { | 1122 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { |
1123 // Add an entry that corresponds to a keyword search with 'term2'. | 1123 // Add an entry that corresponds to a keyword search with 'term2'. |
1124 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); | 1124 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); |
1125 profile_.BlockUntilHistoryProcessesPendingRequests(); | 1125 profile_.BlockUntilHistoryProcessesPendingRequests(); |
1126 | 1126 |
1127 AutocompleteController controller(&profile_, | 1127 AutocompleteController controller( |
1128 TemplateURLServiceFactory::GetForProfile(&profile_), | 1128 make_scoped_ptr(new ChromeAutocompleteProviderClient(&profile_)), nullptr, |
1129 NULL, AutocompleteProvider::TYPE_SEARCH); | 1129 AutocompleteProvider::TYPE_SEARCH); |
1130 controller.Start(AutocompleteInput( | 1130 controller.Start(AutocompleteInput( |
1131 ASCIIToUTF16("k t"), base::string16::npos, std::string(), GURL(), | 1131 ASCIIToUTF16("k t"), base::string16::npos, std::string(), GURL(), |
1132 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, | 1132 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, |
1133 ChromeAutocompleteSchemeClassifier(&profile_))); | 1133 ChromeAutocompleteSchemeClassifier(&profile_))); |
1134 const AutocompleteResult& result = controller.result(); | 1134 const AutocompleteResult& result = controller.result(); |
1135 | 1135 |
1136 // There should be three matches, one for the keyword history, one for | 1136 // There should be three matches, one for the keyword history, one for |
1137 // keyword provider's what-you-typed, and one for the default provider's | 1137 // keyword provider's what-you-typed, and one for the default provider's |
1138 // what you typed, in that order. | 1138 // what you typed, in that order. |
1139 ASSERT_EQ(3u, result.size()); | 1139 ASSERT_EQ(3u, result.size()); |
(...skipping 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3596 } | 3596 } |
3597 | 3597 |
3598 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { | 3598 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { |
3599 AutocompleteInput input( | 3599 AutocompleteInput input( |
3600 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), | 3600 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), |
3601 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, | 3601 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, |
3602 ChromeAutocompleteSchemeClassifier(&profile_)); | 3602 ChromeAutocompleteSchemeClassifier(&profile_)); |
3603 provider_->Start(input, false); | 3603 provider_->Start(input, false); |
3604 EXPECT_TRUE(provider_->matches().empty()); | 3604 EXPECT_TRUE(provider_->matches().empty()); |
3605 } | 3605 } |
OLD | NEW |