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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 286 // If threads have been initialized, we should be on the UI thread. |
287 DCHECK( | 287 DCHECK(!content::BrowserThread::IsThreadInitialized( |
288 !content::BrowserThread::IsWellKnownThread(content::BrowserThread::UI) || | 288 content::BrowserThread::UI) || |
289 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 289 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
290 | 290 |
291 // Normally this would happen during browser startup, but for tests | 291 // Normally this would happen during browser startup, but for tests |
292 // we need to trigger creation of Profile-related services. | 292 // we need to trigger creation of Profile-related services. |
293 ChromeBrowserMainExtraPartsProfiles:: | 293 ChromeBrowserMainExtraPartsProfiles:: |
294 EnsureBrowserContextKeyedServiceFactoriesBuilt(); | 294 EnsureBrowserContextKeyedServiceFactoriesBuilt(); |
295 | 295 |
296 if (prefs_.get()) | 296 if (prefs_.get()) |
297 user_prefs::UserPrefs::Set(this, prefs_.get()); | 297 user_prefs::UserPrefs::Set(this, prefs_.get()); |
298 else | 298 else |
299 CreateTestingPrefService(); | 299 CreateTestingPrefService(); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 | 823 |
824 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { | 824 scoped_ptr<TestingProfile> TestingProfile::Builder::Build() { |
825 DCHECK(!build_called_); | 825 DCHECK(!build_called_); |
826 build_called_ = true; | 826 build_called_ = true; |
827 return scoped_ptr<TestingProfile>(new TestingProfile( | 827 return scoped_ptr<TestingProfile>(new TestingProfile( |
828 path_, | 828 path_, |
829 delegate_, | 829 delegate_, |
830 extension_policy_, | 830 extension_policy_, |
831 pref_service_.Pass())); | 831 pref_service_.Pass())); |
832 } | 832 } |
OLD | NEW |