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

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

Issue 1098843004: Omnibox - Do Not Allow HTTP/HTTPS Equivalence if User Explicitly Entered A Scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix browsertests compile error (sigh) Created 5 years, 5 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
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/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 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 { "a.com", "[\"a.com\",[\"info\"],[],[]," 2488 { "a.com", "[\"a.com\",[\"info\"],[],[],"
2489 "{\"google:suggestrelevance\":[9999]}]", 2489 "{\"google:suggestrelevance\":[9999]}]",
2490 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true }, 2490 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
2491 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false }, 2491 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false },
2492 kEmptyMatch, kEmptyMatch } }, 2492 kEmptyMatch, kEmptyMatch } },
2493 { "a.com", "[\"a.com\",[\"info\"],[],[]," 2493 { "a.com", "[\"a.com\",[\"info\"],[],[],"
2494 "{\"google:suggestrelevance\":[9999]}]", 2494 "{\"google:suggestrelevance\":[9999]}]",
2495 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true }, 2495 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
2496 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false }, 2496 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false },
2497 kEmptyMatch, kEmptyMatch } }, 2497 kEmptyMatch, kEmptyMatch } },
2498
2499 // Ensure that if the user explicitly enters a scheme, a navsuggest
2500 // result for a URL with a different scheme is not inlineable.
2501 { "http://a.com", "[\"http://a.com\","
2502 "[\"http://a.com/1\", \"https://a.com/\"],[],[],"
2503 "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
2504 "\"google:suggestrelevance\":[9000, 8000]}]",
2505 { { "http://a.com/1", AutocompleteMatchType::NAVSUGGEST, true },
2506 { "https://a.com", AutocompleteMatchType::NAVSUGGEST, false },
2507 { "http://a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
2508 true },
2509 kEmptyMatch } },
2498 }; 2510 };
2499 2511
2500 for (size_t i = 0; i < arraysize(cases); ++i) { 2512 for (size_t i = 0; i < arraysize(cases); ++i) {
2501 // Send the query twice in order to have a synchronous pass after the first 2513 // Send the query twice in order to have a synchronous pass after the first
2502 // response is received. This is necessary because SearchProvider doesn't 2514 // response is received. This is necessary because SearchProvider doesn't
2503 // allow an asynchronous response to change the default match. 2515 // allow an asynchronous response to change the default match.
2504 for (size_t j = 0; j < 2; ++j) { 2516 for (size_t j = 0; j < 2; ++j) {
2505 QueryForInputAndWaitForFetcherResponses( 2517 QueryForInputAndWaitForFetcherResponses(
2506 ASCIIToUTF16(cases[i].input), false, cases[i].json, std::string()); 2518 ASCIIToUTF16(cases[i].input), false, cases[i].json, std::string());
2507 } 2519 }
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
3596 } 3608 }
3597 3609
3598 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { 3610 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) {
3599 AutocompleteInput input( 3611 AutocompleteInput input(
3600 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), 3612 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(),
3601 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, 3613 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true,
3602 ChromeAutocompleteSchemeClassifier(&profile_)); 3614 ChromeAutocompleteSchemeClassifier(&profile_));
3603 provider_->Start(input, false); 3615 provider_->Start(input, false);
3604 EXPECT_TRUE(provider_->matches().empty()); 3616 EXPECT_TRUE(provider_->matches().empty());
3605 } 3617 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698