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

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

Issue 1543203002: Remove a variety of no-longer-used query params. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/browser/search_provider.h" 5 #include "components/omnibox/browser/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 10 matching lines...) Expand all
21 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 21 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
22 #include "chrome/browser/history/history_service_factory.h" 22 #include "chrome/browser/history/history_service_factory.h"
23 #include "chrome/browser/search_engines/template_url_service_factory.h" 23 #include "chrome/browser/search_engines/template_url_service_factory.h"
24 #include "chrome/browser/signin/account_tracker_service_factory.h" 24 #include "chrome/browser/signin/account_tracker_service_factory.h"
25 #include "chrome/browser/signin/signin_manager_factory.h" 25 #include "chrome/browser/signin/signin_manager_factory.h"
26 #include "chrome/browser/sync/profile_sync_service_factory.h" 26 #include "chrome/browser/sync/profile_sync_service_factory.h"
27 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "chrome/test/base/testing_browser_process.h" 29 #include "chrome/test/base/testing_browser_process.h"
30 #include "chrome/test/base/testing_profile.h" 30 #include "chrome/test/base/testing_profile.h"
31 #include "components/bookmarks/common/bookmark_pref_names.h"
32 #include "components/browser_sync/browser/profile_sync_service.h" 31 #include "components/browser_sync/browser/profile_sync_service.h"
33 #include "components/google/core/browser/google_switches.h" 32 #include "components/google/core/browser/google_switches.h"
34 #include "components/history/core/browser/history_service.h" 33 #include "components/history/core/browser/history_service.h"
35 #include "components/metrics/proto/omnibox_event.pb.h" 34 #include "components/metrics/proto/omnibox_event.pb.h"
36 #include "components/omnibox/browser/autocomplete_controller.h" 35 #include "components/omnibox/browser/autocomplete_controller.h"
37 #include "components/omnibox/browser/autocomplete_input.h" 36 #include "components/omnibox/browser/autocomplete_input.h"
38 #include "components/omnibox/browser/autocomplete_match.h" 37 #include "components/omnibox/browser/autocomplete_match.h"
39 #include "components/omnibox/browser/autocomplete_provider.h" 38 #include "components/omnibox/browser/autocomplete_provider.h"
40 #include "components/omnibox/browser/autocomplete_provider_listener.h" 39 #include "components/omnibox/browser/autocomplete_provider_listener.h"
41 #include "components/omnibox/browser/history_url_provider.h" 40 #include "components/omnibox/browser/history_url_provider.h"
(...skipping 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after
3219 for (size_t j = 0; j < matches.size(); ++j) { 3218 for (size_t j = 0; j < matches.size(); ++j) {
3220 const Match& match = cases[i].matches[j]; 3219 const Match& match = cases[i].matches[j];
3221 SCOPED_TRACE(" and match index: " + base::SizeTToString(j)); 3220 SCOPED_TRACE(" and match index: " + base::SizeTToString(j));
3222 EXPECT_EQ(match.contents, base::UTF16ToUTF8(matches[j].contents)); 3221 EXPECT_EQ(match.contents, base::UTF16ToUTF8(matches[j].contents));
3223 EXPECT_EQ(match.deletion_url, matches[j].GetAdditionalInfo( 3222 EXPECT_EQ(match.deletion_url, matches[j].GetAdditionalInfo(
3224 "deletion_url")); 3223 "deletion_url"));
3225 } 3224 }
3226 } 3225 }
3227 } 3226 }
3228 3227
3229 TEST_F(SearchProviderTest, ReflectsBookmarkBarState) {
3230 profile_.GetPrefs()->SetBoolean(bookmarks::prefs::kShowBookmarkBar, false);
3231 base::string16 term = term1_.substr(0, term1_.length() - 1);
3232 QueryForInput(term, true, false);
3233 ASSERT_FALSE(provider_->matches().empty());
3234 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
3235 provider_->matches()[0].type);
3236 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL);
3237 EXPECT_FALSE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned);
3238
3239 profile_.GetPrefs()->SetBoolean(bookmarks::prefs::kShowBookmarkBar, true);
3240 term = term1_.substr(0, term1_.length() - 1);
3241 QueryForInput(term, true, false);
3242 ASSERT_FALSE(provider_->matches().empty());
3243 EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
3244 provider_->matches()[0].type);
3245 ASSERT_TRUE(provider_->matches()[0].search_terms_args != NULL);
3246 EXPECT_TRUE(provider_->matches()[0].search_terms_args->bookmark_bar_pinned);
3247 }
3248
3249 TEST_F(SearchProviderTest, CanSendURL) { 3228 TEST_F(SearchProviderTest, CanSendURL) {
3250 TemplateURLData template_url_data; 3229 TemplateURLData template_url_data;
3251 template_url_data.SetShortName(ASCIIToUTF16("t")); 3230 template_url_data.SetShortName(ASCIIToUTF16("t"));
3252 template_url_data.SetURL("http://www.google.com/{searchTerms}"); 3231 template_url_data.SetURL("http://www.google.com/{searchTerms}");
3253 template_url_data.suggestions_url = "http://www.google.com/{searchTerms}"; 3232 template_url_data.suggestions_url = "http://www.google.com/{searchTerms}";
3254 template_url_data.instant_url = "http://does/not/exist?strk=1"; 3233 template_url_data.instant_url = "http://does/not/exist?strk=1";
3255 template_url_data.search_terms_replacement_key = "strk"; 3234 template_url_data.search_terms_replacement_key = "strk";
3256 template_url_data.id = SEARCH_ENGINE_GOOGLE; 3235 template_url_data.id = SEARCH_ENGINE_GOOGLE;
3257 TemplateURL google_template_url(template_url_data); 3236 TemplateURL google_template_url(template_url_data);
3258 3237
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
3614 } 3593 }
3615 3594
3616 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) { 3595 TEST_F(SearchProviderTest, DoesNotProvideOnFocus) {
3617 AutocompleteInput input( 3596 AutocompleteInput input(
3618 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(), 3597 base::ASCIIToUTF16("f"), base::string16::npos, std::string(), GURL(),
3619 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true, 3598 metrics::OmniboxEventProto::INVALID_SPEC, false, true, true, true, true,
3620 ChromeAutocompleteSchemeClassifier(&profile_)); 3599 ChromeAutocompleteSchemeClassifier(&profile_));
3621 provider_->Start(input, false); 3600 provider_->Start(input, false);
3622 EXPECT_TRUE(provider_->matches().empty()); 3601 EXPECT_TRUE(provider_->matches().empty());
3623 } 3602 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698