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 "chrome/browser/autocomplete/search_provider.h" | 5 #include "chrome/browser/autocomplete/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 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 "https://abc.com/path/file.htm?q=x#foo", | 2263 "https://abc.com/path/file.htm?q=x#foo", |
2264 "c.com/path/file.htm?q=x#foo", true }, | 2264 "c.com/path/file.htm?q=x#foo", true }, |
2265 | 2265 |
2266 // Forced query input should inline and retain the "?" prefix. | 2266 // Forced query input should inline and retain the "?" prefix. |
2267 { "?http://www.ab", "http://www.abc.com", | 2267 { "?http://www.ab", "http://www.abc.com", |
2268 "?http://www.abc.com", "c.com", true }, | 2268 "?http://www.abc.com", "c.com", true }, |
2269 { "?www.ab", "http://www.abc.com", | 2269 { "?www.ab", "http://www.abc.com", |
2270 "?www.abc.com", "c.com", true }, | 2270 "?www.abc.com", "c.com", true }, |
2271 { "?ab", "http://www.abc.com", | 2271 { "?ab", "http://www.abc.com", |
2272 "?www.abc.com", "c.com", true }, | 2272 "?www.abc.com", "c.com", true }, |
| 2273 { "?abc.com", "http://www.abc.com", |
| 2274 "?www.abc.com", "", true }, |
2273 }; | 2275 }; |
2274 | 2276 |
2275 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { | 2277 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { |
2276 QueryForInput(ASCIIToUTF16(cases[i].input), false, false); | 2278 QueryForInput(ASCIIToUTF16(cases[i].input), false, false); |
2277 AutocompleteMatch match( | 2279 AutocompleteMatch match( |
2278 provider_->NavigationToMatch(SearchProvider::NavigationResult( | 2280 provider_->NavigationToMatch(SearchProvider::NavigationResult( |
2279 *provider_.get(), GURL(cases[i].url), string16(), false, 0, | 2281 *provider_.get(), GURL(cases[i].url), string16(), false, 0, |
2280 false))); | 2282 false))); |
2281 EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion), | 2283 EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion), |
2282 match.inline_autocompletion); | 2284 match.inline_autocompletion); |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2973 | 2975 |
2974 profile_.GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); | 2976 profile_.GetPrefs()->SetBoolean(prefs::kShowBookmarkBar, true); |
2975 term = term1_.substr(0, term1_.length() - 1); | 2977 term = term1_.substr(0, term1_.length() - 1); |
2976 QueryForInput(term, true, false); | 2978 QueryForInput(term, true, false); |
2977 ASSERT_FALSE(provider_->matches().empty()); | 2979 ASSERT_FALSE(provider_->matches().empty()); |
2978 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, | 2980 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, |
2979 provider_->matches()[0].type); | 2981 provider_->matches()[0].type); |
2980 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL); | 2982 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL); |
2981 EXPECT_TRUE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned); | 2983 EXPECT_TRUE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned); |
2982 } | 2984 } |
OLD | NEW |