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

Side by Side Diff: chrome/browser/search/instant_unittest_base.cc

Issue 2211983002: Remove search::IsQueryExtractionEnabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_prefetch_non_default
Patch Set: remove more tests Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/instant_unittest_base.h" 5 #include "chrome/browser/search/instant_unittest_base.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 15 matching lines...) Expand all
26 26
27 InstantUnitTestBase::InstantUnitTestBase() { 27 InstantUnitTestBase::InstantUnitTestBase() {
28 field_trial_list_.reset(new base::FieldTrialList( 28 field_trial_list_.reset(new base::FieldTrialList(
29 new metrics::SHA1EntropyProvider("42"))); 29 new metrics::SHA1EntropyProvider("42")));
30 } 30 }
31 31
32 InstantUnitTestBase::~InstantUnitTestBase() { 32 InstantUnitTestBase::~InstantUnitTestBase() {
33 } 33 }
34 34
35 void InstantUnitTestBase::SetUp() { 35 void InstantUnitTestBase::SetUp() {
36 search::EnableQueryExtractionForTesting(); 36 BrowserWithTestWindowTest::SetUp();
37 SetUpHelper(); 37
38 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile());
39 search_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_);
40
41 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/");
42 SetUserSelectedDefaultSearchProvider("{google:baseURL}");
43 instant_service_ = InstantServiceFactory::GetForProfile(profile());
38 } 44 }
39 45
40 void InstantUnitTestBase::TearDown() { 46 void InstantUnitTestBase::TearDown() {
41 UIThreadSearchTermsData::SetGoogleBaseURL(""); 47 UIThreadSearchTermsData::SetGoogleBaseURL("");
42 BrowserWithTestWindowTest::TearDown(); 48 BrowserWithTestWindowTest::TearDown();
43 } 49 }
44 50
45 #if !defined(OS_ANDROID)
46 void InstantUnitTestBase::SetUpWithoutQueryExtraction() {
47 SetUpHelper();
48 }
49 #endif
50
51 void InstantUnitTestBase::SetUserSelectedDefaultSearchProvider( 51 void InstantUnitTestBase::SetUserSelectedDefaultSearchProvider(
52 const std::string& base_url) { 52 const std::string& base_url) {
53 TemplateURLData data; 53 TemplateURLData data;
54 data.SetShortName(base::UTF8ToUTF16(base_url)); 54 data.SetShortName(base::UTF8ToUTF16(base_url));
55 data.SetKeyword(base::UTF8ToUTF16(base_url)); 55 data.SetKeyword(base::UTF8ToUTF16(base_url));
56 data.SetURL(base_url + "url?bar={searchTerms}"); 56 data.SetURL(base_url + "url?bar={searchTerms}");
57 data.instant_url = 57 data.instant_url =
58 base_url + "instant?{google:forceInstantResults}foo=foo#foo=foo&strk"; 58 base_url + "instant?{google:forceInstantResults}foo=foo#foo=foo&strk";
59 data.new_tab_url = base_url + "newtab"; 59 data.new_tab_url = base_url + "newtab";
60 data.alternate_urls.push_back(base_url + "alt#quux={searchTerms}"); 60 data.alternate_urls.push_back(base_url + "alt#quux={searchTerms}");
(...skipping 20 matching lines...) Expand all
81 const InstantServiceObserver* observer) const { 81 const InstantServiceObserver* observer) const {
82 return instant_service_->observers_.HasObserver(observer); 82 return instant_service_->observers_.HasObserver(observer);
83 } 83 }
84 84
85 TestingProfile* InstantUnitTestBase::CreateProfile() { 85 TestingProfile* InstantUnitTestBase::CreateProfile() {
86 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); 86 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile();
87 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( 87 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
88 profile, &TemplateURLServiceFactory::BuildInstanceFor); 88 profile, &TemplateURLServiceFactory::BuildInstanceFor);
89 return profile; 89 return profile;
90 } 90 }
91
92 void InstantUnitTestBase::SetUpHelper() {
93 BrowserWithTestWindowTest::SetUp();
94
95 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile());
96 search_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_);
97
98 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/");
99 SetUserSelectedDefaultSearchProvider("{google:baseURL}");
100 instant_service_ = InstantServiceFactory::GetForProfile(profile());
101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698