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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1121 term_match.contents_class[1].style); | 1121 term_match.contents_class[1].style); |
1122 } | 1122 } |
1123 | 1123 |
1124 // Verifies AutocompleteControllers return results (including keyword | 1124 // Verifies AutocompleteControllers return results (including keyword |
1125 // results) in the right order and set descriptions for them correctly. | 1125 // results) in the right order and set descriptions for them correctly. |
1126 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { | 1126 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { |
1127 // Add an entry that corresponds to a keyword search with 'term2'. | 1127 // Add an entry that corresponds to a keyword search with 'term2'. |
1128 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); | 1128 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); |
1129 profile_.BlockUntilHistoryProcessesPendingRequests(); | 1129 profile_.BlockUntilHistoryProcessesPendingRequests(); |
1130 | 1130 |
1131 AutocompleteController controller(&profile_, | 1131 AutocompleteController controller( |
1132 TemplateURLServiceFactory::GetForProfile(&profile_), | 1132 make_scoped_ptr(new ChromeAutocompleteProviderClient(&profile_)), NULL, |
Peter Kasting
2015/06/19 19:19:21
Nit: While here: nullptr
blundell
2015/06/22 09:01:36
Done.
| |
1133 NULL, AutocompleteProvider::TYPE_SEARCH); | 1133 AutocompleteProvider::TYPE_SEARCH); |
1134 controller.Start(AutocompleteInput( | 1134 controller.Start(AutocompleteInput( |
1135 ASCIIToUTF16("k t"), base::string16::npos, std::string(), GURL(), | 1135 ASCIIToUTF16("k t"), base::string16::npos, std::string(), GURL(), |
1136 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, | 1136 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, |
1137 ChromeAutocompleteSchemeClassifier(&profile_))); | 1137 ChromeAutocompleteSchemeClassifier(&profile_))); |
1138 const AutocompleteResult& result = controller.result(); | 1138 const AutocompleteResult& result = controller.result(); |
1139 | 1139 |
1140 // There should be three matches, one for the keyword history, one for | 1140 // There should be three matches, one for the keyword history, one for |
1141 // keyword provider's what-you-typed, and one for the default provider's | 1141 // keyword provider's what-you-typed, and one for the default provider's |
1142 // what you typed, in that order. | 1142 // what you typed, in that order. |
1143 ASSERT_EQ(3u, result.size()); | 1143 ASSERT_EQ(3u, result.size()); |
(...skipping 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3600 } | 3600 } |
3601 | 3601 |
3602 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { | 3602 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { |
3603 AutocompleteInput input( | 3603 AutocompleteInput input( |
3604 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), | 3604 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), |
3605 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, | 3605 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, |
3606 ChromeAutocompleteSchemeClassifier(&profile_)); | 3606 ChromeAutocompleteSchemeClassifier(&profile_)); |
3607 provider_->Start(input, false); | 3607 provider_->Start(input, false); |
3608 EXPECT_TRUE(provider_->matches().empty()); | 3608 EXPECT_TRUE(provider_->matches().empty()); |
3609 } | 3609 } |
OLD | NEW |