| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 base::MessageLoop::QuitClosure()); | 524 base::MessageLoop::QuitClosure()); |
| 525 base::MessageLoop::current()->Run(); | 525 base::MessageLoop::current()->Run(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 void TestingProfile::CreateTopSites() { | 528 void TestingProfile::CreateTopSites() { |
| 529 DestroyTopSites(); | 529 DestroyTopSites(); |
| 530 top_sites_ = history::TopSites::Create( | 530 top_sites_ = history::TopSites::Create( |
| 531 this, GetPath().Append(chrome::kTopSitesFilename)); | 531 this, GetPath().Append(chrome::kTopSitesFilename)); |
| 532 } | 532 } |
| 533 | 533 |
| 534 void TestingProfile::SetTopSites(history::TopSites* top_sites) { |
| 535 DestroyTopSites(); |
| 536 top_sites_ = top_sites; |
| 537 } |
| 538 |
| 534 void TestingProfile::DestroyTopSites() { | 539 void TestingProfile::DestroyTopSites() { |
| 535 if (top_sites_.get()) { | 540 if (top_sites_.get()) { |
| 536 top_sites_->Shutdown(); | 541 top_sites_->Shutdown(); |
| 537 top_sites_ = NULL; | 542 top_sites_ = NULL; |
| 538 // TopSitesImpl::Shutdown schedules some tasks (from TopSitesBackend) that | 543 // TopSitesImpl::Shutdown schedules some tasks (from TopSitesBackend) that |
| 539 // need to be run to properly shutdown. Run all pending tasks now. This is | 544 // need to be run to properly shutdown. Run all pending tasks now. This is |
| 540 // normally handled by browser_process shutdown. | 545 // normally handled by browser_process shutdown. |
| 541 if (base::MessageLoop::current()) | 546 if (base::MessageLoop::current()) |
| 542 base::MessageLoop::current()->RunUntilIdle(); | 547 base::MessageLoop::current()->RunUntilIdle(); |
| 543 } | 548 } |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 #if defined(ENABLE_EXTENSIONS) | 1035 #if defined(ENABLE_EXTENSIONS) |
| 1031 extension_policy_, | 1036 extension_policy_, |
| 1032 #endif | 1037 #endif |
| 1033 pref_service_.Pass(), | 1038 pref_service_.Pass(), |
| 1034 original_profile, | 1039 original_profile, |
| 1035 guest_session_, | 1040 guest_session_, |
| 1036 supervised_user_id_, | 1041 supervised_user_id_, |
| 1037 policy_service_.Pass(), | 1042 policy_service_.Pass(), |
| 1038 testing_factories_); | 1043 testing_factories_); |
| 1039 } | 1044 } |
| OLD | NEW |