| 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 "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 path = path.Append(history::kHistoryFilename); | 562 path = path.Append(history::kHistoryFilename); |
| 563 if (!base::DeleteFile(path, false) || base::PathExists(path)) | 563 if (!base::DeleteFile(path, false) || base::PathExists(path)) |
| 564 return false; | 564 return false; |
| 565 } | 565 } |
| 566 // This will create and init the history service. | 566 // This will create and init the history service. |
| 567 HistoryService* history_service = static_cast<HistoryService*>( | 567 HistoryService* history_service = static_cast<HistoryService*>( |
| 568 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 568 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
| 569 this, BuildHistoryService)); | 569 this, BuildHistoryService)); |
| 570 if (!history_service->Init( | 570 if (!history_service->Init( |
| 571 no_db, history::HistoryDatabaseParamsForPath(this->GetPath()))) { | 571 no_db, history::HistoryDatabaseParamsForPath(this->GetPath()))) { |
| 572 HistoryServiceFactory::GetInstance()->SetTestingFactoryAndUse(this, NULL); | 572 HistoryServiceFactory::GetInstance()->SetTestingFactory(this, nullptr); |
| 573 return false; |
| 573 } | 574 } |
| 574 // Disable WebHistoryService by default, since it makes network requests. | 575 // Disable WebHistoryService by default, since it makes network requests. |
| 575 WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, NULL); | 576 WebHistoryServiceFactory::GetInstance()->SetTestingFactory(this, nullptr); |
| 576 return true; | 577 return true; |
| 577 } | 578 } |
| 578 | 579 |
| 579 void TestingProfile::DestroyHistoryService() { | 580 void TestingProfile::DestroyHistoryService() { |
| 580 // TODO(sdefresne): remove this once ChromeHistoryClient is no longer an | |
| 581 // HistoryServiceObserver, http://crbug.com/373326 | |
| 582 ChromeHistoryClient* history_client = | |
| 583 ChromeHistoryClientFactory::GetForProfileWithoutCreating(this); | |
| 584 if (history_client) | |
| 585 history_client->Shutdown(); | |
| 586 | |
| 587 HistoryService* history_service = | 581 HistoryService* history_service = |
| 588 HistoryServiceFactory::GetForProfileWithoutCreating(this); | 582 HistoryServiceFactory::GetForProfileWithoutCreating(this); |
| 589 if (!history_service) | 583 if (!history_service) |
| 590 return; | 584 return; |
| 591 | 585 |
| 592 history_service->ClearCachedDataForContextID(0); | 586 history_service->ClearCachedDataForContextID(0); |
| 593 history_service->SetOnBackendDestroyTask(base::MessageLoop::QuitClosure()); | 587 history_service->SetOnBackendDestroyTask(base::MessageLoop::QuitClosure()); |
| 594 history_service->Cleanup(); | 588 history_service->Cleanup(); |
| 595 HistoryServiceFactory::ShutdownForProfile(this); | 589 HistoryServiceFactory::ShutdownForProfile(this); |
| 596 | 590 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 #if defined(ENABLE_EXTENSIONS) | 1083 #if defined(ENABLE_EXTENSIONS) |
| 1090 extension_policy_, | 1084 extension_policy_, |
| 1091 #endif | 1085 #endif |
| 1092 pref_service_.Pass(), | 1086 pref_service_.Pass(), |
| 1093 original_profile, | 1087 original_profile, |
| 1094 guest_session_, | 1088 guest_session_, |
| 1095 supervised_user_id_, | 1089 supervised_user_id_, |
| 1096 policy_service_.Pass(), | 1090 policy_service_.Pass(), |
| 1097 testing_factories_); | 1091 testing_factories_); |
| 1098 } | 1092 } |
| OLD | NEW |