OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_engines/template_url_service_test_util.h" | 5 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 base::RunLoop().RunUntilIdle(); | 90 base::RunLoop().RunUntilIdle(); |
91 EXPECT_EQ(1, GetObserverCount()); | 91 EXPECT_EQ(1, GetObserverCount()); |
92 ResetObserverCount(); | 92 ResetObserverCount(); |
93 } | 93 } |
94 | 94 |
95 void TemplateURLServiceTestUtilBase::ChangeModelToLoadState() { | 95 void TemplateURLServiceTestUtilBase::ChangeModelToLoadState() { |
96 model()->ChangeToLoadedState(); | 96 model()->ChangeToLoadedState(); |
97 // Initialize the web data service so that the database gets updated with | 97 // Initialize the web data service so that the database gets updated with |
98 // any changes made. | 98 // any changes made. |
99 | 99 |
100 model()->service_ = WebDataService::FromBrowserContext(profile()); | 100 model()->web_data_service_ = |
| 101 WebDataServiceFactory::GetKeywordWebDataForProfile( |
| 102 profile(), Profile::EXPLICIT_ACCESS); |
101 base::RunLoop().RunUntilIdle(); | 103 base::RunLoop().RunUntilIdle(); |
102 } | 104 } |
103 | 105 |
104 void TemplateURLServiceTestUtilBase::ClearModel() { | 106 void TemplateURLServiceTestUtilBase::ClearModel() { |
105 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 107 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
106 profile(), NULL); | 108 profile(), NULL); |
107 } | 109 } |
108 | 110 |
109 void TemplateURLServiceTestUtilBase::ResetModel(bool verify_load) { | 111 void TemplateURLServiceTestUtilBase::ResetModel(bool verify_load) { |
110 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 112 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 225 |
224 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); | 226 UIThreadSearchTermsData::SetGoogleBaseURL(std::string()); |
225 | 227 |
226 // Flush the message loop to make application verifiers happy. | 228 // Flush the message loop to make application verifiers happy. |
227 base::RunLoop().RunUntilIdle(); | 229 base::RunLoop().RunUntilIdle(); |
228 } | 230 } |
229 | 231 |
230 TestingProfile* TemplateURLServiceTestUtil::profile() const { | 232 TestingProfile* TemplateURLServiceTestUtil::profile() const { |
231 return profile_.get(); | 233 return profile_.get(); |
232 } | 234 } |
OLD | NEW |