| 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 281 } |
| 282 } | 282 } |
| 283 | 283 |
| 284 void TestingProfile::Init() { | 284 void TestingProfile::Init() { |
| 285 // Normally this would happen during browser startup, but for tests | 285 // Normally this would happen during browser startup, but for tests |
| 286 // we need to trigger creation of Profile-related services. | 286 // we need to trigger creation of Profile-related services. |
| 287 ChromeBrowserMainExtraPartsProfiles:: | 287 ChromeBrowserMainExtraPartsProfiles:: |
| 288 EnsureBrowserContextKeyedServiceFactoriesBuilt(); | 288 EnsureBrowserContextKeyedServiceFactoriesBuilt(); |
| 289 | 289 |
| 290 if (prefs_.get()) | 290 if (prefs_.get()) |
| 291 components::UserPrefs::Set(this, prefs_.get()); | 291 user_prefs::UserPrefs::Set(this, prefs_.get()); |
| 292 else | 292 else |
| 293 CreateTestingPrefService(); | 293 CreateTestingPrefService(); |
| 294 | 294 |
| 295 if (!file_util::PathExists(profile_path_)) | 295 if (!file_util::PathExists(profile_path_)) |
| 296 file_util::CreateDirectory(profile_path_); | 296 file_util::CreateDirectory(profile_path_); |
| 297 | 297 |
| 298 // TODO(joaodasilva): remove this once this PKS isn't created in ProfileImpl | 298 // TODO(joaodasilva): remove this once this PKS isn't created in ProfileImpl |
| 299 // anymore, after converting the PrefService to a PKS. Until then it must | 299 // anymore, after converting the PrefService to a PKS. Until then it must |
| 300 // be associated with a TestingProfile too. | 300 // be associated with a TestingProfile too. |
| 301 CreateProfilePolicyConnector(); | 301 CreateProfilePolicyConnector(); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 if (!GetRequestContext()) | 552 if (!GetRequestContext()) |
| 553 return NULL; | 553 return NULL; |
| 554 return GetRequestContext()->GetURLRequestContext()->cookie_store()-> | 554 return GetRequestContext()->GetURLRequestContext()->cookie_store()-> |
| 555 GetCookieMonster(); | 555 GetCookieMonster(); |
| 556 } | 556 } |
| 557 | 557 |
| 558 void TestingProfile::CreateTestingPrefService() { | 558 void TestingProfile::CreateTestingPrefService() { |
| 559 DCHECK(!prefs_.get()); | 559 DCHECK(!prefs_.get()); |
| 560 testing_prefs_ = new TestingPrefServiceSyncable(); | 560 testing_prefs_ = new TestingPrefServiceSyncable(); |
| 561 prefs_.reset(testing_prefs_); | 561 prefs_.reset(testing_prefs_); |
| 562 components::UserPrefs::Set(this, prefs_.get()); | 562 user_prefs::UserPrefs::Set(this, prefs_.get()); |
| 563 chrome::RegisterUserPrefs(testing_prefs_->registry()); | 563 chrome::RegisterUserPrefs(testing_prefs_->registry()); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void TestingProfile::CreateProfilePolicyConnector() { | 566 void TestingProfile::CreateProfilePolicyConnector() { |
| 567 scoped_ptr<policy::PolicyService> service; | 567 scoped_ptr<policy::PolicyService> service; |
| 568 #if defined(ENABLE_CONFIGURATION_POLICY) | 568 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 569 std::vector<policy::ConfigurationPolicyProvider*> providers; | 569 std::vector<policy::ConfigurationPolicyProvider*> providers; |
| 570 service.reset(new policy::PolicyServiceImpl(providers)); | 570 service.reset(new policy::PolicyServiceImpl(providers)); |
| 571 #else | 571 #else |
| 572 service.reset(new policy::PolicyServiceStub()); | 572 service.reset(new policy::PolicyServiceStub()); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 | 807 |
| 808 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 808 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
| 809 DCHECK(!build_called_); | 809 DCHECK(!build_called_); |
| 810 build_called_ = true; | 810 build_called_ = true; |
| 811 return scoped_ptr<TestingProfile>(new TestingProfile( | 811 return scoped_ptr<TestingProfile>(new TestingProfile( |
| 812 path_, | 812 path_, |
| 813 delegate_, | 813 delegate_, |
| 814 extension_policy_, | 814 extension_policy_, |
| 815 pref_service_.Pass())); | 815 pref_service_.Pass())); |
| 816 } | 816 } |
| OLD | NEW |