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

Unified Diff: components/arc/arc_service_manager.cc

Issue 1829703002: Add ArcEnabled policy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed test and removed all changes from arc_auth_service 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
Index: components/arc/arc_service_manager.cc
diff --git a/components/arc/arc_service_manager.cc b/components/arc/arc_service_manager.cc
index 10388a2aa05008eb927ae61052d97be70c7b5005..bc549940522048c5d3c35691f8966546a5edc33e 100644
--- a/components/arc/arc_service_manager.cc
+++ b/components/arc/arc_service_manager.cc
@@ -24,14 +24,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;
bartfab (slow) 2016/04/01 10:41:18 Nit: #include "components/arc/arc_bridge_service.h
Polina Bondarenko 2016/04/01 11:05:10 Done.
+
} // 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())));
@@ -46,6 +55,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
@@ -74,4 +86,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

Powered by Google App Engine
This is Rietveld 408576698