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