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

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

Issue 231863008: Rename SetDefaultSearchProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/autocomplete_provider.h" 5 #include "chrome/browser/autocomplete/autocomplete_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 const std::string& template_url) { 215 const std::string& template_url) {
216 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 216 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
217 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); 217 &profile_, &TemplateURLServiceFactory::BuildInstanceFor);
218 TemplateURLData data; 218 TemplateURLData data;
219 data.SetURL(template_url); 219 data.SetURL(template_url);
220 data.SetKeyword(keyword); 220 data.SetKeyword(keyword);
221 TemplateURL* default_t_url = new TemplateURL(&profile_, data); 221 TemplateURL* default_t_url = new TemplateURL(&profile_, data);
222 TemplateURLService* turl_model = 222 TemplateURLService* turl_model =
223 TemplateURLServiceFactory::GetForProfile(&profile_); 223 TemplateURLServiceFactory::GetForProfile(&profile_);
224 turl_model->Add(default_t_url); 224 turl_model->Add(default_t_url);
225 turl_model->SetDefaultSearchProvider(default_t_url); 225 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url);
226 turl_model->Load(); 226 turl_model->Load();
227 TemplateURLID default_provider_id = default_t_url->id(); 227 TemplateURLID default_provider_id = default_t_url->id();
228 ASSERT_NE(0, default_provider_id); 228 ASSERT_NE(0, default_provider_id);
229 } 229 }
230 230
231 void AutocompleteProviderTest::ResetControllerWithTestProviders( 231 void AutocompleteProviderTest::ResetControllerWithTestProviders(
232 bool same_destinations, 232 bool same_destinations,
233 TestProvider** provider1_ptr, 233 TestProvider** provider1_ptr,
234 TestProvider** provider2_ptr) { 234 TestProvider** provider2_ptr) {
235 // TODO: Move it outside this method, after refactoring the existing 235 // TODO: Move it outside this method, after refactoring the existing
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 291 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
292 &profile_, &TemplateURLServiceFactory::BuildInstanceFor); 292 &profile_, &TemplateURLServiceFactory::BuildInstanceFor);
293 293
294 // Reset the default TemplateURL. 294 // Reset the default TemplateURL.
295 TemplateURLData data; 295 TemplateURLData data;
296 data.SetURL("http://defaultturl/{searchTerms}"); 296 data.SetURL("http://defaultturl/{searchTerms}");
297 TemplateURL* default_t_url = new TemplateURL(&profile_, data); 297 TemplateURL* default_t_url = new TemplateURL(&profile_, data);
298 TemplateURLService* turl_model = 298 TemplateURLService* turl_model =
299 TemplateURLServiceFactory::GetForProfile(&profile_); 299 TemplateURLServiceFactory::GetForProfile(&profile_);
300 turl_model->Add(default_t_url); 300 turl_model->Add(default_t_url);
301 turl_model->SetDefaultSearchProvider(default_t_url); 301 turl_model->SetUserSelectedDefaultSearchProvider(default_t_url);
302 TemplateURLID default_provider_id = default_t_url->id(); 302 TemplateURLID default_provider_id = default_t_url->id();
303 ASSERT_NE(0, default_provider_id); 303 ASSERT_NE(0, default_provider_id);
304 304
305 // Create another TemplateURL for KeywordProvider. 305 // Create another TemplateURL for KeywordProvider.
306 data.short_name = base::ASCIIToUTF16("k"); 306 data.short_name = base::ASCIIToUTF16("k");
307 data.SetKeyword(base::ASCIIToUTF16("k")); 307 data.SetKeyword(base::ASCIIToUTF16("k"));
308 data.SetURL("http://keyword/{searchTerms}"); 308 data.SetURL("http://keyword/{searchTerms}");
309 TemplateURL* keyword_t_url = new TemplateURL(&profile_, data); 309 TemplateURL* keyword_t_url = new TemplateURL(&profile_, data);
310 turl_model->Add(keyword_t_url); 310 turl_model->Add(keyword_t_url);
311 ASSERT_NE(0, keyword_t_url->id()); 311 ASSERT_NE(0, keyword_t_url->id());
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); 655 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456));
656 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path()); 656 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j0j4&", url.path());
657 657
658 // Test page classification and field trial triggered set. 658 // Test page classification and field trial triggered set.
659 controller_->search_provider_->field_trial_triggered_in_session_ = true; 659 controller_->search_provider_->field_trial_triggered_in_session_ = true;
660 EXPECT_TRUE( 660 EXPECT_TRUE(
661 controller_->search_provider_->field_trial_triggered_in_session()); 661 controller_->search_provider_->field_trial_triggered_in_session());
662 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456)); 662 url = GetDestinationURL(match, base::TimeDelta::FromMilliseconds(2456));
663 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path()); 663 EXPECT_EQ("//aqs=chrome.0.69i57j69i58j5l2j0l3j69i59.2456j1j4&", url.path());
664 } 664 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698