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_browser_process.h" | 5 #include "chrome/test/base/testing_browser_process.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/background/background_mode_manager.h" | 11 #include "chrome/browser/background/background_mode_manager.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/browser_process_impl.h" | 13 #include "chrome/browser/browser_process_impl.h" |
14 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" | |
15 #include "chrome/browser/printing/print_job_manager.h" | 14 #include "chrome/browser/printing/print_job_manager.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/browser/ui/apps/chrome_apps_client.h" | 16 #include "chrome/browser/ui/apps/chrome_apps_client.h" |
18 #include "chrome/test/base/testing_browser_process_platform_part.h" | 17 #include "chrome/test/base/testing_browser_process_platform_part.h" |
19 #include "components/network_time/network_time_tracker.h" | 18 #include "components/network_time/network_time_tracker.h" |
20 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
21 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "ui/message_center/message_center.h" | 22 #include "ui/message_center/message_center.h" |
24 | 23 |
25 #if !defined(OS_IOS) | 24 #if !defined(OS_IOS) |
26 #include "chrome/browser/notifications/notification_ui_manager.h" | 25 #include "chrome/browser/notifications/notification_ui_manager.h" |
27 #include "chrome/browser/prerender/prerender_tracker.h" | 26 #include "chrome/browser/prerender/prerender_tracker.h" |
28 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 27 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
29 #endif | 28 #endif |
30 | 29 |
31 #if !defined(OS_IOS) && !defined(OS_ANDROID) | |
32 #include "chrome/browser/media_galleries/media_file_system_registry.h" | |
33 #include "components/storage_monitor/storage_monitor.h" | |
34 #include "components/storage_monitor/test_storage_monitor.h" | |
35 #endif | |
36 | |
37 #if defined(ENABLE_CONFIGURATION_POLICY) | 30 #if defined(ENABLE_CONFIGURATION_POLICY) |
38 #include "components/policy/core/browser/browser_policy_connector.h" | 31 #include "components/policy/core/browser/browser_policy_connector.h" |
39 #else | 32 #else |
40 #include "components/policy/core/common/policy_service_stub.h" | 33 #include "components/policy/core/common/policy_service_stub.h" |
41 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 34 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
42 | 35 |
| 36 #if defined(ENABLE_EXTENSIONS) |
| 37 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
| 38 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
| 39 #include "components/storage_monitor/storage_monitor.h" |
| 40 #include "components/storage_monitor/test_storage_monitor.h" |
| 41 #endif |
| 42 |
43 #if defined(ENABLE_FULL_PRINTING) | 43 #if defined(ENABLE_FULL_PRINTING) |
44 #include "chrome/browser/printing/background_printing_manager.h" | 44 #include "chrome/browser/printing/background_printing_manager.h" |
45 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 45 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
46 #endif | 46 #endif |
47 | 47 |
48 // static | 48 // static |
49 TestingBrowserProcess* TestingBrowserProcess::GetGlobal() { | 49 TestingBrowserProcess* TestingBrowserProcess::GetGlobal() { |
50 return static_cast<TestingBrowserProcess*>(g_browser_process); | 50 return static_cast<TestingBrowserProcess*>(g_browser_process); |
51 } | 51 } |
52 | 52 |
(...skipping 11 matching lines...) Expand all Loading... |
64 delete browser_process; | 64 delete browser_process; |
65 } | 65 } |
66 | 66 |
67 TestingBrowserProcess::TestingBrowserProcess() | 67 TestingBrowserProcess::TestingBrowserProcess() |
68 : notification_service_(content::NotificationService::Create()), | 68 : notification_service_(content::NotificationService::Create()), |
69 module_ref_count_(0), | 69 module_ref_count_(0), |
70 app_locale_("en"), | 70 app_locale_("en"), |
71 local_state_(NULL), | 71 local_state_(NULL), |
72 io_thread_(NULL), | 72 io_thread_(NULL), |
73 system_request_context_(NULL), | 73 system_request_context_(NULL), |
74 platform_part_(new TestingBrowserProcessPlatformPart()), | 74 platform_part_(new TestingBrowserProcessPlatformPart()) { |
75 extensions_browser_client_( | |
76 new extensions::ChromeExtensionsBrowserClient) { | |
77 #if defined(ENABLE_EXTENSIONS) | 75 #if defined(ENABLE_EXTENSIONS) |
| 76 extensions_browser_client_.reset( |
| 77 new extensions::ChromeExtensionsBrowserClient); |
78 apps::AppsClient::Set(ChromeAppsClient::GetInstance()); | 78 apps::AppsClient::Set(ChromeAppsClient::GetInstance()); |
| 79 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); |
79 #endif | 80 #endif |
80 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); | |
81 } | 81 } |
82 | 82 |
83 TestingBrowserProcess::~TestingBrowserProcess() { | 83 TestingBrowserProcess::~TestingBrowserProcess() { |
84 EXPECT_FALSE(local_state_); | 84 EXPECT_FALSE(local_state_); |
85 #if defined(ENABLE_CONFIGURATION_POLICY) | 85 #if defined(ENABLE_CONFIGURATION_POLICY) |
86 SetBrowserPolicyConnector(NULL); | 86 SetBrowserPolicyConnector(NULL); |
87 #endif | 87 #endif |
| 88 #if defined(ENABLE_EXTENSIONS) |
88 extensions::ExtensionsBrowserClient::Set(NULL); | 89 extensions::ExtensionsBrowserClient::Set(NULL); |
| 90 #endif |
89 | 91 |
90 // Destructors for some objects owned by TestingBrowserProcess will use | 92 // Destructors for some objects owned by TestingBrowserProcess will use |
91 // g_browser_process if it is not NULL, so it must be NULL before proceeding. | 93 // g_browser_process if it is not NULL, so it must be NULL before proceeding. |
92 DCHECK_EQ(static_cast<BrowserProcess*>(NULL), g_browser_process); | 94 DCHECK_EQ(static_cast<BrowserProcess*>(NULL), g_browser_process); |
93 } | 95 } |
94 | 96 |
95 void TestingBrowserProcess::ResourceDispatcherHostCreated() { | 97 void TestingBrowserProcess::ResourceDispatcherHostCreated() { |
96 } | 98 } |
97 | 99 |
98 void TestingBrowserProcess::EndSession() { | 100 void TestingBrowserProcess::EndSession() { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 438 |
437 /////////////////////////////////////////////////////////////////////////////// | 439 /////////////////////////////////////////////////////////////////////////////// |
438 | 440 |
439 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { | 441 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { |
440 TestingBrowserProcess::CreateInstance(); | 442 TestingBrowserProcess::CreateInstance(); |
441 } | 443 } |
442 | 444 |
443 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { | 445 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { |
444 TestingBrowserProcess::DeleteInstance(); | 446 TestingBrowserProcess::DeleteInstance(); |
445 } | 447 } |
OLD | NEW |