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 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2483 { "a.com", "[\"a.com\",[\"info\"],[],[]," | 2483 { "a.com", "[\"a.com\",[\"info\"],[],[]," |
2484 "{\"google:suggestrelevance\":[9999]}]", | 2484 "{\"google:suggestrelevance\":[9999]}]", |
2485 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true }, | 2485 { { "a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true }, |
2486 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false }, | 2486 { "info", AutocompleteMatchType::SEARCH_SUGGEST, false }, |
2487 kEmptyMatch, kEmptyMatch } }, | 2487 kEmptyMatch, kEmptyMatch } }, |
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 |
| 2494 // Ensure that if the user explicitly enters a scheme, a navsuggest |
| 2495 // result for a URL with a different scheme is not inlineable. |
| 2496 { "http://a.com", "[\"http://a.com\"," |
| 2497 "[\"http://a.com/1\", \"https://a.com/\"],[],[]," |
| 2498 "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]," |
| 2499 "\"google:suggestrelevance\":[9000, 8000]}]", |
| 2500 { { "http://a.com/1", AutocompleteMatchType::NAVSUGGEST, true }, |
| 2501 { "https://a.com", AutocompleteMatchType::NAVSUGGEST, false }, |
| 2502 { "http://a.com", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, |
| 2503 true }, |
| 2504 kEmptyMatch } }, |
2493 }; | 2505 }; |
2494 | 2506 |
2495 for (size_t i = 0; i < arraysize(cases); ++i) { | 2507 for (size_t i = 0; i < arraysize(cases); ++i) { |
2496 // Send the query twice in order to have a synchronous pass after the first | 2508 // Send the query twice in order to have a synchronous pass after the first |
2497 // response is received. This is necessary because SearchProvider doesn't | 2509 // response is received. This is necessary because SearchProvider doesn't |
2498 // allow an asynchronous response to change the default match. | 2510 // allow an asynchronous response to change the default match. |
2499 for (size_t j = 0; j < 2; ++j) { | 2511 for (size_t j = 0; j < 2; ++j) { |
2500 QueryForInputAndWaitForFetcherResponses( | 2512 QueryForInputAndWaitForFetcherResponses( |
2501 ASCIIToUTF16(cases[i].input), false, cases[i].json, std::string()); | 2513 ASCIIToUTF16(cases[i].input), false, cases[i].json, std::string()); |
2502 } | 2514 } |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3592 | 3604 |
3593 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { | 3605 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { |
3594 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos, | 3606 AutocompleteInput input(base::ASCIIToUTF16("f"), base::string16::npos, |
3595 std::string(), GURL(), | 3607 std::string(), GURL(), |
3596 metrics::OmniboxEventProto::INVALID_SPEC, false, | 3608 metrics::OmniboxEventProto::INVALID_SPEC, false, |
3597 true, true, true, | 3609 true, true, true, |
3598 ChromeAutocompleteSchemeClassifier(&profile_)); | 3610 ChromeAutocompleteSchemeClassifier(&profile_)); |
3599 provider_->Start(input, false, true); | 3611 provider_->Start(input, false, true); |
3600 EXPECT_TRUE(provider_->matches().empty()); | 3612 EXPECT_TRUE(provider_->matches().empty()); |
3601 } | 3613 } |
OLD | NEW |