OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 history_service_ = new HistoryService(this); | 253 history_service_ = new HistoryService(this); |
254 history_service_->Init(GetPath(), bookmark_bar_model_.get(), no_db); | 254 history_service_->Init(GetPath(), bookmark_bar_model_.get(), no_db); |
255 } | 255 } |
256 | 256 |
257 void TestingProfile::DestroyHistoryService() { | 257 void TestingProfile::DestroyHistoryService() { |
258 if (!history_service_.get()) | 258 if (!history_service_.get()) |
259 return; | 259 return; |
260 | 260 |
261 history_service_->NotifyRenderProcessHostDestruction(0); | 261 history_service_->NotifyRenderProcessHostDestruction(0); |
262 history_service_->SetOnBackendDestroyTask(new MessageLoop::QuitTask); | 262 history_service_->SetOnBackendDestroyTask(MessageLoop::QuitClosure()); |
263 history_service_->Cleanup(); | 263 history_service_->Cleanup(); |
264 history_service_ = NULL; | 264 history_service_ = NULL; |
265 | 265 |
266 // Wait for the backend class to terminate before deleting the files and | 266 // Wait for the backend class to terminate before deleting the files and |
267 // moving to the next test. Note: if this never terminates, somebody is | 267 // moving to the next test. Note: if this never terminates, somebody is |
268 // probably leaking a reference to the history backend, so it never calls | 268 // probably leaking a reference to the history backend, so it never calls |
269 // our destroy task. | 269 // our destroy task. |
270 MessageLoop::current()->Run(); | 270 MessageLoop::current()->Run(); |
271 | 271 |
272 // Make sure we don't have any event pending that could disrupt the next | 272 // Make sure we don't have any event pending that could disrupt the next |
273 // test. | 273 // test. |
274 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 274 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
275 MessageLoop::current()->Run(); | 275 MessageLoop::current()->Run(); |
276 } | 276 } |
277 | 277 |
278 void TestingProfile::CreateTopSites() { | 278 void TestingProfile::CreateTopSites() { |
279 DestroyTopSites(); | 279 DestroyTopSites(); |
280 top_sites_ = new history::TopSites(this); | 280 top_sites_ = new history::TopSites(this); |
281 FilePath file_name = GetPath().Append(chrome::kTopSitesFilename); | 281 FilePath file_name = GetPath().Append(chrome::kTopSitesFilename); |
282 top_sites_->Init(file_name); | 282 top_sites_->Init(file_name); |
283 } | 283 } |
284 | 284 |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 856 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
857 return GetExtensionSpecialStoragePolicy(); | 857 return GetExtensionSpecialStoragePolicy(); |
858 } | 858 } |
859 | 859 |
860 void TestingProfile::DestroyWebDataService() { | 860 void TestingProfile::DestroyWebDataService() { |
861 if (!web_data_service_.get()) | 861 if (!web_data_service_.get()) |
862 return; | 862 return; |
863 | 863 |
864 web_data_service_->Shutdown(); | 864 web_data_service_->Shutdown(); |
865 } | 865 } |
OLD | NEW |