| 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/test/base/testing_profile.h" | 5 #include "chrome/test/base/testing_profile.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 history_service->ClearCachedDataForContextID(0); | 571 history_service->ClearCachedDataForContextID(0); |
| 572 history_service->SetOnBackendDestroyTask( | 572 history_service->SetOnBackendDestroyTask( |
| 573 base::MessageLoop::QuitWhenIdleClosure()); | 573 base::MessageLoop::QuitWhenIdleClosure()); |
| 574 history_service->Cleanup(); | 574 history_service->Cleanup(); |
| 575 HistoryServiceFactory::ShutdownForProfile(this); | 575 HistoryServiceFactory::ShutdownForProfile(this); |
| 576 | 576 |
| 577 // Wait for the backend class to terminate before deleting the files and | 577 // Wait for the backend class to terminate before deleting the files and |
| 578 // moving to the next test. Note: if this never terminates, somebody is | 578 // moving to the next test. Note: if this never terminates, somebody is |
| 579 // probably leaking a reference to the history backend, so it never calls | 579 // probably leaking a reference to the history backend, so it never calls |
| 580 // our destroy task. | 580 // our destroy task. |
| 581 base::MessageLoop::current()->Run(); | 581 base::RunLoop().Run(); |
| 582 | 582 |
| 583 // Make sure we don't have any event pending that could disrupt the next | 583 // Make sure we don't have any event pending that could disrupt the next |
| 584 // test. | 584 // test. |
| 585 base::ThreadTaskRunnerHandle::Get()->PostTask( | 585 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 586 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 586 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 587 base::MessageLoop::current()->Run(); | 587 base::RunLoop().Run(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 void TestingProfile::CreateBookmarkModel(bool delete_file) { | 590 void TestingProfile::CreateBookmarkModel(bool delete_file) { |
| 591 if (delete_file) { | 591 if (delete_file) { |
| 592 base::FilePath path = GetPath().Append(bookmarks::kBookmarksFileName); | 592 base::FilePath path = GetPath().Append(bookmarks::kBookmarksFileName); |
| 593 base::DeleteFile(path, false); | 593 base::DeleteFile(path, false); |
| 594 } | 594 } |
| 595 ManagedBookmarkServiceFactory::GetInstance()->SetTestingFactory( | 595 ManagedBookmarkServiceFactory::GetInstance()->SetTestingFactory( |
| 596 this, ManagedBookmarkServiceFactory::GetDefaultFactory()); | 596 this, ManagedBookmarkServiceFactory::GetDefaultFactory()); |
| 597 // This creates the BookmarkModel. | 597 // This creates the BookmarkModel. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 history::HistoryService* history_service = | 860 history::HistoryService* history_service = |
| 861 HistoryServiceFactory::GetForProfile(this, | 861 HistoryServiceFactory::GetForProfile(this, |
| 862 ServiceAccessType::EXPLICIT_ACCESS); | 862 ServiceAccessType::EXPLICIT_ACCESS); |
| 863 DCHECK(history_service); | 863 DCHECK(history_service); |
| 864 DCHECK(base::MessageLoop::current()); | 864 DCHECK(base::MessageLoop::current()); |
| 865 | 865 |
| 866 base::CancelableTaskTracker tracker; | 866 base::CancelableTaskTracker tracker; |
| 867 history_service->ScheduleDBTask( | 867 history_service->ScheduleDBTask( |
| 868 std::unique_ptr<history::HistoryDBTask>(new QuittingHistoryDBTask()), | 868 std::unique_ptr<history::HistoryDBTask>(new QuittingHistoryDBTask()), |
| 869 &tracker); | 869 &tracker); |
| 870 base::MessageLoop::current()->Run(); | 870 base::RunLoop().Run(); |
| 871 } | 871 } |
| 872 | 872 |
| 873 chrome_browser_net::Predictor* TestingProfile::GetNetworkPredictor() { | 873 chrome_browser_net::Predictor* TestingProfile::GetNetworkPredictor() { |
| 874 return NULL; | 874 return NULL; |
| 875 } | 875 } |
| 876 | 876 |
| 877 DevToolsNetworkControllerHandle* | 877 DevToolsNetworkControllerHandle* |
| 878 TestingProfile::GetDevToolsNetworkControllerHandle() { | 878 TestingProfile::GetDevToolsNetworkControllerHandle() { |
| 879 return NULL; | 879 return NULL; |
| 880 } | 880 } |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 // Note: Owned by |original_profile|. | 1032 // Note: Owned by |original_profile|. |
| 1033 return new TestingProfile(path_, delegate_, | 1033 return new TestingProfile(path_, delegate_, |
| 1034 #if defined(ENABLE_EXTENSIONS) | 1034 #if defined(ENABLE_EXTENSIONS) |
| 1035 extension_policy_, | 1035 extension_policy_, |
| 1036 #endif | 1036 #endif |
| 1037 std::move(pref_service_), original_profile, | 1037 std::move(pref_service_), original_profile, |
| 1038 guest_session_, supervised_user_id_, | 1038 guest_session_, supervised_user_id_, |
| 1039 std::move(policy_service_), testing_factories_, | 1039 std::move(policy_service_), testing_factories_, |
| 1040 profile_name_); | 1040 profile_name_); |
| 1041 } | 1041 } |
| OLD | NEW |