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

Unified Diff: components/arc/arc_session_runner_unittest.cc

Issue 2720303002: Do nothing on OnSessionStopped if ARC is being restarted. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: components/arc/arc_session_runner_unittest.cc
diff --git a/components/arc/arc_session_runner_unittest.cc b/components/arc/arc_session_runner_unittest.cc
index 13b9ff8817ffd800fd4aa075b4293a23fa509623..7752358e5f9ba83d3f781e01a32194c943e72eb0 100644
--- a/components/arc/arc_session_runner_unittest.cc
+++ b/components/arc/arc_session_runner_unittest.cc
@@ -34,6 +34,7 @@ class ArcSessionRunnerTest : public testing::Test, public ArcSessionObserver {
chromeos::DBusThreadManager::Initialize();
stop_reason_ = StopReason::SHUTDOWN;
+ restarting_ = false;
// We inject FakeArcSession here so we do not need task_runner.
arc_session_runner_ =
@@ -56,6 +57,7 @@ class ArcSessionRunnerTest : public testing::Test, public ArcSessionObserver {
}
StopReason stop_reason() { return stop_reason_; }
+ bool restarting() { return restarting_; }
void ResetArcSessionFactory(
const ArcSessionRunner::ArcSessionFactory& factory) {
@@ -79,13 +81,15 @@ class ArcSessionRunnerTest : public testing::Test, public ArcSessionObserver {
private:
// ArcSessionObserver:
- void OnSessionStopped(StopReason stop_reason) override {
+ void OnSessionStopped(StopReason stop_reason, bool restarting) override {
// The instance is already destructed in
// ArcSessionRunner::OnSessionStopped().
stop_reason_ = stop_reason;
+ restarting_ = restarting;
}
StopReason stop_reason_;
+ bool restarting_;
std::unique_ptr<ArcSessionRunner> arc_session_runner_;
base::MessageLoopForUI message_loop_;
@@ -104,7 +108,7 @@ TEST_F(ArcSessionRunnerTest, Basic) {
// ArcSessionObserver:
void OnSessionReady() override { ready_called_ = true; }
- void OnSessionStopped(StopReason reason) override {
+ void OnSessionStopped(StopReason reason, bool restarting) override {
stopped_called_ = true;
}
@@ -193,6 +197,7 @@ TEST_F(ArcSessionRunnerTest, OnSessionStopped) {
ASSERT_TRUE(arc_session());
arc_session()->StopWithReason(StopReason::GENERIC_BOOT_FAILURE);
EXPECT_EQ(StopReason::GENERIC_BOOT_FAILURE, stop_reason());
+ EXPECT_TRUE(restarting());
EXPECT_TRUE(arc_session_runner()->IsStopped());
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(arc_session_runner()->IsRunning());
@@ -201,6 +206,7 @@ TEST_F(ArcSessionRunnerTest, OnSessionStopped) {
ASSERT_TRUE(arc_session());
arc_session()->StopWithReason(StopReason::CRASH);
EXPECT_EQ(StopReason::CRASH, stop_reason());
+ EXPECT_TRUE(restarting());
EXPECT_TRUE(arc_session_runner()->IsStopped());
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(arc_session_runner()->IsRunning());
@@ -208,6 +214,7 @@ TEST_F(ArcSessionRunnerTest, OnSessionStopped) {
// Graceful stop.
arc_session_runner()->RequestStop();
EXPECT_EQ(StopReason::SHUTDOWN, stop_reason());
+ EXPECT_FALSE(restarting());
EXPECT_TRUE(arc_session_runner()->IsStopped());
}

Powered by Google App Engine
This is Rietveld 408576698