OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 static ProfileKeyedService* BuildTemplateURLService(Profile* profile) { | 339 static ProfileKeyedService* BuildTemplateURLService(Profile* profile) { |
340 return new TemplateURLService(profile); | 340 return new TemplateURLService(profile); |
341 } | 341 } |
342 | 342 |
343 void TestingProfile::CreateTemplateURLService() { | 343 void TestingProfile::CreateTemplateURLService() { |
344 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 344 TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
345 this, BuildTemplateURLService); | 345 this, BuildTemplateURLService); |
346 } | 346 } |
347 | 347 |
| 348 void TestingProfile::BlockUntilTemplateURLServiceLoaded() { |
| 349 TemplateURLService* turl_model = |
| 350 TemplateURLServiceFactory::GetForProfile(this); |
| 351 if (turl_model->loaded()) |
| 352 return; |
| 353 |
| 354 ui_test_utils::WindowedNotificationObserver turl_service_load_observer( |
| 355 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, |
| 356 content::NotificationService::AllSources()); |
| 357 turl_model->Load(); |
| 358 turl_service_load_observer.Wait(); |
| 359 } |
| 360 |
348 void TestingProfile::CreateExtensionProcessManager() { | 361 void TestingProfile::CreateExtensionProcessManager() { |
349 extension_process_manager_.reset(ExtensionProcessManager::Create(this)); | 362 extension_process_manager_.reset(ExtensionProcessManager::Create(this)); |
350 } | 363 } |
351 | 364 |
352 ExtensionService* TestingProfile::CreateExtensionService( | 365 ExtensionService* TestingProfile::CreateExtensionService( |
353 const CommandLine* command_line, | 366 const CommandLine* command_line, |
354 const FilePath& install_directory, | 367 const FilePath& install_directory, |
355 bool autoupdate_enabled) { | 368 bool autoupdate_enabled) { |
356 // Extension pref store, created for use by |extension_prefs_|. | 369 // Extension pref store, created for use by |extension_prefs_|. |
357 | 370 |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { | 822 quota::SpecialStoragePolicy* TestingProfile::GetSpecialStoragePolicy() { |
810 return GetExtensionSpecialStoragePolicy(); | 823 return GetExtensionSpecialStoragePolicy(); |
811 } | 824 } |
812 | 825 |
813 void TestingProfile::DestroyWebDataService() { | 826 void TestingProfile::DestroyWebDataService() { |
814 if (!web_data_service_.get()) | 827 if (!web_data_service_.get()) |
815 return; | 828 return; |
816 | 829 |
817 web_data_service_->Shutdown(); | 830 web_data_service_->Shutdown(); |
818 } | 831 } |
OLD | NEW |