Chromium Code Reviews| 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..98095d7f740266d3b66c14cb96e6d2c99f8d447c 100644 |
| --- a/chrome/browser/search/instant_unittest_base.cc |
| +++ b/chrome/browser/search/instant_unittest_base.cc |
| @@ -34,36 +34,27 @@ InstantUnitTestBase::~InstantUnitTestBase() { |
| } |
| void InstantUnitTestBase::SetUp() { |
| + chrome::EnableQueryExtractionForTesting(); |
| SetUpHelper(); |
| } |
| +void InstantUnitTestBase::TearDown() { |
| + UIThreadSearchTermsData::SetGoogleBaseURL(""); |
| + BrowserWithTestWindowTest::TearDown(); |
| +} |
| + |
| void InstantUnitTestBase::SetUpWithoutCacheableNTP() { |
| ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| "InstantExtended", "Group1 use_cacheable_ntp:0")); |
|
samarth
2014/02/12 18:02:39
Hmm, I think this is a no-op so we can probably ki
kmadhusu
2014/02/12 19:58:09
Okay.
|
| - 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()); |
| + SetUpHelper(); |
| } |
| -void InstantUnitTestBase::TearDown() { |
| - UIThreadSearchTermsData::SetGoogleBaseURL(""); |
| - BrowserWithTestWindowTest::TearDown(); |
| +#if !defined(OS_IOS) && !defined(OS_ANDROID) |
| +void InstantUnitTestBase::SetUpWithoutQueryExtraction() { |
| + SetUpHelper(); |
| } |
| +#endif |
| void InstantUnitTestBase::SetDefaultSearchProvider( |
| const std::string& base_url) { |
| @@ -98,9 +89,23 @@ void InstantUnitTestBase::NotifyGoogleBaseURLUpdate( |
| content::Details<GoogleURLTracker::UpdatedDetails>(&details)); |
| } |
| - |
| bool InstantUnitTestBase::IsInstantServiceObserver( |
| InstantServiceObserver* observer) { |
| return instant_service_->observers_.HasObserver(observer); |
| } |
| +void InstantUnitTestBase::SetUpHelper() { |
| + 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()); |
| +} |