Merge lp:~nick-dedekind/qtmir/1541388.close-resumable into lp:qtmir

Proposed by Nick Dedekind
Status: Merged
Approved by: MichaƂ Sawicz
Approved revision: 442
Merged at revision: 439
Proposed branch: lp:~nick-dedekind/qtmir/1541388.close-resumable
Merge into: lp:qtmir
Diff against target: 56 lines (+38/-0)
2 files modified
src/modules/Unity/Application/application.cpp (+3/-0)
tests/modules/ApplicationManager/application_manager_test.cpp (+35/-0)
To merge this branch: bzr merge lp:~nick-dedekind/qtmir/1541388.close-resumable
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Michael Zanetti (community) Approve
Unity8 CI Bot (community) continuous-integration Needs Fixing
Review via email: mp+284947@code.launchpad.net

This proposal has been superseded by a proposal from 2016-02-03.

Commit message

Added fix and test for closing app during the StoppedResumable state.

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:439
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/57/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/57/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:442
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/58/
Executed test runs:

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-1-ci/58/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?

yes

 * Did CI run pass? If not, please explain why.

waiting. But tests are passing here.

 * Did you make sure that the branch does not contain spurious tags?

yes

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/Application/application.cpp'
2--- src/modules/Unity/Application/application.cpp 2016-01-22 16:32:39 +0000
3+++ src/modules/Unity/Application/application.cpp 2016-02-03 18:10:30 +0000
4@@ -425,6 +425,9 @@
5 // already on the way
6 break;
7 case InternalState::StoppedResumable:
8+ // session stopped while suspended. Stop it for good now.
9+ setInternalState(InternalState::Stopped);
10+ break;
11 case InternalState::Stopped:
12 // too late
13 break;
14
15=== modified file 'tests/modules/ApplicationManager/application_manager_test.cpp'
16--- tests/modules/ApplicationManager/application_manager_test.cpp 2016-01-22 16:32:39 +0000
17+++ tests/modules/ApplicationManager/application_manager_test.cpp 2016-02-03 18:10:30 +0000
18@@ -2170,3 +2170,38 @@
19 EXPECT_EQ(Application::Stopped, application->state());
20 EXPECT_EQ(spy.count(), 1);
21 }
22+
23+/*
24+ * Test that an application that fails while suspended will stop on close request
25+ */
26+TEST_F(ApplicationManagerTests,CloseWhenSuspendedProcessFailed)
27+{
28+ using namespace ::testing;
29+
30+ const QString appId("testAppId");
31+ quint64 procId = 5551;
32+
33+ auto application = startApplication(procId, "testAppId");
34+
35+ qtmir::Session* session(static_cast<qtmir::Session*>(application->session()));
36+
37+ FakeMirSurface *surface = new FakeMirSurface;
38+ onSessionCreatedSurface(session->session().get(), surface);
39+ surface->drawFirstFrame();
40+ EXPECT_EQ(Application::InternalState::Running, application->internalState());
41+
42+ // Session is suspended
43+ suspend(application);
44+
45+ // Process failed
46+ onSessionStopping(session->session());
47+ applicationManager.onProcessFailed(appId, true);
48+ applicationManager.onProcessStopped(appId);
49+ EXPECT_EQ(Application::InternalState::StoppedResumable, application->internalState());
50+
51+ QSignalSpy spy(application, SIGNAL(stopped()));
52+ application->close();
53+
54+ EXPECT_EQ(Application::Stopped, application->state());
55+ EXPECT_EQ(spy.count(), 1);
56+}

Subscribers

People subscribed via source and target branches