Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Unified Diff: components/arc/arc_service_manager.cc

Issue 1684063002: Add ArcEnabled policy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26869593
Patch Set: Fixed GuestModeOptionsUIBrowserTest.testSections Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/arc_service_manager.h ('k') | components/arc/test/fake_arc_bridge_bootstrap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_service_manager.cc
diff --git a/components/arc/arc_service_manager.cc b/components/arc/arc_service_manager.cc
index d649cf30cff8376072d06ca49f0717acd06fb3ec..f3e07a8bd936772a0ce1ce0f891c01c8b02dc231 100644
--- a/components/arc/arc_service_manager.cc
+++ b/components/arc/arc_service_manager.cc
@@ -23,14 +23,23 @@ namespace {
// Weak pointer. This class is owned by ChromeBrowserMainPartsChromeos.
ArcServiceManager* g_arc_service_manager = nullptr;
+// This pointer is owned by ArcServiceManager.
+ArcBridgeService* g_arc_bridge_service_for_testing = nullptr;
+
} // namespace
-ArcServiceManager::ArcServiceManager()
- : arc_bridge_service_(
- new ArcBridgeServiceImpl(ArcBridgeBootstrap::Create())) {
+ArcServiceManager::ArcServiceManager() {
DCHECK(!g_arc_service_manager);
g_arc_service_manager = this;
+ if (g_arc_bridge_service_for_testing) {
+ arc_bridge_service_.reset(g_arc_bridge_service_for_testing);
+ g_arc_bridge_service_for_testing = nullptr;
+ } else {
+ arc_bridge_service_.reset(new ArcBridgeServiceImpl(
+ ArcBridgeBootstrap::Create()));
+ }
+
AddService(make_scoped_ptr(new ArcClipboardBridge(arc_bridge_service())));
AddService(
make_scoped_ptr(new ArcCrashCollectorBridge(arc_bridge_service())));
@@ -44,6 +53,9 @@ ArcServiceManager::~ArcServiceManager() {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(g_arc_service_manager == this);
g_arc_service_manager = nullptr;
+ if (g_arc_bridge_service_for_testing) {
+ delete g_arc_bridge_service_for_testing;
+ }
}
// static
@@ -72,4 +84,13 @@ void ArcServiceManager::OnPrimaryUserProfilePrepared(
new ArcNotificationManager(arc_bridge_service(), account_id)));
}
+//static
+void ArcServiceManager::SetArcBridgeServiceForTesting(
+ scoped_ptr<ArcBridgeService> arc_bridge_service) {
+ if (g_arc_bridge_service_for_testing) {
+ delete g_arc_bridge_service_for_testing;
+ }
+ g_arc_bridge_service_for_testing = arc_bridge_service.release();
+}
+
} // namespace arc
« no previous file with comments | « components/arc/arc_service_manager.h ('k') | components/arc/test/fake_arc_bridge_bootstrap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698