| 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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/run_loop.h" |
| 14 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 16 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model.h" | 17 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| 18 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/content_settings/host_content_settings_map.h" | 20 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 20 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 21 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 23 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 23 #include "chrome/browser/extensions/extension_system.h" | 24 #include "chrome/browser/extensions/extension_system.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 | 372 |
| 372 void TestingProfile::CreateWebDataService() { | 373 void TestingProfile::CreateWebDataService() { |
| 373 WebDataServiceFactory::GetInstance()->SetTestingFactory( | 374 WebDataServiceFactory::GetInstance()->SetTestingFactory( |
| 374 this, BuildWebDataService); | 375 this, BuildWebDataService); |
| 375 } | 376 } |
| 376 | 377 |
| 377 void TestingProfile::BlockUntilBookmarkModelLoaded() { | 378 void TestingProfile::BlockUntilBookmarkModelLoaded() { |
| 378 DCHECK(GetBookmarkModel()); | 379 DCHECK(GetBookmarkModel()); |
| 379 if (GetBookmarkModel()->IsLoaded()) | 380 if (GetBookmarkModel()->IsLoaded()) |
| 380 return; | 381 return; |
| 381 BookmarkLoadObserver observer; | 382 base::RunLoop run_loop; |
| 383 BookmarkLoadObserver observer( |
| 384 ui_test_utils::GetQuitTaskForRunLoop(&run_loop)); |
| 382 GetBookmarkModel()->AddObserver(&observer); | 385 GetBookmarkModel()->AddObserver(&observer); |
| 383 MessageLoop::current()->Run(); | 386 run_loop.Run(); |
| 384 GetBookmarkModel()->RemoveObserver(&observer); | 387 GetBookmarkModel()->RemoveObserver(&observer); |
| 385 DCHECK(GetBookmarkModel()->IsLoaded()); | 388 DCHECK(GetBookmarkModel()->IsLoaded()); |
| 386 } | 389 } |
| 387 | 390 |
| 388 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? | 391 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? |
| 389 void TestingProfile::BlockUntilTopSitesLoaded() { | 392 void TestingProfile::BlockUntilTopSitesLoaded() { |
| 390 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer( | 393 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer( |
| 391 chrome::NOTIFICATION_TOP_SITES_LOADED, | 394 chrome::NOTIFICATION_TOP_SITES_LOADED, |
| 392 content::NotificationService::AllSources()); | 395 content::NotificationService::AllSources()); |
| 393 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) | 396 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 } | 715 } |
| 713 | 716 |
| 714 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { | 717 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { |
| 715 return true; | 718 return true; |
| 716 } | 719 } |
| 717 | 720 |
| 718 base::Callback<ChromeURLDataManagerBackend*(void)> | 721 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 719 TestingProfile::GetChromeURLDataManagerBackendGetter() const { | 722 TestingProfile::GetChromeURLDataManagerBackendGetter() const { |
| 720 return base::Callback<ChromeURLDataManagerBackend*(void)>(); | 723 return base::Callback<ChromeURLDataManagerBackend*(void)>(); |
| 721 } | 724 } |
| OLD | NEW |