| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "chrome/common/chrome_constants.h" | 46 #include "chrome/common/chrome_constants.h" |
| 47 #include "chrome/common/chrome_notification_types.h" | 47 #include "chrome/common/chrome_notification_types.h" |
| 48 #include "chrome/common/chrome_switches.h" | 48 #include "chrome/common/chrome_switches.h" |
| 49 #include "chrome/common/url_constants.h" | 49 #include "chrome/common/url_constants.h" |
| 50 #include "chrome/test/base/bookmark_load_observer.h" | 50 #include "chrome/test/base/bookmark_load_observer.h" |
| 51 #include "chrome/test/base/testing_pref_service.h" | 51 #include "chrome/test/base/testing_pref_service.h" |
| 52 #include "chrome/test/base/ui_test_utils.h" | 52 #include "chrome/test/base/ui_test_utils.h" |
| 53 #include "content/public/browser/browser_thread.h" | 53 #include "content/public/browser/browser_thread.h" |
| 54 #include "content/public/browser/notification_service.h" | 54 #include "content/public/browser/notification_service.h" |
| 55 #include "content/public/browser/render_process_host.h" | 55 #include "content/public/browser/render_process_host.h" |
| 56 #include "content/public/test/browser_test_utils.h" | |
| 57 #include "content/public/test/mock_resource_context.h" | 56 #include "content/public/test/mock_resource_context.h" |
| 57 #include "content/public/test/test_utils.h" |
| 58 #include "net/cookies/cookie_monster.h" | 58 #include "net/cookies/cookie_monster.h" |
| 59 #include "net/url_request/url_request_context.h" | 59 #include "net/url_request/url_request_context.h" |
| 60 #include "net/url_request/url_request_context_getter.h" | 60 #include "net/url_request/url_request_context_getter.h" |
| 61 #include "net/url_request/url_request_test_util.h" | 61 #include "net/url_request/url_request_test_util.h" |
| 62 #include "testing/gmock/include/gmock/gmock.h" | 62 #include "testing/gmock/include/gmock/gmock.h" |
| 63 | 63 |
| 64 #if defined(ENABLE_CONFIGURATION_POLICY) | 64 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 65 #include "chrome/browser/policy/policy_service_impl.h" | 65 #include "chrome/browser/policy/policy_service_impl.h" |
| 66 #else | 66 #else |
| 67 #include "chrome/browser/policy/policy_service_stub.h" | 67 #include "chrome/browser/policy/policy_service_stub.h" |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 base::RunLoop run_loop; | 399 base::RunLoop run_loop; |
| 400 BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); | 400 BookmarkLoadObserver observer(content::GetQuitTaskForRunLoop(&run_loop)); |
| 401 GetBookmarkModel()->AddObserver(&observer); | 401 GetBookmarkModel()->AddObserver(&observer); |
| 402 run_loop.Run(); | 402 run_loop.Run(); |
| 403 GetBookmarkModel()->RemoveObserver(&observer); | 403 GetBookmarkModel()->RemoveObserver(&observer); |
| 404 DCHECK(GetBookmarkModel()->IsLoaded()); | 404 DCHECK(GetBookmarkModel()->IsLoaded()); |
| 405 } | 405 } |
| 406 | 406 |
| 407 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? | 407 // TODO(phajdan.jr): Doesn't this hang if Top Sites are already loaded? |
| 408 void TestingProfile::BlockUntilTopSitesLoaded() { | 408 void TestingProfile::BlockUntilTopSitesLoaded() { |
| 409 ui_test_utils::WindowedNotificationObserver top_sites_loaded_observer( | 409 content::WindowedNotificationObserver top_sites_loaded_observer( |
| 410 chrome::NOTIFICATION_TOP_SITES_LOADED, | 410 chrome::NOTIFICATION_TOP_SITES_LOADED, |
| 411 content::NotificationService::AllSources()); | 411 content::NotificationService::AllSources()); |
| 412 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) | 412 if (!GetHistoryService(Profile::EXPLICIT_ACCESS)) |
| 413 GetTopSites()->HistoryLoaded(); | 413 GetTopSites()->HistoryLoaded(); |
| 414 top_sites_loaded_observer.Wait(); | 414 top_sites_loaded_observer.Wait(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 FilePath TestingProfile::GetPath() { | 417 FilePath TestingProfile::GetPath() { |
| 418 return profile_path_; | 418 return profile_path_; |
| 419 } | 419 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 739 } |
| 740 | 740 |
| 741 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { | 741 bool TestingProfile::WasCreatedByVersionOrLater(const std::string& version) { |
| 742 return true; | 742 return true; |
| 743 } | 743 } |
| 744 | 744 |
| 745 base::Callback<ChromeURLDataManagerBackend*(void)> | 745 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 746 TestingProfile::GetChromeURLDataManagerBackendGetter() const { | 746 TestingProfile::GetChromeURLDataManagerBackendGetter() const { |
| 747 return base::Callback<ChromeURLDataManagerBackend*(void)>(); | 747 return base::Callback<ChromeURLDataManagerBackend*(void)>(); |
| 748 } | 748 } |
| OLD | NEW |