Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: chrome/browser/autocomplete/search_provider_unittest.cc

Issue 2045873002: Omnibox: Don't Barf When Suggestion is Mixed-Case Equivalent to Verbatim (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "" -> std::string() Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/omnibox/browser/base_search_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/browser/search_provider.h" 5 #include "components/omnibox/browser/search_provider.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 { { "a", true }, { "ab1", false }, { "ab2", false }, 2202 { { "a", true }, { "ab1", false }, { "ab2", false },
2203 kEmptyExpectedMatch }, 2203 kEmptyExpectedMatch },
2204 { { "ab1", true }, { "ab2", true }, { "ab", true }, 2204 { { "ab1", true }, { "ab2", true }, { "ab", true },
2205 kEmptyExpectedMatch }, 2205 kEmptyExpectedMatch },
2206 "[\"ab\",[\"ab1\", \"ab2\"],[],[]," 2206 "[\"ab\",[\"ab1\", \"ab2\"],[],[],"
2207 "{\"google:verbatimrelevance\":9000," 2207 "{\"google:verbatimrelevance\":9000,"
2208 "\"google:suggestrelevance\":[8000, 7000]}]", 2208 "\"google:suggestrelevance\":[8000, 7000]}]",
2209 { { "ab", true }, { "ab1", true }, { "ab2", false }, 2209 { { "ab", true }, { "ab1", true }, { "ab2", false },
2210 kEmptyExpectedMatch } }, 2210 kEmptyExpectedMatch } },
2211 2211
2212 // If a suggestion is equivalent to the verbatim suggestion, it should be
2213 // collapsed into one. Furthermore, it should be allowed to be the default
2214 // match even if it was not previously displayed inlined. This test is
2215 // mainly for checking the first_async_matches.
2216 { "[\"a\",[\"A\"],[],[],"
2217 "{\"google:verbatimrelevance\":9000, "
2218 "\"google:suggestrelevance\":[9001]}]",
2219 { { "A", true }, kEmptyExpectedMatch, kEmptyExpectedMatch,
2220 kEmptyExpectedMatch },
2221 { { "ab", true }, { "A", false }, kEmptyExpectedMatch,
2222 kEmptyExpectedMatch },
2223 std::string(),
2224 { { "ab", true }, { "A", false }, kEmptyExpectedMatch,
2225 kEmptyExpectedMatch } },
2226
2212 // Note: it's possible that the suggest server returns a suggestion with 2227 // Note: it's possible that the suggest server returns a suggestion with
2213 // an inline autocompletion (that as usual we delay in allowing it to 2228 // an inline autocompletion (that as usual we delay in allowing it to
2214 // be displayed as an inline autocompletion until the next keystroke), 2229 // be displayed as an inline autocompletion until the next keystroke),
2215 // then, in response to the next keystroke, the server returns a different 2230 // then, in response to the next keystroke, the server returns a different
2216 // suggestion as an inline autocompletion. This is not likely to happen. 2231 // suggestion as an inline autocompletion. This is not likely to happen.
2217 // Regardless, if it does, one could imagine three different behaviors: 2232 // Regardless, if it does, one could imagine three different behaviors:
2218 // - keep the original inline autocompletion until the next keystroke 2233 // - keep the original inline autocompletion until the next keystroke
2219 // (i.e., don't abandon an inline autocompletion asynchronously), then 2234 // (i.e., don't abandon an inline autocompletion asynchronously), then
2220 // use the new suggestion 2235 // use the new suggestion
2221 // - abandon all inline autocompletions upon the server response, then use 2236 // - abandon all inline autocompletions upon the server response, then use
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
3598 } 3613 }
3599 3614
3600 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { 3615 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) {
3601 AutocompleteInput input( 3616 AutocompleteInput input(
3602 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), 3617 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(),
3603 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, 3618 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true,
3604 ChromeAutocompleteSchemeClassifier(&profile_)); 3619 ChromeAutocompleteSchemeClassifier(&profile_));
3605 provider_->Start(input, false); 3620 provider_->Start(input, false);
3606 EXPECT_TRUE(provider_->matches().empty()); 3621 EXPECT_TRUE(provider_->matches().empty());
3607 } 3622 }
OLDNEW
« no previous file with comments | « no previous file | components/omnibox/browser/base_search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698