| 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..309dde087961b7ce08961bc853fa46c4c9c53502 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* const result = g_bootstrap_for_testing;
|
| + 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
|
|
|