| 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 FakeArcBridgeService::FakeArcBridgeService() = default; |
| 10 | |
| 11 FakeArcBridgeService::FakeArcBridgeService() { | |
| 12 DCHECK(!g_arc_bridge_service); | |
| 13 g_arc_bridge_service = this; | |
| 14 } | |
| 15 | 10 |
| 16 FakeArcBridgeService::~FakeArcBridgeService() { | 11 FakeArcBridgeService::~FakeArcBridgeService() { |
| 17 DCHECK(g_arc_bridge_service == this); | |
| 18 g_arc_bridge_service = nullptr; | |
| 19 SetStopped(); | 12 SetStopped(); |
| 20 } | 13 } |
| 21 | 14 |
| 22 void FakeArcBridgeService::RequestStart() { | 15 void FakeArcBridgeService::RequestStart() { |
| 23 SetReady(); | 16 SetReady(); |
| 24 } | 17 } |
| 25 | 18 |
| 26 void FakeArcBridgeService::RequestStop() { | 19 void FakeArcBridgeService::RequestStop() { |
| 27 SetStopped(); | 20 SetStopped(); |
| 28 } | 21 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 void FakeArcBridgeService::SetStopped() { | 32 void FakeArcBridgeService::SetStopped() { |
| 40 if (state() != State::STOPPED) | 33 if (state() != State::STOPPED) |
| 41 SetState(State::STOPPED); | 34 SetState(State::STOPPED); |
| 42 } | 35 } |
| 43 | 36 |
| 44 bool FakeArcBridgeService::HasObserver(const Observer* observer) { | 37 bool FakeArcBridgeService::HasObserver(const Observer* observer) { |
| 45 return observer_list().HasObserver(observer); | 38 return observer_list().HasObserver(observer); |
| 46 } | 39 } |
| 47 | 40 |
| 48 } // namespace arc | 41 } // namespace arc |
| OLD | NEW |