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

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

Issue 2720303002: Do nothing on OnSessionStopped if ARC is being restarted. (Closed)
Patch Set: Address comments. Created 3 years, 9 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/arc_stop_reason.cc ('k') | components/arc/test/fake_arc_session.cc » ('j') | 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 #ifndef COMPONENTS_ARC_TEST_FAKE_ARC_SESSION_H_ 5 #ifndef COMPONENTS_ARC_TEST_FAKE_ARC_SESSION_H_
6 #define COMPONENTS_ARC_TEST_FAKE_ARC_SESSION_H_ 6 #define COMPONENTS_ARC_TEST_FAKE_ARC_SESSION_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "components/arc/arc_session.h" 11 #include "components/arc/arc_session.h"
12 #include "components/arc/arc_session_observer.h" 12 #include "components/arc/arc_stop_reason.h"
13 13
14 namespace arc { 14 namespace arc {
15 15
16 // A fake ArcSession that creates a local connection. 16 // A fake ArcSession that creates a local connection.
17 class FakeArcSession : public ArcSession { 17 class FakeArcSession : public ArcSession {
18 public: 18 public:
19 FakeArcSession(); 19 FakeArcSession();
20 ~FakeArcSession() override; 20 ~FakeArcSession() override;
21 21
22 // ArcSession overrides: 22 // ArcSession overrides:
23 void Start() override; 23 void Start() override;
24 void Stop() override; 24 void Stop() override;
25 void OnShutdown() override; 25 void OnShutdown() override;
26 26
27 // To emulate unexpected stop, such as crash. 27 // To emulate unexpected stop, such as crash.
28 void StopWithReason(ArcSessionObserver::StopReason reason); 28 void StopWithReason(ArcStopReason reason);
29 29
30 // The following control Start() behavior for testing various situations. 30 // The following control Start() behavior for testing various situations.
31 31
32 // Enables/disables boot failure emulation, in which OnStopped(reason) will 32 // Enables/disables boot failure emulation, in which OnStopped(reason) will
33 // be called when Start() is called. 33 // be called when Start() is called.
34 void EnableBootFailureEmulation(ArcSessionObserver::StopReason reason); 34 void EnableBootFailureEmulation(ArcStopReason reason);
35 35
36 // Emulate Start() is suspended at some phase, before OnReady() is invoked. 36 // Emulate Start() is suspended at some phase, before OnReady() is invoked.
37 void SuspendBoot(); 37 void SuspendBoot();
38 38
39 // Returns FakeArcSession instance. This can be used for a factory 39 // Returns FakeArcSession instance. This can be used for a factory
40 // in ArcBridgeServiceImpl. 40 // in ArcBridgeServiceImpl.
41 static std::unique_ptr<ArcSession> Create(); 41 static std::unique_ptr<ArcSession> Create();
42 42
43 private: 43 private:
44 bool boot_failure_emulation_enabled_ = false; 44 bool boot_failure_emulation_enabled_ = false;
45 ArcSessionObserver::StopReason boot_failure_reason_; 45 ArcStopReason boot_failure_reason_;
46 46
47 bool boot_suspended_ = false; 47 bool boot_suspended_ = false;
48 48
49 DISALLOW_COPY_AND_ASSIGN(FakeArcSession); 49 DISALLOW_COPY_AND_ASSIGN(FakeArcSession);
50 }; 50 };
51 51
52 } // namespace arc 52 } // namespace arc
53 53
54 #endif // COMPONENTS_ARC_TEST_FAKE_ARC_SESSION_H_ 54 #endif // COMPONENTS_ARC_TEST_FAKE_ARC_SESSION_H_
OLDNEW
« no previous file with comments | « components/arc/arc_stop_reason.cc ('k') | components/arc/test/fake_arc_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698