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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 BlockTillServiceProcessesRequests(); | 171 BlockTillServiceProcessesRequests(); |
172 EXPECT_EQ(1, GetObserverCount()); | 172 EXPECT_EQ(1, GetObserverCount()); |
173 ResetObserverCount(); | 173 ResetObserverCount(); |
174 } | 174 } |
175 | 175 |
176 void TemplateURLServiceTestUtil::ChangeModelToLoadState() { | 176 void TemplateURLServiceTestUtil::ChangeModelToLoadState() { |
177 model()->ChangeToLoadedState(); | 177 model()->ChangeToLoadedState(); |
178 // Initialize the web data service so that the database gets updated with | 178 // Initialize the web data service so that the database gets updated with |
179 // any changes made. | 179 // any changes made. |
180 | 180 |
181 model()->service_ = WebDataServiceFactory::GetForProfile( | 181 model()->service_ = WebDataService::FromBrowserContext(profile_.get()); |
182 profile_.get(), Profile::EXPLICIT_ACCESS); | |
183 BlockTillServiceProcessesRequests(); | 182 BlockTillServiceProcessesRequests(); |
184 } | 183 } |
185 | 184 |
186 void TemplateURLServiceTestUtil::ClearModel() { | 185 void TemplateURLServiceTestUtil::ClearModel() { |
187 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( | 186 TemplateURLServiceFactory::GetInstance()->SetTestingFactory( |
188 profile_.get(), NULL); | 187 profile_.get(), NULL); |
189 } | 188 } |
190 | 189 |
191 void TemplateURLServiceTestUtil::ResetModel(bool verify_load) { | 190 void TemplateURLServiceTestUtil::ResetModel(bool verify_load) { |
192 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 191 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 return profile_.get(); | 276 return profile_.get(); |
278 } | 277 } |
279 | 278 |
280 void TemplateURLServiceTestUtil::StartIOThread() { | 279 void TemplateURLServiceTestUtil::StartIOThread() { |
281 io_thread_.StartIOThread(); | 280 io_thread_.StartIOThread(); |
282 } | 281 } |
283 | 282 |
284 void TemplateURLServiceTestUtil::PumpLoop() { | 283 void TemplateURLServiceTestUtil::PumpLoop() { |
285 message_loop_.RunUntilIdle(); | 284 message_loop_.RunUntilIdle(); |
286 } | 285 } |
OLD | NEW |