| 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 eaafa7958cffde00fe6f0a5b2b07d9ad6694b0bc..0027542a40d526154306070c0a5d83aea7fca579 100644
|
| --- a/components/arc/arc_bridge_service_unittest.cc
|
| +++ b/components/arc/arc_bridge_service_unittest.cc
|
| @@ -19,6 +19,8 @@
|
|
|
| namespace arc {
|
|
|
| +namespace {
|
| +
|
| class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
|
| public:
|
| ArcBridgeTest() : ready_(false) {}
|
| @@ -56,7 +58,7 @@ class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
|
|
|
| instance_.reset(new FakeArcBridgeInstance());
|
| service_.reset(new ArcBridgeServiceImpl(
|
| - base::WrapUnique(new FakeArcBridgeBootstrap(instance_.get()))));
|
| + base::MakeUnique<FakeArcBridgeBootstrap>(instance_.get())));
|
|
|
| service_->AddObserver(this);
|
| }
|
| @@ -76,6 +78,10 @@ class ArcBridgeTest : public testing::Test, public ArcBridgeService::Observer {
|
| DISALLOW_COPY_AND_ASSIGN(ArcBridgeTest);
|
| };
|
|
|
| +class DummyObserver : public ArcBridgeService::Observer {};
|
| +
|
| +} // namespace
|
| +
|
| // Exercises the basic functionality of the ARC Bridge Service. A message from
|
| // within the instance should cause the observer to be notified.
|
| TEST_F(ArcBridgeTest, Basic) {
|
| @@ -138,4 +144,18 @@ TEST_F(ArcBridgeTest, Restart) {
|
| ASSERT_EQ(ArcBridgeService::State::STOPPED, state());
|
| }
|
|
|
| +// Removing the same observer more than once should be okay.
|
| +TEST_F(ArcBridgeTest, RemoveObserverTwice) {
|
| + ASSERT_FALSE(ready());
|
| + service_->RemoveObserver(this);
|
| + // The teardown method will also remove |this|.
|
| +}
|
| +
|
| +// Removing an unknown observer should be allowed.
|
| +TEST_F(ArcBridgeTest, RemoveUnknownObserver) {
|
| + ASSERT_FALSE(ready());
|
| + auto dummy_observer = base::MakeUnique<DummyObserver>();
|
| + service_->RemoveObserver(dummy_observer.get());
|
| +}
|
| +
|
| } // namespace arc
|
|
|