| Index: components/arc/arc_bridge_service_unittest.cc
|
| diff --git a/components/arc/arc_bridge_service_unittest.cc b/components/arc/arc_bridge_service_unittest.cc
|
| index 8dc9558316e50b63142979d89497317bce8abcb0..e76f75d4aaae15cf4b4acd39d1d86b259c419e68 100644
|
| --- a/components/arc/arc_bridge_service_unittest.cc
|
| +++ b/components/arc/arc_bridge_service_unittest.cc
|
| @@ -68,12 +68,7 @@ class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
|
| }
|
| }
|
|
|
| - void OnInstanceBootPhase(InstanceBootPhase boot_phase) override {
|
| - boot_phase_ = boot_phase;
|
| - }
|
| -
|
| bool ready() const { return ready_; }
|
| - InstanceBootPhase boot_phase() const { return boot_phase_; }
|
| ArcBridgeService::State state() const { return state_; }
|
|
|
| protected:
|
| @@ -86,7 +81,6 @@ class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
|
|
|
| ready_ = false;
|
| state_ = ArcBridgeService::State::STOPPED;
|
| - boot_phase_ = INSTANCE_BOOT_PHASE_NOT_RUNNING;
|
|
|
| ipc_support_.reset(new IPC::ScopedIPCSupport(message_loop_.task_runner()));
|
| instance_.reset(new FakeArcBridgeInstance());
|
| @@ -106,7 +100,6 @@ class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
|
| }
|
|
|
| bool ready_;
|
| - InstanceBootPhase boot_phase_;
|
| ArcBridgeService::State state_;
|
| scoped_ptr<IPC::ScopedIPCSupport> ipc_support_;
|
| base::MessageLoopForUI message_loop_;
|
| @@ -115,17 +108,17 @@ class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
|
| };
|
|
|
| // Shuts down the instance reports booted.
|
| -class ScopedShutdownWhenBooted : public ArcBridgeService::Observer {
|
| +class ScopedShutdownWhenReady : public ArcBridgeService::Observer {
|
| public:
|
| - explicit ScopedShutdownWhenBooted(ArcBridgeService* service)
|
| + explicit ScopedShutdownWhenReady(ArcBridgeService* service)
|
| : service_(service) {
|
| service_->AddObserver(this);
|
| }
|
|
|
| - ~ScopedShutdownWhenBooted() override { service_->RemoveObserver(this); }
|
| + ~ScopedShutdownWhenReady() override { service_->RemoveObserver(this); }
|
|
|
| - void OnInstanceBootPhase(InstanceBootPhase boot_phase) override {
|
| - if (boot_phase == INSTANCE_BOOT_PHASE_BOOT_COMPLETED) {
|
| + void OnStateChanged(ArcBridgeService::State state) override {
|
| + if (state == ArcBridgeService::State::READY) {
|
| service_->Shutdown();
|
| }
|
| }
|
| @@ -133,7 +126,7 @@ class ScopedShutdownWhenBooted : public ArcBridgeService::Observer {
|
| private:
|
| ArcBridgeService* service_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ScopedShutdownWhenBooted);
|
| + DISALLOW_COPY_AND_ASSIGN(ScopedShutdownWhenReady);
|
| };
|
|
|
| // Exercises the basic functionality of the ARC Bridge Service. A message from
|
| @@ -142,18 +135,17 @@ TEST_F(ArcBridgeTest, Basic) {
|
| ASSERT_FALSE(ready());
|
| ASSERT_EQ(ArcBridgeService::State::STOPPED, state());
|
|
|
| - ScopedShutdownWhenBooted shutdown(service_.get());
|
| + ScopedShutdownWhenReady shutdown(service_.get());
|
|
|
| service_->SetAvailable(true);
|
| service_->HandleStartup();
|
|
|
| - ASSERT_EQ(ArcBridgeService::State::CONNECTED, state());
|
| + ASSERT_EQ(ArcBridgeService::State::STOPPED, state());
|
|
|
| base::RunLoop run_loop;
|
| run_loop.Run();
|
|
|
| EXPECT_TRUE(ready());
|
| - ASSERT_EQ(INSTANCE_BOOT_PHASE_BOOT_COMPLETED, boot_phase());
|
| ASSERT_EQ(ArcBridgeService::State::STOPPED, state());
|
| }
|
|
|
| @@ -176,7 +168,7 @@ TEST_F(ArcBridgeTest, ShutdownMidStartup) {
|
| service_->SetAvailable(true);
|
| service_->HandleStartup();
|
|
|
| - ASSERT_EQ(ArcBridgeService::State::CONNECTED, state());
|
| + ASSERT_EQ(ArcBridgeService::State::READY, state());
|
| service_->Shutdown();
|
| // Some machines can reach the STOPPED state immediately.
|
| ASSERT_TRUE(state() == ArcBridgeService::State::STOPPING ||
|
|
|