| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/arc/test/fake_arc_bridge_service.h" | 5 #include "components/arc/test/fake_arc_bridge_service.h" |
| 6 | 6 |
| 7 namespace arc { | 7 namespace arc { |
| 8 | 8 |
| 9 extern ArcBridgeService* g_arc_bridge_service; | 9 extern ArcBridgeService* g_arc_bridge_service; |
| 10 | 10 |
| 11 FakeArcBridgeService::FakeArcBridgeService() { | 11 FakeArcBridgeService::FakeArcBridgeService() { |
| 12 DCHECK(!g_arc_bridge_service); | 12 DCHECK(!g_arc_bridge_service); |
| 13 g_arc_bridge_service = this; | 13 g_arc_bridge_service = this; |
| 14 } | 14 } |
| 15 | 15 |
| 16 FakeArcBridgeService::~FakeArcBridgeService() { | 16 FakeArcBridgeService::~FakeArcBridgeService() { |
| 17 DCHECK(g_arc_bridge_service == this); | 17 DCHECK(g_arc_bridge_service == this); |
| 18 g_arc_bridge_service = nullptr; | 18 g_arc_bridge_service = nullptr; |
| 19 SetStopped(); | 19 SetStopped(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 void FakeArcBridgeService::HandleStartup() { | 22 void FakeArcBridgeService::RequestStart() { |
| 23 SetReady(); | 23 SetReady(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 void FakeArcBridgeService::Shutdown() { | 26 void FakeArcBridgeService::RequestStop() { |
| 27 SetStopped(); | 27 SetStopped(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void FakeArcBridgeService::OnShutdown() { |
| 31 SetStopped(); |
| 32 } |
| 33 |
| 30 void FakeArcBridgeService::SetReady() { | 34 void FakeArcBridgeService::SetReady() { |
| 31 if (state() != State::READY) | 35 if (state() != State::READY) |
| 32 SetState(State::READY); | 36 SetState(State::READY); |
| 33 } | 37 } |
| 34 | 38 |
| 35 void FakeArcBridgeService::SetStopped() { | 39 void FakeArcBridgeService::SetStopped() { |
| 36 if (state() != State::STOPPED) | 40 if (state() != State::STOPPED) |
| 37 SetState(State::STOPPED); | 41 SetState(State::STOPPED); |
| 38 } | 42 } |
| 39 | 43 |
| 40 bool FakeArcBridgeService::HasObserver(const Observer* observer) { | 44 bool FakeArcBridgeService::HasObserver(const Observer* observer) { |
| 41 return observer_list().HasObserver(observer); | 45 return observer_list().HasObserver(observer); |
| 42 } | 46 } |
| 43 | 47 |
| 44 } // namespace arc | 48 } // namespace arc |
| OLD | NEW |