| 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 8eb7e477c8fcd554095d82011f2318f92314950f..8bc3de78949ea9eeaf94f28bfddbb119fe25f2d2 100644
|
| --- a/components/arc/arc_bridge_service_unittest.cc
|
| +++ b/components/arc/arc_bridge_service_unittest.cc
|
| @@ -12,7 +12,7 @@
|
| #include "base/single_thread_task_runner.h"
|
| #include "chromeos/dbus/dbus_thread_manager.h"
|
| #include "components/arc/arc_bridge_service_impl.h"
|
| -#include "components/arc/test/fake_arc_bridge_bootstrap.h"
|
| +#include "components/arc/test/fake_arc_session.h"
|
| #include "mojo/public/cpp/system/message_pipe.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -46,26 +46,25 @@ class ArcBridgeTest : public testing::Test,
|
|
|
| bool ready() const { return ready_; }
|
| ArcBridgeService::State state() const { return state_; }
|
| - FakeArcBridgeBootstrap* bootstrap() const {
|
| - return static_cast<FakeArcBridgeBootstrap*>(
|
| - service_->GetBootstrapForTesting());
|
| + FakeArcSession* arc_session() const {
|
| + return static_cast<FakeArcSession*>(service_->GetArcSessionForTesting());
|
| }
|
|
|
| protected:
|
| std::unique_ptr<ArcBridgeServiceImpl> service_;
|
| ArcBridgeService::StopReason stop_reason_;
|
|
|
| - static std::unique_ptr<ArcBridgeBootstrap> CreateSuspendedBootstrap() {
|
| - auto bootstrap = base::MakeUnique<FakeArcBridgeBootstrap>();
|
| - bootstrap->SuspendBoot();
|
| - return std::move(bootstrap);
|
| + static std::unique_ptr<ArcSession> CreateSuspendedArcSession() {
|
| + auto arc_session = base::MakeUnique<FakeArcSession>();
|
| + arc_session->SuspendBoot();
|
| + return std::move(arc_session);
|
| }
|
|
|
| - static std::unique_ptr<ArcBridgeBootstrap> CreateBootFailureBootstrap(
|
| + static std::unique_ptr<ArcSession> CreateBootFailureArcSession(
|
| ArcBridgeService::StopReason reason) {
|
| - auto bootstrap = base::MakeUnique<FakeArcBridgeBootstrap>();
|
| - bootstrap->EnableBootFailureEmulation(reason);
|
| - return std::move(bootstrap);
|
| + auto arc_session = base::MakeUnique<FakeArcSession>();
|
| + arc_session->EnableBootFailureEmulation(reason);
|
| + return std::move(arc_session);
|
| }
|
|
|
| private:
|
| @@ -77,8 +76,8 @@ class ArcBridgeTest : public testing::Test,
|
| stop_reason_ = ArcBridgeService::StopReason::SHUTDOWN;
|
|
|
| service_.reset(new ArcBridgeServiceImpl());
|
| - service_->SetArcBridgeBootstrapFactoryForTesting(
|
| - base::Bind(FakeArcBridgeBootstrap::Create));
|
| + service_->SetArcSessionFactoryForTesting(
|
| + base::Bind(FakeArcSession::Create));
|
| service_->AddObserver(this);
|
| }
|
|
|
| @@ -114,8 +113,8 @@ TEST_F(ArcBridgeTest, Basic) {
|
| TEST_F(ArcBridgeTest, ShutdownMidStartup) {
|
| ASSERT_FALSE(ready());
|
|
|
| - service_->SetArcBridgeBootstrapFactoryForTesting(
|
| - base::Bind(ArcBridgeTest::CreateSuspendedBootstrap));
|
| + service_->SetArcSessionFactoryForTesting(
|
| + base::Bind(ArcBridgeTest::CreateSuspendedArcSession));
|
| service_->HandleStartup();
|
| ASSERT_FALSE(service_->stopped());
|
| ASSERT_FALSE(service_->ready());
|
| @@ -129,8 +128,8 @@ TEST_F(ArcBridgeTest, ShutdownMidStartup) {
|
| TEST_F(ArcBridgeTest, BootFailure) {
|
| ASSERT_TRUE(service_->stopped());
|
|
|
| - service_->SetArcBridgeBootstrapFactoryForTesting(
|
| - base::Bind(ArcBridgeTest::CreateBootFailureBootstrap,
|
| + service_->SetArcSessionFactoryForTesting(
|
| + base::Bind(ArcBridgeTest::CreateBootFailureArcSession,
|
| ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE));
|
| service_->HandleStartup();
|
| EXPECT_EQ(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE, stop_reason_);
|
| @@ -146,8 +145,8 @@ TEST_F(ArcBridgeTest, Restart) {
|
|
|
| // Simulate a connection loss.
|
| service_->DisableReconnectDelayForTesting();
|
| - ASSERT_TRUE(bootstrap());
|
| - bootstrap()->StopWithReason(ArcBridgeService::StopReason::CRASH);
|
| + ASSERT_TRUE(arc_session());
|
| + arc_session()->StopWithReason(ArcBridgeService::StopReason::CRASH);
|
| ASSERT_TRUE(service_->ready());
|
|
|
| service_->Shutdown();
|
| @@ -163,15 +162,15 @@ TEST_F(ArcBridgeTest, OnBridgeStopped) {
|
| ASSERT_EQ(ArcBridgeService::State::READY, state());
|
|
|
| // Simulate boot failure.
|
| - ASSERT_TRUE(bootstrap());
|
| - bootstrap()->StopWithReason(
|
| + ASSERT_TRUE(arc_session());
|
| + arc_session()->StopWithReason(
|
| ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE);
|
| EXPECT_EQ(ArcBridgeService::StopReason::GENERIC_BOOT_FAILURE, stop_reason_);
|
| ASSERT_TRUE(service_->ready());
|
|
|
| // Simulate crash.
|
| - ASSERT_TRUE(bootstrap());
|
| - bootstrap()->StopWithReason(ArcBridgeService::StopReason::CRASH);
|
| + ASSERT_TRUE(arc_session());
|
| + arc_session()->StopWithReason(ArcBridgeService::StopReason::CRASH);
|
| EXPECT_EQ(ArcBridgeService::StopReason::CRASH, stop_reason_);
|
| ASSERT_TRUE(service_->ready());
|
|
|
|
|