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 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/history/top_sites.h" | 37 #include "chrome/browser/history/top_sites.h" |
38 #include "chrome/browser/history/web_history_service_factory.h" | 38 #include "chrome/browser/history/web_history_service_factory.h" |
39 #include "chrome/browser/net/proxy_service_factory.h" | 39 #include "chrome/browser/net/proxy_service_factory.h" |
40 #include "chrome/browser/notifications/desktop_notification_service.h" | 40 #include "chrome/browser/notifications/desktop_notification_service.h" |
41 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 41 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
42 #include "chrome/browser/policy/profile_policy_connector.h" | 42 #include "chrome/browser/policy/profile_policy_connector.h" |
43 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 43 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
44 #include "chrome/browser/prefs/browser_prefs.h" | 44 #include "chrome/browser/prefs/browser_prefs.h" |
45 #include "chrome/browser/prefs/pref_service_syncable.h" | 45 #include "chrome/browser/prefs/pref_service_syncable.h" |
46 #include "chrome/browser/prerender/prerender_manager.h" | 46 #include "chrome/browser/prerender/prerender_manager.h" |
| 47 #include "chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.h" |
47 #include "chrome/browser/profiles/profile_dependency_manager.h" | 48 #include "chrome/browser/profiles/profile_dependency_manager.h" |
48 #include "chrome/browser/profiles/storage_partition_descriptor.h" | 49 #include "chrome/browser/profiles/storage_partition_descriptor.h" |
49 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" | 50 #include "chrome/browser/search_engines/template_url_fetcher_factory.h" |
50 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" | 51 #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" |
51 #include "chrome/browser/webdata/web_data_service.h" | 52 #include "chrome/browser/webdata/web_data_service.h" |
52 #include "chrome/browser/webdata/web_data_service_factory.h" | 53 #include "chrome/browser/webdata/web_data_service_factory.h" |
53 #include "chrome/common/chrome_constants.h" | 54 #include "chrome/common/chrome_constants.h" |
54 #include "chrome/common/chrome_notification_types.h" | 55 #include "chrome/common/chrome_notification_types.h" |
55 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
56 #include "chrome/common/url_constants.h" | 57 #include "chrome/common/url_constants.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // That shouldn't happen, but if it does, try to recover. | 271 // That shouldn't happen, but if it does, try to recover. |
271 LOG(ERROR) << "Failed to use a fallback temporary directory."; | 272 LOG(ERROR) << "Failed to use a fallback temporary directory."; |
272 | 273 |
273 // We're screwed if this fails, see CHECK above. | 274 // We're screwed if this fails, see CHECK above. |
274 CHECK(temp_dir_.Set(system_tmp_dir)); | 275 CHECK(temp_dir_.Set(system_tmp_dir)); |
275 } | 276 } |
276 } | 277 } |
277 } | 278 } |
278 | 279 |
279 void TestingProfile::Init() { | 280 void TestingProfile::Init() { |
| 281 // Normally this would happen during browser startup, but for tests |
| 282 // we need to trigger creation of Profile-related services. |
| 283 ChromeBrowserMainExtraPartsProfiles:: |
| 284 EnsureProfileKeyedServiceFactoriesBuilt(); |
| 285 |
280 if (prefs_.get()) | 286 if (prefs_.get()) |
281 components::UserPrefs::Set(this, prefs_.get()); | 287 components::UserPrefs::Set(this, prefs_.get()); |
282 else | 288 else |
283 CreateTestingPrefService(); | 289 CreateTestingPrefService(); |
284 | 290 |
285 if (!file_util::PathExists(profile_path_)) | 291 if (!file_util::PathExists(profile_path_)) |
286 file_util::CreateDirectory(profile_path_); | 292 file_util::CreateDirectory(profile_path_); |
287 | 293 |
288 // TODO(joaodasilva): remove this once this PKS isn't created in ProfileImpl | 294 // TODO(joaodasilva): remove this once this PKS isn't created in ProfileImpl |
289 // anymore, after converting the PrefService to a PKS. Until then it must | 295 // anymore, after converting the PrefService to a PKS. Until then it must |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 803 |
798 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 804 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
799 DCHECK(!build_called_); | 805 DCHECK(!build_called_); |
800 build_called_ = true; | 806 build_called_ = true; |
801 return scoped_ptr<TestingProfile>(new TestingProfile( | 807 return scoped_ptr<TestingProfile>(new TestingProfile( |
802 path_, | 808 path_, |
803 delegate_, | 809 delegate_, |
804 extension_policy_, | 810 extension_policy_, |
805 pref_service_.Pass())); | 811 pref_service_.Pass())); |
806 } | 812 } |
OLD | NEW |