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

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: refactored, as discussed Created 5 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
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 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 { "a.com", "[\"a.com\",[\"info\"],[],[]," 2498 { "a.com", "[\"a.com\",[\"info\"],[],[],"
2499 "{\"google:suggestrelevance\":[9999]}]", 2499 "{\"google:suggestrelevance\":[9999]}]",
2500 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true }, 2500 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
2501 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false }, 2501 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false },
2502 kEmptyMatch, kEmptyMatch } }, 2502 kEmptyMatch, kEmptyMatch } },
2503
2504 // Ensure that if the user explicitly enters a scheme, a navsuggest
2505 // result for a URL with a different scheme is not inlineable.
2506 { "http://a.com", "[\"http://a.com\","
2507 "[\"http://a.com/1\", \"https://a.com/\"],[],[],"
2508 "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
2509 "\"google:suggestrelevance\":[9000, 8000]}]",
2510 { { "http://a.com/1", AutocompleteMatchType::NAVSUGGEST, true },
2511 { "https://a.com", AutocompleteMatchType::NAVSUGGEST, false },
2512 { "http://a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
2513 true },
2514 kEmptyMatch } },
2503 }; 2515 };
2504 2516
2505 for (size_t i = 0; i < arraysize(cases); ++i) { 2517 for (size_t i = 0; i < arraysize(cases); ++i) {
2506 // Send the query twice in order to have a synchronous pass after the first 2518 // Send the query twice in order to have a synchronous pass after the first
2507 // response is received. This is necessary because SearchProvider doesn't 2519 // response is received. This is necessary because SearchProvider doesn't
2508 // allow an asynchronous response to change the default match. 2520 // allow an asynchronous response to change the default match.
2509 for (size_t j = 0; j < 2; ++j) { 2521 for (size_t j = 0; j < 2; ++j) {
2510 QueryForInputAndWaitForFetcherResponses( 2522 QueryForInputAndWaitForFetcherResponses(
2511 ASCIIToUTF16(cases[i].input), false, cases[i].json, std::string()); 2523 ASCIIToUTF16(cases[i].input), false, cases[i].json, std::string());
2512 } 2524 }
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
3602 3614
3603 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { 3615 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) {
3604 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos, 3616 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos,
3605 std::string(), GURL(), 3617 std::string(), GURL(),
3606 metrics::OmniboxEventProto::INVALID_SPEC, false, 3618 metrics::OmniboxEventProto::INVALID_SPEC, false,
3607 true, true, true, 3619 true, true, true,
3608 ChromeAutocompleteSchemeClassifier(&profile_)); 3620 ChromeAutocompleteSchemeClassifier(&profile_));
3609 provider_->Start(input, false, true); 3621 provider_->Start(input, false, true);
3610 EXPECT_TRUE(provider_->matches().empty()); 3622 EXPECT_TRUE(provider_->matches().empty());
3611 } 3623 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698