| 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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 AutocompleteMatch wyt_match; | 1103 AutocompleteMatch wyt_match; |
| 1104 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("f"), | 1104 ASSERT_NO_FATAL_FAILURE(QueryForInputAndSetWYTMatch(ASCIIToUTF16("f"), |
| 1105 &wyt_match)); | 1105 &wyt_match)); |
| 1106 ASSERT_EQ(2u, provider_->matches().size()); | 1106 ASSERT_EQ(2u, provider_->matches().size()); |
| 1107 AutocompleteMatch term_match; | 1107 AutocompleteMatch term_match; |
| 1108 EXPECT_TRUE(FindMatchWithDestination(term_url, &term_match)); | 1108 EXPECT_TRUE(FindMatchWithDestination(term_url, &term_match)); |
| 1109 EXPECT_GT(term_match.relevance, wyt_match.relevance); | 1109 EXPECT_GT(term_match.relevance, wyt_match.relevance); |
| 1110 EXPECT_EQ(ASCIIToUTF16("FOO"), term_match.fill_into_edit); | 1110 EXPECT_EQ(ASCIIToUTF16("FOO"), term_match.fill_into_edit); |
| 1111 EXPECT_EQ(ASCIIToUTF16("OO"), term_match.inline_autocompletion); | 1111 EXPECT_EQ(ASCIIToUTF16("OO"), term_match.inline_autocompletion); |
| 1112 EXPECT_TRUE(term_match.allowed_to_be_default_match); | 1112 EXPECT_TRUE(term_match.allowed_to_be_default_match); |
| 1113 // Make sure the case doesn't affect the highlighting. |
| 1114 // (SearchProvider intentionally marks the new text as MATCH; that's why |
| 1115 // the tests below look backwards.) |
| 1116 ASSERT_EQ(2U, term_match.contents_class.size()); |
| 1117 EXPECT_EQ(0U, term_match.contents_class[0].offset); |
| 1118 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::NONE, |
| 1119 term_match.contents_class[0].style); |
| 1120 EXPECT_EQ(1U, term_match.contents_class[1].offset); |
| 1121 EXPECT_EQ(AutocompleteMatch::ACMatchClassification::MATCH, |
| 1122 term_match.contents_class[1].style); |
| 1113 } | 1123 } |
| 1114 | 1124 |
| 1115 // Verifies AutocompleteControllers return results (including keyword | 1125 // Verifies AutocompleteControllers return results (including keyword |
| 1116 // results) in the right order and set descriptions for them correctly. | 1126 // results) in the right order and set descriptions for them correctly. |
| 1117 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { | 1127 TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) { |
| 1118 // Add an entry that corresponds to a keyword search with 'term2'. | 1128 // Add an entry that corresponds to a keyword search with 'term2'. |
| 1119 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); | 1129 AddSearchToHistory(keyword_t_url_, ASCIIToUTF16("term2"), 1); |
| 1120 profile_.BlockUntilHistoryProcessesPendingRequests(); | 1130 profile_.BlockUntilHistoryProcessesPendingRequests(); |
| 1121 | 1131 |
| 1122 AutocompleteController controller(&profile_, | 1132 AutocompleteController controller(&profile_, |
| (...skipping 2469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3592 | 3602 |
| 3593 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { | 3603 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { |
| 3594 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos, | 3604 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos, |
| 3595 std::string(), GURL(), | 3605 std::string(), GURL(), |
| 3596 metrics::OmniboxEventProto::INVALID_SPEC, false, | 3606 metrics::OmniboxEventProto::INVALID_SPEC, false, |
| 3597 true, true, true, | 3607 true, true, true, |
| 3598 ChromeAutocompleteSchemeClassifier(&profile_)); | 3608 ChromeAutocompleteSchemeClassifier(&profile_)); |
| 3599 provider_->Start(input, false, true); | 3609 provider_->Start(input, false, true); |
| 3600 EXPECT_TRUE(provider_->matches().empty()); | 3610 EXPECT_TRUE(provider_->matches().empty()); |
| 3601 } | 3611 } |
| OLD | NEW |