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

Side by Side Diff: components/arc/test/fake_arc_bridge_bootstrap.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_bridge_bootstrap.h ('k') | components/arc/test/fake_arc_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/arc/test/fake_arc_bridge_bootstrap.h"
6
7 #include <memory>
8
9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h"
11
12 namespace arc {
13
14 FakeArcBridgeBootstrap::FakeArcBridgeBootstrap() = default;
15
16 FakeArcBridgeBootstrap::~FakeArcBridgeBootstrap() = default;
17
18 void FakeArcBridgeBootstrap::Start() {
19 if (boot_failure_emulation_enabled_) {
20 for (auto& observer : observer_list_)
21 observer.OnStopped(boot_failure_reason_);
22 } else if (!boot_suspended_) {
23 for (auto& observer : observer_list_)
24 observer.OnReady();
25 }
26 }
27
28 void FakeArcBridgeBootstrap::Stop() {
29 StopWithReason(ArcBridgeService::StopReason::SHUTDOWN);
30 }
31
32 void FakeArcBridgeBootstrap::StopWithReason(
33 ArcBridgeService::StopReason reason) {
34 for (auto& observer : observer_list_)
35 observer.OnStopped(reason);
36 }
37
38 void FakeArcBridgeBootstrap::EnableBootFailureEmulation(
39 ArcBridgeService::StopReason reason) {
40 DCHECK(!boot_failure_emulation_enabled_);
41 DCHECK(!boot_suspended_);
42
43 boot_failure_emulation_enabled_ = true;
44 boot_failure_reason_ = reason;
45 }
46
47 void FakeArcBridgeBootstrap::SuspendBoot() {
48 DCHECK(!boot_failure_emulation_enabled_);
49 DCHECK(!boot_suspended_);
50
51 boot_suspended_ = true;
52 }
53
54 // static
55 std::unique_ptr<ArcBridgeBootstrap> FakeArcBridgeBootstrap::Create() {
56 return base::MakeUnique<FakeArcBridgeBootstrap>();
57 }
58
59 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/test/fake_arc_bridge_bootstrap.h ('k') | components/arc/test/fake_arc_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698