#include "chrome/test/base/testing_browser_process.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "base/time/default_clock.h"
#include "base/time/default_tick_clock.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/download/download_request_limiter.h"
#include "chrome/browser/global_features.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/media/webrtc/webrtc_log_uploader.h"
#include "chrome/browser/notifications/notification_platform_bridge.h"
#include "chrome/browser/notifications/stub_notification_platform_bridge.h"
#include "chrome/browser/notifications/system_notification_helper.h"
#include "chrome/browser/permissions/chrome_permissions_client.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/resource_coordinator/resource_coordinator_parts.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/status_icons/status_tray.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/testing_browser_process_platform_part.h"
#include "components/embedder_support/origin_trials/origin_trials_settings_storage.h"
#include "components/metrics/metrics_service.h"
#include "components/network_time/network_time_tracker.h"
#include "components/os_crypt/async/browser/test_utils.h"
#include "components/permissions/permissions_client.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/prefs/pref_service.h"
#include "components/subresource_filter/content/shared/browser/ruleset_service.h"
#include "content/public/browser/network_service_instance.h"
#include "extensions/buildflags/buildflags.h"
#include "media/media_buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "services/device/public/cpp/geolocation/buildflags.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/test/test_network_connection_tracker.h"
#include "services/network/test/test_network_quality_tracker.h"
#include "testing/gtest/include/gtest/gtest.h"
#if BUILDFLAG(OS_LEVEL_GEOLOCATION_PERMISSION_SUPPORTED)
#include "services/device/public/cpp/device_features.h"
#include "services/device/public/cpp/geolocation/geolocation_system_permission_manager.h"
#include "services/device/public/cpp/test/fake_geolocation_system_permission_manager.h"
#endif
#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
#include "chrome/browser/background/background_mode_manager.h"
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/apps/platform_apps/chrome_apps_browser_api_provider.h"
#include "chrome/browser/extensions/chrome_extensions_browser_client.h"
#include "chrome/browser/media_galleries/media_file_system_registry.h"
#include "chrome/browser/ui/apps/chrome_app_window_client.h"
#include "components/storage_monitor/storage_monitor.h"
#include "components/storage_monitor/test_storage_monitor.h"
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h"
#endif
#if !BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/hid/hid_pinned_notification.h"
#include "chrome/browser/usb/usb_pinned_notification.h"
#else
#include "chrome/browser/hid/hid_status_icon.h"
#include "chrome/browser/usb/usb_status_icon.h"
#endif
#include "chrome/browser/serial/serial_policy_allowed_ports.h"
#include "components/keep_alive_registry/keep_alive_registry.h"
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
#endif
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h"
#endif
#if BUILDFLAG(ENABLE_CHROME_NOTIFICATIONS)
#include "chrome/browser/notifications/notification_ui_manager.h"
#endif
TestingBrowserProcess* TestingBrowserProcess::GetGlobal() { … }
void TestingBrowserProcess::CreateInstance() { … }
void TestingBrowserProcess::DeleteInstance() { … }
void TestingBrowserProcess::StartTearDown() { … }
void TestingBrowserProcess::TearDownAndDeleteInstance() { … }
TestingBrowserProcess::TestingBrowserProcess()
: … { … }
TestingBrowserProcess::~TestingBrowserProcess() { … }
void TestingBrowserProcess::Init() { … }
void TestingBrowserProcess::FlushLocalStateAndReply(base::OnceClosure reply) { … }
void TestingBrowserProcess::EndSession() { … }
metrics_services_manager::MetricsServicesManager*
TestingBrowserProcess::GetMetricsServicesManager() { … }
metrics::MetricsService* TestingBrowserProcess::metrics_service() { … }
embedder_support::OriginTrialsSettingsStorage*
TestingBrowserProcess::GetOriginTrialsSettingsStorage() { … }
SystemNetworkContextManager*
TestingBrowserProcess::system_network_context_manager() { … }
scoped_refptr<network::SharedURLLoaderFactory>
TestingBrowserProcess::shared_url_loader_factory() { … }
network::NetworkQualityTracker*
TestingBrowserProcess::network_quality_tracker() { … }
ProfileManager* TestingBrowserProcess::profile_manager() { … }
void TestingBrowserProcess::SetMetricsService(
metrics::MetricsService* metrics_service) { … }
void TestingBrowserProcess::SetProfileManager(
std::unique_ptr<ProfileManager> profile_manager) { … }
void TestingBrowserProcess::SetVariationsService(
variations::VariationsService* variations_service) { … }
PrefService* TestingBrowserProcess::local_state() { … }
signin::ActivePrimaryAccountsMetricsRecorder*
TestingBrowserProcess::active_primary_accounts_metrics_recorder() { … }
variations::VariationsService* TestingBrowserProcess::variations_service() { … }
StartupData* TestingBrowserProcess::startup_data() { … }
policy::ChromeBrowserPolicyConnector*
TestingBrowserProcess::browser_policy_connector() { … }
policy::PolicyService* TestingBrowserProcess::policy_service() { … }
IconManager* TestingBrowserProcess::icon_manager() { … }
GpuModeManager* TestingBrowserProcess::gpu_mode_manager() { … }
BackgroundModeManager* TestingBrowserProcess::background_mode_manager() { … }
#if BUILDFLAG(ENABLE_BACKGROUND_MODE)
void TestingBrowserProcess::set_background_mode_manager_for_test(
std::unique_ptr<BackgroundModeManager> manager) { … }
#endif
StatusTray* TestingBrowserProcess::status_tray() { … }
safe_browsing::SafeBrowsingService*
TestingBrowserProcess::safe_browsing_service() { … }
WebRtcLogUploader* TestingBrowserProcess::webrtc_log_uploader() { … }
subresource_filter::RulesetService*
TestingBrowserProcess::subresource_filter_ruleset_service() { … }
subresource_filter::RulesetService*
TestingBrowserProcess::fingerprinting_protection_ruleset_service() { … }
BrowserProcessPlatformPart* TestingBrowserProcess::platform_part() { … }
NotificationUIManager* TestingBrowserProcess::notification_ui_manager() { … }
NotificationPlatformBridge*
TestingBrowserProcess::notification_platform_bridge() { … }
#if !BUILDFLAG(IS_ANDROID)
IntranetRedirectDetector* TestingBrowserProcess::intranet_redirect_detector() { … }
#endif
void TestingBrowserProcess::CreateDevToolsProtocolHandler() { … }
void TestingBrowserProcess::CreateDevToolsAutoOpener() { … }
bool TestingBrowserProcess::IsShuttingDown() { … }
printing::PrintJobManager* TestingBrowserProcess::print_job_manager() { … }
printing::PrintPreviewDialogController*
TestingBrowserProcess::print_preview_dialog_controller() { … }
printing::BackgroundPrintingManager*
TestingBrowserProcess::background_printing_manager() { … }
const std::string& TestingBrowserProcess::GetApplicationLocale() { … }
void TestingBrowserProcess::SetApplicationLocale(
const std::string& actual_locale) { … }
DownloadStatusUpdater* TestingBrowserProcess::download_status_updater() { … }
DownloadRequestLimiter* TestingBrowserProcess::download_request_limiter() { … }
component_updater::ComponentUpdateService*
TestingBrowserProcess::component_updater() { … }
MediaFileSystemRegistry* TestingBrowserProcess::media_file_system_registry() { … }
network_time::NetworkTimeTracker*
TestingBrowserProcess::network_time_tracker() { … }
#if !BUILDFLAG(IS_ANDROID)
gcm::GCMDriver* TestingBrowserProcess::gcm_driver() { … }
#endif
resource_coordinator::ResourceCoordinatorParts*
TestingBrowserProcess::resource_coordinator_parts() { … }
#if !BUILDFLAG(IS_ANDROID)
SerialPolicyAllowedPorts* TestingBrowserProcess::serial_policy_allowed_ports() { … }
HidSystemTrayIcon* TestingBrowserProcess::hid_system_tray_icon() { … }
UsbSystemTrayIcon* TestingBrowserProcess::usb_system_tray_icon() { … }
#endif
os_crypt_async::OSCryptAsync* TestingBrowserProcess::os_crypt_async() { … }
void TestingBrowserProcess::set_additional_os_crypt_async_provider_for_test(
size_t precedence,
std::unique_ptr<os_crypt_async::KeyProvider> provider) { … }
BuildState* TestingBrowserProcess::GetBuildState() { … }
GlobalFeatures* TestingBrowserProcess::GetFeatures() { … }
resource_coordinator::TabManager* TestingBrowserProcess::GetTabManager() { … }
void TestingBrowserProcess::SetSharedURLLoaderFactory(
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory) { … }
#if BUILDFLAG(ENABLE_CHROME_NOTIFICATIONS)
void TestingBrowserProcess::SetNotificationUIManager(
std::unique_ptr<NotificationUIManager> notification_ui_manager) { … }
#endif
void TestingBrowserProcess::SetSystemNotificationHelper(
std::unique_ptr<SystemNotificationHelper> system_notification_helper) { … }
void TestingBrowserProcess::SetLocalState(PrefService* local_state) { … }
void TestingBrowserProcess::ShutdownBrowserPolicyConnector() { … }
TestingBrowserProcessPlatformPart*
TestingBrowserProcess::GetTestPlatformPart() { … }
void TestingBrowserProcess::SetSafeBrowsingService(
safe_browsing::SafeBrowsingService* sb_service) { … }
void TestingBrowserProcess::SetWebRtcLogUploader(
std::unique_ptr<WebRtcLogUploader> uploader) { … }
void TestingBrowserProcess::SetRulesetService(
std::unique_ptr<subresource_filter::RulesetService> ruleset_service) { … }
void TestingBrowserProcess::SetFingerprintingProtectionRulesetService(
std::unique_ptr<subresource_filter::RulesetService> ruleset_service) { … }
void TestingBrowserProcess::SetShuttingDown(bool is_shutting_down) { … }
void TestingBrowserProcess::SetStatusTray(
std::unique_ptr<StatusTray> status_tray) { … }
#if !BUILDFLAG(IS_ANDROID)
void TestingBrowserProcess::SetHidSystemTrayIcon(
std::unique_ptr<HidSystemTrayIcon> hid_system_tray_icon) { … }
void TestingBrowserProcess::SetUsbSystemTrayIcon(
std::unique_ptr<UsbSystemTrayIcon> usb_system_tray_icon) { … }
#endif
TestingBrowserProcessInitializer::TestingBrowserProcessInitializer() { … }
TestingBrowserProcessInitializer::~TestingBrowserProcessInitializer() { … }