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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 419 } |
420 } | 420 } |
421 | 421 |
422 void TestingProfile::Init() { | 422 void TestingProfile::Init() { |
423 base::ThreadRestrictions::ScopedAllowIO allow_io; | 423 base::ThreadRestrictions::ScopedAllowIO allow_io; |
424 // If threads have been initialized, we should be on the UI thread. | 424 // If threads have been initialized, we should be on the UI thread. |
425 DCHECK(!content::BrowserThread::IsThreadInitialized( | 425 DCHECK(!content::BrowserThread::IsThreadInitialized( |
426 content::BrowserThread::UI) || | 426 content::BrowserThread::UI) || |
427 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 427 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
428 | 428 |
| 429 #if defined(OS_CHROMEOS) |
| 430 if (!chromeos::DeviceSettingsService::IsInitialized()) |
| 431 test_device_settings_.reset(new chromeos::ScopedTestDeviceSettingsService); |
| 432 |
| 433 if (!chromeos::CrosSettings::IsInitialized()) |
| 434 test_cros_settings_.reset(new chromeos::ScopedTestCrosSettings); |
| 435 #endif |
| 436 |
429 set_is_guest_profile(guest_session_); | 437 set_is_guest_profile(guest_session_); |
430 | 438 |
431 BrowserContext::Initialize(this, profile_path_); | 439 BrowserContext::Initialize(this, profile_path_); |
432 | 440 |
433 browser_context_dependency_manager_->MarkBrowserContextLive(this); | 441 browser_context_dependency_manager_->MarkBrowserContextLive(this); |
434 | 442 |
435 #if defined(OS_ANDROID) | 443 #if defined(OS_ANDROID) |
436 // Make sure token service knows its running in tests. | 444 // Make sure token service knows its running in tests. |
437 OAuth2TokenServiceDelegateAndroid::set_is_testing_profile(); | 445 OAuth2TokenServiceDelegateAndroid::set_is_testing_profile(); |
438 #endif | 446 #endif |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 // Note: Owned by |original_profile|. | 1107 // Note: Owned by |original_profile|. |
1100 return new TestingProfile(path_, delegate_, | 1108 return new TestingProfile(path_, delegate_, |
1101 #if BUILDFLAG(ENABLE_EXTENSIONS) | 1109 #if BUILDFLAG(ENABLE_EXTENSIONS) |
1102 extension_policy_, | 1110 extension_policy_, |
1103 #endif | 1111 #endif |
1104 std::move(pref_service_), original_profile, | 1112 std::move(pref_service_), original_profile, |
1105 guest_session_, supervised_user_id_, | 1113 guest_session_, supervised_user_id_, |
1106 std::move(policy_service_), testing_factories_, | 1114 std::move(policy_service_), testing_factories_, |
1107 profile_name_); | 1115 profile_name_); |
1108 } | 1116 } |
OLD | NEW |