OLD | NEW |
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 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/google/google_url_tracker.h" | 10 #include "chrome/browser/google/google_url_tracker.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 chrome::NOTIFICATION_GOOGLE_URL_UPDATED, | 80 chrome::NOTIFICATION_GOOGLE_URL_UPDATED, |
81 content::Source<Profile>(profile()->GetOriginalProfile()), | 81 content::Source<Profile>(profile()->GetOriginalProfile()), |
82 content::Details<GoogleURLTracker::UpdatedDetails>(&details)); | 82 content::Details<GoogleURLTracker::UpdatedDetails>(&details)); |
83 } | 83 } |
84 | 84 |
85 bool InstantUnitTestBase::IsInstantServiceObserver( | 85 bool InstantUnitTestBase::IsInstantServiceObserver( |
86 InstantServiceObserver* observer) { | 86 InstantServiceObserver* observer) { |
87 return instant_service_->observers_.HasObserver(observer); | 87 return instant_service_->observers_.HasObserver(observer); |
88 } | 88 } |
89 | 89 |
| 90 void InstantUnitTestBase::CustomizeServiceFactories() { |
| 91 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 92 profile(), &TemplateURLServiceFactory::BuildInstanceFor); |
| 93 } |
| 94 |
90 void InstantUnitTestBase::SetUpHelper() { | 95 void InstantUnitTestBase::SetUpHelper() { |
91 BrowserWithTestWindowTest::SetUp(); | 96 BrowserWithTestWindowTest::SetUp(); |
92 | 97 |
93 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | |
94 profile(), &TemplateURLServiceFactory::BuildInstanceFor); | |
95 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); | 98 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); |
96 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); | 99 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); |
97 | 100 |
98 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); | 101 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); |
99 TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); | 102 TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); |
100 pref_service->SetUserPref(prefs::kLastPromptedGoogleURL, | 103 pref_service->SetUserPref(prefs::kLastPromptedGoogleURL, |
101 new base::StringValue("https://www.google.com/")); | 104 new base::StringValue("https://www.google.com/")); |
102 SetUserSelectedDefaultSearchProvider("{google:baseURL}"); | 105 SetUserSelectedDefaultSearchProvider("{google:baseURL}"); |
103 instant_service_ = InstantServiceFactory::GetForProfile(profile()); | 106 instant_service_ = InstantServiceFactory::GetForProfile(profile()); |
104 } | 107 } |
OLD | NEW |