| Index: components/arc/arc_bridge_service_impl.h
|
| diff --git a/components/arc/arc_bridge_service_impl.h b/components/arc/arc_bridge_service_impl.h
|
| index a9b5c44ccc5f21aa823ace2ef3e07fd1c160e56f..872582bc64b09989a9bba8a12795f07f97b60df7 100644
|
| --- a/components/arc/arc_bridge_service_impl.h
|
| +++ b/components/arc/arc_bridge_service_impl.h
|
| @@ -27,13 +27,26 @@ namespace arc {
|
| class ArcBridgeServiceImpl : public ArcBridgeService,
|
| public ArcBridgeBootstrap::Delegate {
|
| public:
|
| - explicit ArcBridgeServiceImpl(std::unique_ptr<ArcBridgeBootstrap> bootstrap);
|
| + // This is the factory interface to inject ArcBridgeBootstrap instance
|
| + // for testing purpose.
|
| + using ArcBridgeBootstrapFactory =
|
| + base::Callback<std::unique_ptr<ArcBridgeBootstrap>()>;
|
| +
|
| + ArcBridgeServiceImpl();
|
| ~ArcBridgeServiceImpl() override;
|
|
|
| void HandleStartup() override;
|
|
|
| void Shutdown() override;
|
|
|
| + // Inject a factory to create ArcBridgeBootstrap instance for testing
|
| + // purpose. |factory| must not be null.
|
| + void SetArcBridgeBootstrapFactoryForTesting(
|
| + const ArcBridgeBootstrapFactory& factory);
|
| +
|
| + // Returns the current bootstrap instance for testing purpose.
|
| + ArcBridgeBootstrap* GetBootstrapForTesting() { return bootstrap_.get(); }
|
| +
|
| // Normally, reconnecting after connection shutdown happens after a short
|
| // delay. When testing, however, we'd like it to happen immediately to avoid
|
| // adding unnecessary delays.
|
| @@ -72,6 +85,9 @@ class ArcBridgeServiceImpl : public ArcBridgeService,
|
| // Delay the reconnection.
|
| bool use_delay_before_reconnecting_ = true;
|
|
|
| + // Factory to inject a fake ArcBridgeBootstrap instance for testing.
|
| + ArcBridgeBootstrapFactory factory_;
|
| +
|
| // WeakPtrFactory to use callbacks.
|
| base::WeakPtrFactory<ArcBridgeServiceImpl> weak_factory_;
|
|
|
|
|