From 8464c06dcd08be9a7bf74b8812a1953b510d6e73 Mon Sep 17 00:00:00 2001 From: Daniel d'Andrada Date: Thu, 20 Aug 2015 12:59:48 -0300 Subject: s/StoppedUnexpectedly/StoppedResumable To better convey what this state means Change-Id: Ie80906909ce8c65c4d90fc7ad14b0f0f25891310 Reviewed-by: Paul Olav Tvete --- src/modules/Unity/Application/application.cpp | 22 +++++++++++----------- src/modules/Unity/Application/application.h | 2 +- tests/modules/Application/application_test.cpp | 4 ++-- tests/modules/common/qtmir_test.cpp | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/modules/Unity/Application/application.cpp b/src/modules/Unity/Application/application.cpp index 5104894..18fdaf2 100644 --- a/src/modules/Unity/Application/application.cpp +++ b/src/modules/Unity/Application/application.cpp @@ -203,8 +203,8 @@ const char* Application::internalStateToStr(InternalState state) return "SuspendingWaitProcess"; case InternalState::Suspended: return "Suspended"; - case InternalState::StoppedUnexpectedly: - return "StoppedUnexpectedly"; + case InternalState::StoppedResumable: + return "StoppedResumable"; case InternalState::Stopped: return "Stopped"; default: @@ -321,7 +321,7 @@ void Application::applyRequestedRunning() case InternalState::SuspendingWaitProcess: // should leave the app alone until it reaches Suspended state break; - case InternalState::StoppedUnexpectedly: + case InternalState::StoppedResumable: respawn(); break; case InternalState::Stopped: @@ -350,7 +350,7 @@ void Application::applyRequestedSuspended() case InternalState::Suspended: // it's already going where we it's wanted break; - case InternalState::StoppedUnexpectedly: + case InternalState::StoppedResumable: case InternalState::Stopped: // the app doesn't have a process in the first place, so there's nothing to suspend break; @@ -431,7 +431,7 @@ void Application::setSession(SessionInterface *newSession) Q_EMIT fullscreenChanged(fullscreen()); } else { // this can only happen after the session has stopped and QML code called Session::release() - Q_ASSERT(m_state == InternalState::Stopped || m_state == InternalState::StoppedUnexpectedly); + Q_ASSERT(m_state == InternalState::Stopped || m_state == InternalState::StoppedResumable); } Q_EMIT sessionChanged(m_session); @@ -474,7 +474,7 @@ void Application::setInternalState(Application::InternalState state) case InternalState::Suspended: releaseWakelock(); break; - case InternalState::StoppedUnexpectedly: + case InternalState::StoppedResumable: releaseWakelock(); break; case InternalState::Stopped: @@ -519,7 +519,7 @@ void Application::setProcessState(ProcessState newProcessState) Q_ASSERT(false); break; case ProcessRunning: - if (m_state == InternalState::StoppedUnexpectedly) { + if (m_state == InternalState::StoppedResumable) { setInternalState(InternalState::Starting); } break; @@ -536,7 +536,7 @@ void Application::setProcessState(ProcessState newProcessState) setInternalState(InternalState::Stopped); } else { Q_ASSERT(m_state == InternalState::Stopped - || m_state == InternalState::StoppedUnexpectedly); + || m_state == InternalState::StoppedResumable); } break; case ProcessStopped: @@ -546,8 +546,8 @@ void Application::setProcessState(ProcessState newProcessState) if (m_state == InternalState::Starting) { // that was way too soon. let it go away setInternalState(InternalState::Stopped); - } else if (m_state == InternalState::StoppedUnexpectedly) { - // the application stopped nicely, likely closed itself. Thus not really unexpected after all. + } else if (m_state == InternalState::StoppedResumable) { + // The application stopped nicely, likely closed itself. Thus not meant to be resumed later. setInternalState(InternalState::Stopped); } else { Q_ASSERT(m_state == InternalState::Stopped); @@ -668,7 +668,7 @@ void Application::onSessionStateChanged(Session::State sessionState) */ setInternalState(InternalState::Stopped); } else { - setInternalState(InternalState::StoppedUnexpectedly); + setInternalState(InternalState::StoppedResumable); } } } diff --git a/src/modules/Unity/Application/application.h b/src/modules/Unity/Application/application.h index 24a7a7f..a5069ba 100644 --- a/src/modules/Unity/Application/application.h +++ b/src/modules/Unity/Application/application.h @@ -72,7 +72,7 @@ public: SuspendingWaitSession, SuspendingWaitProcess, Suspended, - StoppedUnexpectedly, + StoppedResumable, Stopped // It closed itself, crashed or it stopped and we can't respawn it // In any case, this is a dead end. }; diff --git a/tests/modules/Application/application_test.cpp b/tests/modules/Application/application_test.cpp index 0e10f46..1c4adf1 100644 --- a/tests/modules/Application/application_test.cpp +++ b/tests/modules/Application/application_test.cpp @@ -119,7 +119,7 @@ TEST_F(ApplicationTests, checkRespawnAcquiresWakeLock) ASSERT_EQ(Application::InternalState::Suspended, application->internalState()); session->setState(SessionInterface::Stopped); application->setProcessState(Application::ProcessKilled); - ASSERT_EQ(Application::InternalState::StoppedUnexpectedly, application->internalState()); + ASSERT_EQ(Application::InternalState::StoppedResumable, application->internalState()); EXPECT_FALSE(sharedWakelock.enabled()); @@ -282,7 +282,7 @@ TEST_F(ApplicationTests, doesNotEmitStoppedWhenKilledWhileSuspended) application->setProcessState(Application::ProcessKilled); - ASSERT_EQ(Application::InternalState::StoppedUnexpectedly, application->internalState()); + ASSERT_EQ(Application::InternalState::StoppedResumable, application->internalState()); ASSERT_EQ(0, spyAppStopped.count()); diff --git a/tests/modules/common/qtmir_test.cpp b/tests/modules/common/qtmir_test.cpp index 35c9674..606d5bf 100644 --- a/tests/modules/common/qtmir_test.cpp +++ b/tests/modules/common/qtmir_test.cpp @@ -38,8 +38,8 @@ void PrintTo(const Application::InternalState& state, ::std::ostream* os) { case Application::InternalState::Suspended: *os << "Suspended"; break; - case Application::InternalState::StoppedUnexpectedly: - *os << "StoppedUnexpectedly"; + case Application::InternalState::StoppedResumable: + *os << "StoppedResumable"; break; case Application::InternalState::Stopped: *os << "Stopped"; -- cgit v1.2.3