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..34c50744042dabac9c7782cd9f74a8e2938dc822 100644 |
--- a/components/arc/arc_bridge_bootstrap.cc |
+++ b/components/arc/arc_bridge_bootstrap.cc |
@@ -34,6 +34,8 @@ namespace arc { |
namespace { |
+scoped_ptr<ArcBridgeBootstrap> fake_bootstrap_; |
bartfab (slow)
2016/03/02 14:45:40
1) Nit: It may not be a fake - it could be a mock.
Polina Bondarenko
2016/03/06 20:22:33
Done, fixed to pointer.
|
+ |
// 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,22 @@ void ArcBridgeBootstrapImpl::SetState(State state) { |
} // namespace |
ArcBridgeBootstrap::ArcBridgeBootstrap() {} |
-ArcBridgeBootstrap::~ArcBridgeBootstrap() {} |
+ArcBridgeBootstrap::~ArcBridgeBootstrap() { |
bartfab (slow)
2016/03/02 14:45:40
Nit: Add a blank line above.
Polina Bondarenko
2016/03/06 20:22:33
Done.
|
+ fake_bootstrap_.reset(); |
bartfab (slow)
2016/03/02 14:45:40
This should not be necessary. The global fake_boot
|
+} |
// static |
scoped_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
- return make_scoped_ptr(new ArcBridgeBootstrapImpl()); |
+ if (fake_bootstrap_ != NULL) { |
bartfab (slow)
2016/03/02 14:45:40
Nit: s/NULL/nullptr/ or, even easier, "if (fake_bo
Polina Bondarenko
2016/03/06 20:22:33
Done.
|
+ return make_scoped_ptr(fake_bootstrap_.release()); |
+ } else { |
+ return make_scoped_ptr(new ArcBridgeBootstrapImpl()); |
+ } |
+} |
+ |
+// static |
+void ArcBridgeBootstrap::SetBootstrapForTesting(ArcBridgeBootstrap* bootstrap) { |
+ fake_bootstrap_.reset(bootstrap); |
} |
} // namespace arc |