Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: components/arc/test/fake_arc_session.cc

Issue 2425753002: Rename ArcBridgeBootstrap to ArcSession. (Closed)
Patch Set: Address comment. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/arc/test/fake_arc_session.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_bootstrap.h" 5 #include "components/arc/test/fake_arc_session.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 11
12 namespace arc { 12 namespace arc {
13 13
14 FakeArcBridgeBootstrap::FakeArcBridgeBootstrap() = default; 14 FakeArcSession::FakeArcSession() = default;
15 15
16 FakeArcBridgeBootstrap::~FakeArcBridgeBootstrap() = default; 16 FakeArcSession::~FakeArcSession() = default;
17 17
18 void FakeArcBridgeBootstrap::Start() { 18 void FakeArcSession::Start() {
19 if (boot_failure_emulation_enabled_) { 19 if (boot_failure_emulation_enabled_) {
20 for (auto& observer : observer_list_) 20 for (auto& observer : observer_list_)
21 observer.OnStopped(boot_failure_reason_); 21 observer.OnStopped(boot_failure_reason_);
22 } else if (!boot_suspended_) { 22 } else if (!boot_suspended_) {
23 for (auto& observer : observer_list_) 23 for (auto& observer : observer_list_)
24 observer.OnReady(); 24 observer.OnReady();
25 } 25 }
26 } 26 }
27 27
28 void FakeArcBridgeBootstrap::Stop() { 28 void FakeArcSession::Stop() {
29 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN); 29 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN);
30 } 30 }
31 31
32 void FakeArcBridgeBootstrap::StopWithReason( 32 void FakeArcSession::StopWithReason(ArcBridgeService::StopReason reason) {
33 ArcBridgeService::StopReason reason) {
34 for (auto& observer : observer_list_) 33 for (auto& observer : observer_list_)
35 observer.OnStopped(reason); 34 observer.OnStopped(reason);
36 } 35 }
37 36
38 void FakeArcBridgeBootstrap::EnableBootFailureEmulation( 37 void FakeArcSession::EnableBootFailureEmulation(
39 ArcBridgeService::StopReason reason) { 38 ArcBridgeService::StopReason reason) {
40 DCHECK(!boot_failure_emulation_enabled_); 39 DCHECK(!boot_failure_emulation_enabled_);
41 DCHECK(!boot_suspended_); 40 DCHECK(!boot_suspended_);
42 41
43 boot_failure_emulation_enabled_ = true; 42 boot_failure_emulation_enabled_ = true;
44 boot_failure_reason_ = reason; 43 boot_failure_reason_ = reason;
45 } 44 }
46 45
47 void FakeArcBridgeBootstrap::SuspendBoot() { 46 void FakeArcSession::SuspendBoot() {
48 DCHECK(!boot_failure_emulation_enabled_); 47 DCHECK(!boot_failure_emulation_enabled_);
49 DCHECK(!boot_suspended_); 48 DCHECK(!boot_suspended_);
50 49
51 boot_suspended_ = true; 50 boot_suspended_ = true;
52 } 51 }
53 52
54 // static 53 // static
55 std::unique_ptr<ArcBridgeBootstrap> FakeArcBridgeBootstrap::Create() { 54 std::unique_ptr<ArcSession> FakeArcSession::Create() {
56 return base::MakeUnique<FakeArcBridgeBootstrap>(); 55 return base::MakeUnique<FakeArcSession>();
57 } 56 }
58 57
59 } // namespace arc 58 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/test/fake_arc_session.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698