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

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

Issue 1135163002: Omnibox - Strip Extra Whitespace from Custom Search Engine Names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix more tests that don't set short_name Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/zero_suggest_provider.h" 5 #include "chrome/browser/autocomplete/zero_suggest_provider.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 165 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
166 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); 166 &profile_, &TemplateURLServiceFactory::BuildInstanceFor);
167 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse( 167 AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
168 &profile_, &AutocompleteClassifierFactory::BuildInstanceFor); 168 &profile_, &AutocompleteClassifierFactory::BuildInstanceFor);
169 169
170 TemplateURLService* turl_model = 170 TemplateURLService* turl_model =
171 TemplateURLServiceFactory::GetForProfile(&profile_); 171 TemplateURLServiceFactory::GetForProfile(&profile_);
172 turl_model->Load(); 172 turl_model->Load();
173 173
174 TemplateURLData data; 174 TemplateURLData data;
175 data.short_name = base::ASCIIToUTF16("t"); 175 data.SetShortName(base::ASCIIToUTF16("t"));
176 data.SetURL("https://www.google.com/?q={searchTerms}"); 176 data.SetURL("https://www.google.com/?q={searchTerms}");
177 data.suggestions_url = "https://www.google.com/complete/?q={searchTerms}"; 177 data.suggestions_url = "https://www.google.com/complete/?q={searchTerms}";
178 data.instant_url = "https://does/not/exist?strk=1"; 178 data.instant_url = "https://does/not/exist?strk=1";
179 data.search_terms_replacement_key = "strk"; 179 data.search_terms_replacement_key = "strk";
180 default_t_url_ = new TemplateURL(data); 180 default_t_url_ = new TemplateURL(data);
181 turl_model->Add(default_t_url_); 181 turl_model->Add(default_t_url_);
182 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url_); 182 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url_);
183 183
184 TopSitesFactory* top_sites_factory = TopSitesFactory::GetInstance(); 184 TopSitesFactory* top_sites_factory = TopSitesFactory::GetInstance();
185 top_sites_factory->SetTestingFactory(&profile_, BuildFakeEmptyTopSites); 185 top_sites_factory->SetTestingFactory(&profile_, BuildFakeEmptyTopSites);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 443
444 base::RunLoop().RunUntilIdle(); 444 base::RunLoop().RunUntilIdle();
445 445
446 // Expect that the matches have been cleared. 446 // Expect that the matches have been cleared.
447 ASSERT_TRUE(provider_->matches().empty()); 447 ASSERT_TRUE(provider_->matches().empty());
448 448
449 // Expect the new results have been stored. 449 // Expect the new results have been stored.
450 EXPECT_EQ(empty_response, 450 EXPECT_EQ(empty_response,
451 prefs->GetString(prefs::kZeroSuggestCachedResults)); 451 prefs->GetString(prefs::kZeroSuggestCachedResults));
452 } 452 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/shortcuts_backend_unittest.cc ('k') | chrome/browser/chrome_content_browser_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698