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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #include "net/url_request/url_request_test_util.h" | 74 #include "net/url_request/url_request_test_util.h" |
75 #include "testing/gmock/include/gmock/gmock.h" | 75 #include "testing/gmock/include/gmock/gmock.h" |
76 | 76 |
77 #if defined(ENABLE_CONFIGURATION_POLICY) | 77 #if defined(ENABLE_CONFIGURATION_POLICY) |
78 #include "chrome/browser/policy/configuration_policy_provider.h" | 78 #include "chrome/browser/policy/configuration_policy_provider.h" |
79 #include "chrome/browser/policy/policy_service_impl.h" | 79 #include "chrome/browser/policy/policy_service_impl.h" |
80 #else | 80 #else |
81 #include "chrome/browser/policy/policy_service_stub.h" | 81 #include "chrome/browser/policy/policy_service_stub.h" |
82 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 82 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
83 | 83 |
| 84 #if defined(ENABLE_MANAGED_USERS) |
| 85 #include "chrome/browser/managed_mode/managed_user_settings_service.h" |
| 86 #include "chrome/browser/managed_mode/managed_user_settings_service_factory.h" |
| 87 #endif |
| 88 |
84 using base::Time; | 89 using base::Time; |
85 using content::BrowserThread; | 90 using content::BrowserThread; |
86 using content::DownloadManagerDelegate; | 91 using content::DownloadManagerDelegate; |
87 using testing::NiceMock; | 92 using testing::NiceMock; |
88 using testing::Return; | 93 using testing::Return; |
89 | 94 |
90 namespace { | 95 namespace { |
91 | 96 |
92 // Task used to make sure history has finished processing a request. Intended | 97 // Task used to make sure history has finished processing a request. Intended |
93 // for use with BlockUntilHistoryProcessesPendingRequests. | 98 // for use with BlockUntilHistoryProcessesPendingRequests. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // force preferences to be registered - this allows tests to create a | 330 // force preferences to be registered - this allows tests to create a |
326 // standalone incognito profile while still having prefs registered. | 331 // standalone incognito profile while still having prefs registered. |
327 browser_context_dependency_manager_->CreateBrowserContextServicesForTest( | 332 browser_context_dependency_manager_->CreateBrowserContextServicesForTest( |
328 this, !original_profile_); | 333 this, !original_profile_); |
329 | 334 |
330 #if defined(ENABLE_NOTIFICATIONS) | 335 #if defined(ENABLE_NOTIFICATIONS) |
331 // Install profile keyed service factory hooks for dummy/test services | 336 // Install profile keyed service factory hooks for dummy/test services |
332 DesktopNotificationServiceFactory::GetInstance()->SetTestingFactory( | 337 DesktopNotificationServiceFactory::GetInstance()->SetTestingFactory( |
333 this, CreateTestDesktopNotificationService); | 338 this, CreateTestDesktopNotificationService); |
334 #endif | 339 #endif |
| 340 |
| 341 #if defined(ENABLE_MANAGED_USERS) |
| 342 ManagedUserSettingsService* settings_service = |
| 343 ManagedUserSettingsServiceFactory::GetForProfile(this); |
| 344 TestingPrefStore* store = new TestingPrefStore(); |
| 345 settings_service->Init(store); |
| 346 store->SetInitializationCompleted(); |
| 347 #endif |
335 } | 348 } |
336 | 349 |
337 void TestingProfile::FinishInit() { | 350 void TestingProfile::FinishInit() { |
338 DCHECK(content::NotificationService::current()); | 351 DCHECK(content::NotificationService::current()); |
339 content::NotificationService::current()->Notify( | 352 content::NotificationService::current()->Notify( |
340 chrome::NOTIFICATION_PROFILE_CREATED, | 353 chrome::NOTIFICATION_PROFILE_CREATED, |
341 content::Source<Profile>(static_cast<Profile*>(this)), | 354 content::Source<Profile>(static_cast<Profile*>(this)), |
342 content::NotificationService::NoDetails()); | 355 content::NotificationService::NoDetails()); |
343 | 356 |
344 if (delegate_) | 357 if (delegate_) |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 DCHECK(!build_called_); | 869 DCHECK(!build_called_); |
857 build_called_ = true; | 870 build_called_ = true; |
858 return scoped_ptr<TestingProfile>(new TestingProfile( | 871 return scoped_ptr<TestingProfile>(new TestingProfile( |
859 path_, | 872 path_, |
860 delegate_, | 873 delegate_, |
861 extension_policy_, | 874 extension_policy_, |
862 pref_service_.Pass(), | 875 pref_service_.Pass(), |
863 incognito_, | 876 incognito_, |
864 testing_factories_)); | 877 testing_factories_)); |
865 } | 878 } |
OLD | NEW |