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 TestingProfile* InstantUnitTestBase::CreateProfile() { |
| 91 TestingProfile* profile = BrowserWithTestWindowTest::CreateProfile(); |
| 92 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 93 profile, &TemplateURLServiceFactory::BuildInstanceFor); |
| 94 return profile; |
| 95 } |
| 96 |
90 void InstantUnitTestBase::SetUpHelper() { | 97 void InstantUnitTestBase::SetUpHelper() { |
91 BrowserWithTestWindowTest::SetUp(); | 98 BrowserWithTestWindowTest::SetUp(); |
92 | 99 |
93 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | |
94 profile(), &TemplateURLServiceFactory::BuildInstanceFor); | |
95 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); | 100 template_url_service_ = TemplateURLServiceFactory::GetForProfile(profile()); |
96 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); | 101 ui_test_utils::WaitForTemplateURLServiceToLoad(template_url_service_); |
97 | 102 |
98 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); | 103 UIThreadSearchTermsData::SetGoogleBaseURL("https://www.google.com/"); |
99 TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); | 104 TestingPrefServiceSyncable* pref_service = profile()->GetTestingPrefService(); |
100 pref_service->SetUserPref(prefs::kLastPromptedGoogleURL, | 105 pref_service->SetUserPref(prefs::kLastPromptedGoogleURL, |
101 new base::StringValue("https://www.google.com/")); | 106 new base::StringValue("https://www.google.com/")); |
102 SetUserSelectedDefaultSearchProvider("{google:baseURL}"); | 107 SetUserSelectedDefaultSearchProvider("{google:baseURL}"); |
103 instant_service_ = InstantServiceFactory::GetForProfile(profile()); | 108 instant_service_ = InstantServiceFactory::GetForProfile(profile()); |
104 } | 109 } |
OLD | NEW |