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/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/time/default_clock.h" | 8 #include "base/time/default_clock.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/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/browser_process_impl.h" | 12 #include "chrome/browser/browser_process_impl.h" |
13 #include "chrome/browser/lifetime/application_lifetime.h" | 13 #include "chrome/browser/lifetime/application_lifetime.h" |
14 #include "chrome/browser/memory/tab_manager.h" | 14 #include "chrome/browser/memory/tab_manager.h" |
15 #include "chrome/browser/notifications/notification_platform_bridge.h" | 15 #include "chrome/browser/notifications/notification_platform_bridge.h" |
16 #include "chrome/browser/notifications/notification_ui_manager.h" | 16 #include "chrome/browser/notifications/notification_ui_manager.h" |
17 #include "chrome/browser/printing/print_job_manager.h" | 17 #include "chrome/browser/printing/print_job_manager.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 19 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
20 #include "chrome/common/features.h" | 20 #include "chrome/common/features.h" |
21 #include "chrome/test/base/testing_browser_process_platform_part.h" | 21 #include "chrome/test/base/testing_browser_process_platform_part.h" |
22 #include "components/network_time/network_time_tracker.h" | 22 #include "components/network_time/network_time_tracker.h" |
23 #include "components/policy/core/browser/browser_policy_connector.h" | 23 #include "components/policy/core/browser/browser_policy_connector.h" |
24 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
25 #include "components/subresource_filter/core/browser/ruleset_service.h" | 25 #include "components/subresource_filter/core/browser/ruleset_service.h" |
26 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 27 #include "extensions/features/features.h" |
27 #include "net/url_request/url_request_context_getter.h" | 28 #include "net/url_request/url_request_context_getter.h" |
28 #include "printing/features/features.h" | 29 #include "printing/features/features.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
30 #include "ui/message_center/message_center.h" | 31 #include "ui/message_center/message_center.h" |
31 | 32 |
32 #if BUILDFLAG(ENABLE_BACKGROUND) | 33 #if BUILDFLAG(ENABLE_BACKGROUND) |
33 #include "chrome/browser/background/background_mode_manager.h" | 34 #include "chrome/browser/background/background_mode_manager.h" |
34 #endif | 35 #endif |
35 | 36 |
36 #if defined(ENABLE_EXTENSIONS) | 37 #if BUILDFLAG(ENABLE_EXTENSIONS) |
37 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" | 38 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
38 #include "chrome/browser/media_galleries/media_file_system_registry.h" | 39 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
39 #include "chrome/browser/ui/apps/chrome_app_window_client.h" | 40 #include "chrome/browser/ui/apps/chrome_app_window_client.h" |
40 #include "components/storage_monitor/storage_monitor.h" | 41 #include "components/storage_monitor/storage_monitor.h" |
41 #include "components/storage_monitor/test_storage_monitor.h" | 42 #include "components/storage_monitor/test_storage_monitor.h" |
42 #endif | 43 #endif |
43 | 44 |
44 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 45 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
45 #include "chrome/browser/printing/background_printing_manager.h" | 46 #include "chrome/browser/printing/background_printing_manager.h" |
46 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 47 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
(...skipping 20 matching lines...) Expand all Loading... |
67 | 68 |
68 TestingBrowserProcess::TestingBrowserProcess() | 69 TestingBrowserProcess::TestingBrowserProcess() |
69 : notification_service_(content::NotificationService::Create()), | 70 : notification_service_(content::NotificationService::Create()), |
70 app_locale_("en"), | 71 app_locale_("en"), |
71 is_shutting_down_(false), | 72 is_shutting_down_(false), |
72 local_state_(nullptr), | 73 local_state_(nullptr), |
73 io_thread_(nullptr), | 74 io_thread_(nullptr), |
74 system_request_context_(nullptr), | 75 system_request_context_(nullptr), |
75 rappor_service_(nullptr), | 76 rappor_service_(nullptr), |
76 platform_part_(new TestingBrowserProcessPlatformPart()) { | 77 platform_part_(new TestingBrowserProcessPlatformPart()) { |
77 #if defined(ENABLE_EXTENSIONS) | 78 #if BUILDFLAG(ENABLE_EXTENSIONS) |
78 extensions_browser_client_.reset( | 79 extensions_browser_client_.reset( |
79 new extensions::ChromeExtensionsBrowserClient); | 80 new extensions::ChromeExtensionsBrowserClient); |
80 extensions::AppWindowClient::Set(ChromeAppWindowClient::GetInstance()); | 81 extensions::AppWindowClient::Set(ChromeAppWindowClient::GetInstance()); |
81 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); | 82 extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); |
82 #endif | 83 #endif |
83 } | 84 } |
84 | 85 |
85 TestingBrowserProcess::~TestingBrowserProcess() { | 86 TestingBrowserProcess::~TestingBrowserProcess() { |
86 EXPECT_FALSE(local_state_); | 87 EXPECT_FALSE(local_state_); |
87 ShutdownBrowserPolicyConnector(); | 88 ShutdownBrowserPolicyConnector(); |
88 #if defined(ENABLE_EXTENSIONS) | 89 #if BUILDFLAG(ENABLE_EXTENSIONS) |
89 extensions::ExtensionsBrowserClient::Set(nullptr); | 90 extensions::ExtensionsBrowserClient::Set(nullptr); |
90 #endif | 91 #endif |
91 | 92 |
92 // Destructors for some objects owned by TestingBrowserProcess will use | 93 // Destructors for some objects owned by TestingBrowserProcess will use |
93 // g_browser_process if it is not null, so it must be null before proceeding. | 94 // g_browser_process if it is not null, so it must be null before proceeding. |
94 DCHECK_EQ(static_cast<BrowserProcess*>(nullptr), g_browser_process); | 95 DCHECK_EQ(static_cast<BrowserProcess*>(nullptr), g_browser_process); |
95 } | 96 } |
96 | 97 |
97 void TestingBrowserProcess::ResourceDispatcherHostCreated() { | 98 void TestingBrowserProcess::ResourceDispatcherHostCreated() { |
98 } | 99 } |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 455 |
455 /////////////////////////////////////////////////////////////////////////////// | 456 /////////////////////////////////////////////////////////////////////////////// |
456 | 457 |
457 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { | 458 TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { |
458 TestingBrowserProcess::CreateInstance(); | 459 TestingBrowserProcess::CreateInstance(); |
459 } | 460 } |
460 | 461 |
461 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { | 462 TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { |
462 TestingBrowserProcess::DeleteInstance(); | 463 TestingBrowserProcess::DeleteInstance(); |
463 } | 464 } |
OLD | NEW |