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 "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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 #include "testing/gmock/include/gmock/gmock.h" | 70 #include "testing/gmock/include/gmock/gmock.h" |
71 | 71 |
72 #if defined(ENABLE_CONFIGURATION_POLICY) | 72 #if defined(ENABLE_CONFIGURATION_POLICY) |
73 #include "chrome/browser/policy/policy_service_impl.h" | 73 #include "chrome/browser/policy/policy_service_impl.h" |
74 #else | 74 #else |
75 #include "chrome/browser/policy/policy_service_stub.h" | 75 #include "chrome/browser/policy/policy_service_stub.h" |
76 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 76 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
77 | 77 |
78 #if defined(OS_CHROMEOS) | 78 #if defined(OS_CHROMEOS) |
79 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 79 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 80 #include "chromeos/dbus/dbus_thread_manager.h" |
80 #endif // defined(OS_CHROMEOS) | 81 #endif // defined(OS_CHROMEOS) |
81 | 82 |
82 using base::Time; | 83 using base::Time; |
83 using content::BrowserThread; | 84 using content::BrowserThread; |
84 using content::DownloadManagerDelegate; | 85 using content::DownloadManagerDelegate; |
85 using testing::NiceMock; | 86 using testing::NiceMock; |
86 using testing::Return; | 87 using testing::Return; |
87 | 88 |
88 namespace { | 89 namespace { |
89 | 90 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // That shouldn't happen, but if it does, try to recover. | 266 // That shouldn't happen, but if it does, try to recover. |
266 LOG(ERROR) << "Failed to use a fallback temporary directory."; | 267 LOG(ERROR) << "Failed to use a fallback temporary directory."; |
267 | 268 |
268 // We're screwed if this fails, see CHECK above. | 269 // We're screwed if this fails, see CHECK above. |
269 CHECK(temp_dir_.Set(system_tmp_dir)); | 270 CHECK(temp_dir_.Set(system_tmp_dir)); |
270 } | 271 } |
271 } | 272 } |
272 } | 273 } |
273 | 274 |
274 void TestingProfile::Init() { | 275 void TestingProfile::Init() { |
| 276 #if defined(OS_CHROMEOS) |
| 277 chromeos::DBusThreadManager::Initialize(); |
| 278 #endif |
275 if (prefs_.get()) | 279 if (prefs_.get()) |
276 components::UserPrefs::Set(this, prefs_.get()); | 280 components::UserPrefs::Set(this, prefs_.get()); |
277 | 281 |
278 if (!file_util::PathExists(profile_path_)) | 282 if (!file_util::PathExists(profile_path_)) |
279 file_util::CreateDirectory(profile_path_); | 283 file_util::CreateDirectory(profile_path_); |
280 | 284 |
281 extensions::ExtensionSystemFactory::GetInstance()->SetTestingFactory( | 285 extensions::ExtensionSystemFactory::GetInstance()->SetTestingFactory( |
282 this, extensions::TestExtensionSystem::Build); | 286 this, extensions::TestExtensionSystem::Build); |
283 | 287 |
284 profile_dependency_manager_->CreateProfileServices(this, true); | 288 profile_dependency_manager_->CreateProfileServices(this, true); |
(...skipping 10 matching lines...) Expand all Loading... |
295 content::NotificationService::current()->Notify( | 299 content::NotificationService::current()->Notify( |
296 chrome::NOTIFICATION_PROFILE_CREATED, | 300 chrome::NOTIFICATION_PROFILE_CREATED, |
297 content::Source<Profile>(static_cast<Profile*>(this)), | 301 content::Source<Profile>(static_cast<Profile*>(this)), |
298 content::NotificationService::NoDetails()); | 302 content::NotificationService::NoDetails()); |
299 | 303 |
300 if (delegate_) | 304 if (delegate_) |
301 delegate_->OnProfileCreated(this, true, false); | 305 delegate_->OnProfileCreated(this, true, false); |
302 } | 306 } |
303 | 307 |
304 TestingProfile::~TestingProfile() { | 308 TestingProfile::~TestingProfile() { |
| 309 #if defined(OS_CHROMEOS) |
| 310 chromeos::DBusThreadManager::Shutdown(); |
| 311 #endif |
305 MaybeSendDestroyedNotification(); | 312 MaybeSendDestroyedNotification(); |
306 | 313 |
307 profile_dependency_manager_->DestroyProfileServices(this); | 314 profile_dependency_manager_->DestroyProfileServices(this); |
308 | 315 |
309 if (host_content_settings_map_) | 316 if (host_content_settings_map_) |
310 host_content_settings_map_->ShutdownOnUIThread(); | 317 host_content_settings_map_->ShutdownOnUIThread(); |
311 | 318 |
312 DestroyTopSites(); | 319 DestroyTopSites(); |
313 | 320 |
314 if (pref_proxy_config_tracker_.get()) | 321 if (pref_proxy_config_tracker_.get()) |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 786 |
780 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 787 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
781 DCHECK(!build_called_); | 788 DCHECK(!build_called_); |
782 build_called_ = true; | 789 build_called_ = true; |
783 return scoped_ptr<TestingProfile>(new TestingProfile( | 790 return scoped_ptr<TestingProfile>(new TestingProfile( |
784 path_, | 791 path_, |
785 delegate_, | 792 delegate_, |
786 extension_policy_, | 793 extension_policy_, |
787 pref_service_.Pass())); | 794 pref_service_.Pass())); |
788 } | 795 } |
OLD | NEW |