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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // That shouldn't happen, but if it does, try to recover. | 276 // That shouldn't happen, but if it does, try to recover. |
277 LOG(ERROR) << "Failed to use a fallback temporary directory."; | 277 LOG(ERROR) << "Failed to use a fallback temporary directory."; |
278 | 278 |
279 // We're screwed if this fails, see CHECK above. | 279 // We're screwed if this fails, see CHECK above. |
280 CHECK(temp_dir_.Set(system_tmp_dir)); | 280 CHECK(temp_dir_.Set(system_tmp_dir)); |
281 } | 281 } |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 void TestingProfile::Init() { | 285 void TestingProfile::Init() { |
| 286 // If threads have been initialized, we should be on the UI thread. |
| 287 DCHECK( |
| 288 !content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) || |
| 289 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 290 |
286 // Normally this would happen during browser startup, but for tests | 291 // Normally this would happen during browser startup, but for tests |
287 // we need to trigger creation of Profile-related services. | 292 // we need to trigger creation of Profile-related services. |
288 ChromeBrowserMainExtraPartsProfiles:: | 293 ChromeBrowserMainExtraPartsProfiles:: |
289 EnsureBrowserContextKeyedServiceFactoriesBuilt(); | 294 EnsureBrowserContextKeyedServiceFactoriesBuilt(); |
290 | 295 |
291 if (prefs_.get()) | 296 if (prefs_.get()) |
292 user_prefs::UserPrefs::Set(this, prefs_.get()); | 297 user_prefs::UserPrefs::Set(this, prefs_.get()); |
293 else | 298 else |
294 CreateTestingPrefService(); | 299 CreateTestingPrefService(); |
295 | 300 |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 | 822 |
818 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 823 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
819 DCHECK(!build_called_); | 824 DCHECK(!build_called_); |
820 build_called_ = true; | 825 build_called_ = true; |
821 return scoped_ptr<TestingProfile>(new TestingProfile( | 826 return scoped_ptr<TestingProfile>(new TestingProfile( |
822 path_, | 827 path_, |
823 delegate_, | 828 delegate_, |
824 extension_policy_, | 829 extension_policy_, |
825 pref_service_.Pass())); | 830 pref_service_.Pass())); |
826 } | 831 } |
OLD | NEW |