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

Unified Diff: components/arc/arc_bridge_bootstrap.cc

Issue 1684063002: Add ArcEnabled policy implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26869593
Patch Set: Fixed comments. 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_bridge_bootstrap.cc
diff --git a/components/arc/arc_bridge_bootstrap.cc b/components/arc/arc_bridge_bootstrap.cc
index 1d7a94f55178b590325f95b1ce23fff6f1c2afb5..a7e860ef8bad09e106e478dc24f8f63e533a1778 100644
--- a/components/arc/arc_bridge_bootstrap.cc
+++ b/components/arc/arc_bridge_bootstrap.cc
@@ -34,6 +34,8 @@ namespace arc {
namespace {
+ArcBridgeBootstrap* g_bootstrap_for_testing = nullptr;
+
// We do not know the PID of ARC, since Chrome does not create it directly.
// Since Mojo in POSIX does not use the child PID except as an unique
// identifier for the routing table, rather than doing a lot of plumbing in the
@@ -341,11 +343,31 @@ void ArcBridgeBootstrapImpl::SetState(State state) {
} // namespace
ArcBridgeBootstrap::ArcBridgeBootstrap() {}
-ArcBridgeBootstrap::~ArcBridgeBootstrap() {}
+
+ArcBridgeBootstrap::~ArcBridgeBootstrap() {
+ if (g_bootstrap_for_testing) {
+ delete g_bootstrap_for_testing;
+ }
+}
// static
scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() {
- return make_scoped_ptr(new ArcBridgeBootstrapImpl());
+ if (g_bootstrap_for_testing) {
+ ArcBridgeBootstrap *result = g_bootstrap_for_testing;
bartfab (slow) 2016/03/07 13:44:04 Nit 1: const pointer. Nit 2: Move the * to the typ
Polina Bondarenko 2016/03/09 17:59:15 Done.
+ g_bootstrap_for_testing = nullptr;
+ return make_scoped_ptr(result);
+ } else {
+ return make_scoped_ptr(new ArcBridgeBootstrapImpl());
+ }
+}
+
+// static
+void ArcBridgeBootstrap::SetBootstrapForTesting(
+ scoped_ptr<ArcBridgeBootstrap> bootstrap) {
+ if (g_bootstrap_for_testing) {
+ delete g_bootstrap_for_testing;
+ }
+ g_bootstrap_for_testing = bootstrap.release();
}
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698