Index: chrome/browser/search/instant_unittest_base.cc |
diff --git a/chrome/browser/search/instant_unittest_base.cc b/chrome/browser/search/instant_unittest_base.cc |
index 6c2466ce3f327dbc6e4b369285635c3b45e4eb27..246be523ad96062e54e6c9d86c7219dd9db76d60 100644 |
--- a/chrome/browser/search/instant_unittest_base.cc |
+++ b/chrome/browser/search/instant_unittest_base.cc |
@@ -25,7 +25,8 @@ |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_source.h" |
-InstantUnitTestBase::InstantUnitTestBase() { |
+InstantUnitTestBase::InstantUnitTestBase() |
+ : enable_query_extraction_(true) { |
field_trial_list_.reset(new base::FieldTrialList( |
new metrics::SHA1EntropyProvider("42"))); |
} |
@@ -37,32 +38,20 @@ void InstantUnitTestBase::SetUp() { |
SetUpHelper(); |
} |
+void InstantUnitTestBase::TearDown() { |
+ UIThreadSearchTermsData::SetGoogleBaseURL(""); |
+ BrowserWithTestWindowTest::TearDown(); |
+} |
+ |
void InstantUnitTestBase::SetUpWithoutCacheableNTP() { |
ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
"InstantExtended", "Group1 use_cacheable_ntp:0")); |
SetUpHelper(); |
} |
-void InstantUnitTestBase::SetUpHelper() { |
- chrome::EnableQueryExtractionForTesting(); |
- BrowserWithTestWindowTest::SetUp(); |
- |
- TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
- profile(), &TemplateURLServiceFactory::BuildInstanceFor); |
- template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); |
- ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); |
- |
- UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); |
- TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); |
- pref_service->SetUserPref(prefs::kLastPromptedGoogleURL, |
- new base::StringValue("https://www.google.com/")); |
- SetDefaultSearchProvider("{google:baseURL}"); |
- instant_service_ = InstantServiceFactory::GetForProfile(profile()); |
-} |
- |
-void InstantUnitTestBase::TearDown() { |
- UIThreadSearchTermsData::SetGoogleBaseURL(""); |
- BrowserWithTestWindowTest::TearDown(); |
+void InstantUnitTestBase::SetUpWithoutQueryExtraction() { |
+ enable_query_extraction_ = false; |
Jered
2014/02/07 03:02:26
Note that query extraction is enabled unconditiona
kmadhusu
2014/02/11 01:40:02
Ack.
|
+ SetUpHelper(); |
} |
void InstantUnitTestBase::SetDefaultSearchProvider( |
@@ -98,9 +87,25 @@ void InstantUnitTestBase::NotifyGoogleBaseURLUpdate( |
content::Details<GoogleURLTracker::UpdatedDetails>(&details)); |
} |
- |
bool InstantUnitTestBase::IsInstantServiceObserver( |
InstantServiceObserver* observer) { |
return instant_service_->observers_.HasObserver(observer); |
} |
+void InstantUnitTestBase::SetUpHelper() { |
+ if (enable_query_extraction_) |
Jered
2014/02/07 03:02:26
What disables query extraction if this is false? A
kmadhusu
2014/02/11 01:40:02
I agree that it is kind of tricky with a boolean m
|
+ chrome::EnableQueryExtractionForTesting(); |
+ BrowserWithTestWindowTest::SetUp(); |
+ |
+ TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
+ profile(), &TemplateURLServiceFactory::BuildInstanceFor); |
+ template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); |
+ ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); |
+ |
+ UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); |
+ TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); |
+ pref_service->SetUserPref(prefs::kLastPromptedGoogleURL, |
+ new base::StringValue("https://www.google.com/")); |
+ SetDefaultSearchProvider("{google:baseURL}"); |
+ instant_service_ = InstantServiceFactory::GetForProfile(profile()); |
+} |