Merge lp:~mterry/ubuntu-app-launch/look-at-mir into lp:ubuntu-app-launch

Proposed by Michael Terry on 2017-02-16
Status: Merged
Approved by: Michael Terry on 2017-03-09
Approved revision: 291
Merged at revision: 299
Proposed branch: lp:~mterry/ubuntu-app-launch/look-at-mir
Merge into: lp:ubuntu-app-launch
Prerequisite: lp:~ted/ubuntu-app-launch/zg-ordering
Diff against target: 438 lines (+124/-100)
5 files modified
libubuntu-app-launch/application-impl-snap.cpp (+61/-69)
libubuntu-app-launch/application-impl-snap.h (+5/-11)
tests/applications/qmlapp.desktop (+8/-0)
tests/libual-cpp-test.cc (+24/-1)
tests/list-apps.cpp (+26/-19)
To merge this branch: bzr merge lp:~mterry/ubuntu-app-launch/look-at-mir
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration 2017-02-16 Approve on 2017-03-09
Larry Price 2017-02-16 Approve on 2017-03-09
Review via email: mp+317520@code.launchpad.net

This proposal supersedes a proposal from 2017-02-14.

Commit Message

Use the "mir" interface (not the "unity8" interface) to decide if an app supports Mir or not.

Description of the Change

I know we were initially considering having the mir socket permissions in the unity8 interface. But they now live in the mir interface, so that's what we should pay attention to.

I left the "look at unity8 for lifecycle support" bits intact.

To post a comment you must log in.
Michael Terry (mterry) wrote : Posted in a previous version of this proposal

Hmm, I set this to WIP while I looked at the test failures. But I think they're all from the libertine moving target. I'll go back to Ready and just wait for that silo to land. Then see what CI says. This seems to be clear if I merge in the pending branches...

unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:289
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/236/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/1728/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1735
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1510
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1510/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1510/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1510
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1510/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1510/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1510
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1510/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1510/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/236/rebuild

review: Needs Fixing (continuous-integration)
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:289
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/253/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1763
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1770
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1546
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1546
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1546
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1546
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1546
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1546/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1546
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1546/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/253/rebuild

review: Approve (continuous-integration)
Larry Price (larryprice) wrote :

lgtm

review: Approve
290. By Michael Terry on 2017-03-09

Merge trunk

291. By Michael Terry on 2017-03-09

Add test for how trying to create non-graphical app Application object fails

unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:291
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/254/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1768
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1775
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1551
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1551/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1551
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1551/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1551
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1551/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1551
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1551/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1551
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1551/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1551
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1551/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/254/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libubuntu-app-launch/application-impl-snap.cpp'
2--- libubuntu-app-launch/application-impl-snap.cpp 2017-02-15 15:09:51 +0000
3+++ libubuntu-app-launch/application-impl-snap.cpp 2017-03-09 16:05:52 +0000
4@@ -35,9 +35,11 @@
5 ************************/
6
7 /** All the interfaces that we run XMir for by default */
8-const std::set<std::string> XMIR_INTERFACES{"unity7", "x11"};
9-/** All the interfaces that we tell Unity support lifecycle */
10-const std::set<std::string> LIFECYCLE_INTERFACES{"unity8"};
11+const std::set<std::string> X11_INTERFACES{"unity7", "x11"};
12+/** The interface to indicate direct Mir support */
13+const std::string MIR_INTERFACE{"mir"};
14+/** The interface to indicate Ubuntu lifecycle support */
15+const std::string LIFECYCLE_INTERFACE{"unity8"};
16 /** Snappy has more restrictive appnames than everyone else */
17 const std::regex appnameRegex{"^[a-zA-Z0-9](?:-?[a-zA-Z0-9])*$"};
18
19@@ -50,15 +52,13 @@
20 fields to the desktop spec that come from Snappy interfaces. */
21 class SnapInfo : public app_info::Desktop
22 {
23- /** The core interface for this snap */
24- std::string interface_;
25 /** AppID of snap */
26 AppID appId_;
27
28 public:
29 SnapInfo(const AppID& appid,
30 const std::shared_ptr<Registry>& registry,
31- const std::string& interface,
32+ const Snap::InterfaceInfo &interfaceInfo,
33 const std::string& snapDir)
34 : Desktop(appid,
35 [appid, snapDir]() -> std::shared_ptr<GKeyFile> {
36@@ -112,37 +112,10 @@
37 snapDir,
38 app_info::DesktopFlags::NONE,
39 registry)
40- , interface_(interface)
41 , appId_(appid)
42 {
43- }
44-
45- /** Return the xMirEnable value based on whether the interface is
46- in the list of interfaces using XMir */
47- XMirEnable xMirEnable() override
48- {
49- if (XMIR_INTERFACES.find(interface_) != XMIR_INTERFACES.end())
50- {
51- return XMirEnable::from_raw(true);
52- }
53- else
54- {
55- return XMirEnable::from_raw(false);
56- }
57- }
58-
59- /** Return the xMirEnable value based on whether the interface is
60- in the list of interfaces supporting the lifecycle */
61- UbuntuLifecycle supportsUbuntuLifecycle() override
62- {
63- if (LIFECYCLE_INTERFACES.find(interface_) != LIFECYCLE_INTERFACES.end())
64- {
65- return UbuntuLifecycle::from_raw(true);
66- }
67- else
68- {
69- return UbuntuLifecycle::from_raw(false);
70- }
71+ _xMirEnable = std::get<0>(interfaceInfo);
72+ _ubuntuLifecycle = std::get<1>(interfaceInfo);
73 }
74
75 /** Figures out the exec line for a snappy command. We're not using
76@@ -206,12 +179,11 @@
77
78 \param appid Application ID of the snap
79 \param registry Registry to use for persistent connections
80- \param interface Primary interface that we found this snap for
81+ \param interfaceInfo Metadata gleaned from the snap's interfaces
82 */
83-Snap::Snap(const AppID& appid, const std::shared_ptr<Registry>& registry, const std::string& interface)
84+Snap::Snap(const AppID& appid, const std::shared_ptr<Registry>& registry, const InterfaceInfo &interfaceInfo)
85 : Base(registry)
86 , appid_(appid)
87- , interface_(interface)
88 {
89 pkgInfo_ = registry->impl->snapdInfo.pkgInfo(appid.package);
90 if (!pkgInfo_)
91@@ -224,19 +196,19 @@
92 throw std::runtime_error("AppID does not match installed package for: " + std::string(appid));
93 }
94
95- info_ = std::make_shared<SnapInfo>(appid_, _registry, interface_, pkgInfo_->directory);
96+ info_ = std::make_shared<SnapInfo>(appid_, _registry, interfaceInfo, pkgInfo_->directory);
97
98 g_debug("Application Snap object for AppID '%s'", std::string(appid).c_str());
99 }
100
101-/** Uses the findInterface() function to find the interface if we don't
102+/** Uses the findInterfaceInfo() function to find the interface if we don't
103 have one.
104
105 \param appid Application ID of the snap
106 \param registry Registry to use for persistent connections
107 */
108 Snap::Snap(const AppID& appid, const std::shared_ptr<Registry>& registry)
109- : Snap(appid, registry, findInterface(appid, registry))
110+ : Snap(appid, registry, findInterfaceInfo(appid, registry))
111 {
112 }
113
114@@ -258,12 +230,27 @@
115 {
116 std::set<std::shared_ptr<Application>, appcompare> apps;
117
118- auto addAppsForInterface = [&](const std::string& interface) {
119+ auto lifecycleApps = registry->impl->snapdInfo.appsForInterface(LIFECYCLE_INTERFACE);
120+
121+ auto lifecycleForApp = [&](const AppID &appID) {
122+ auto iterator = lifecycleApps.find(appID);
123+ if (iterator == lifecycleApps.end())
124+ {
125+ return Application::Info::UbuntuLifecycle::from_raw(false);
126+ }
127+ else
128+ {
129+ return Application::Info::UbuntuLifecycle::from_raw(true);
130+ }
131+ };
132+
133+ auto addAppsForInterface = [&](const std::string& interface, app_info::Desktop::XMirEnable xMirEnable) {
134 for (const auto& id : registry->impl->snapdInfo.appsForInterface(interface))
135 {
136+ auto interfaceInfo = std::make_tuple(xMirEnable, lifecycleForApp(id));
137 try
138 {
139- auto app = std::make_shared<Snap>(id, registry, interface);
140+ auto app = std::make_shared<Snap>(id, registry, interfaceInfo);
141 apps.emplace(app);
142 }
143 catch (std::runtime_error& e)
144@@ -273,15 +260,12 @@
145 }
146 };
147
148- for (const auto& interface : LIFECYCLE_INTERFACES)
149- {
150- addAppsForInterface(interface);
151- }
152+ addAppsForInterface(MIR_INTERFACE, app_info::Desktop::XMirEnable::from_raw(false));
153
154 /* If an app has both, this will get rejected */
155- for (const auto& interface : XMIR_INTERFACES)
156+ for (const auto& interface : X11_INTERFACES)
157 {
158- addAppsForInterface(interface);
159+ addAppsForInterface(interface, app_info::Desktop::XMirEnable::from_raw(true));
160 }
161
162 return std::list<std::shared_ptr<Application>>(apps.begin(), apps.end());
163@@ -293,33 +277,41 @@
164 return appid_;
165 }
166
167-/** Asks Snapd for the interfaces to determine which one the application
168+/** Asks Snapd for the interfaces to determine which ones the application
169 can support.
170
171 \param appid Application ID of the snap
172 \param registry Registry to use for persistent connections
173 */
174-std::string Snap::findInterface(const AppID& appid, const std::shared_ptr<Registry>& registry)
175+Snap::InterfaceInfo Snap::findInterfaceInfo(const AppID& appid, const std::shared_ptr<Registry>& registry)
176 {
177 auto ifaceset = registry->impl->snapdInfo.interfacesForAppId(appid);
178-
179- for (const auto& interface : LIFECYCLE_INTERFACES)
180- {
181- if (ifaceset.find(interface) != ifaceset.end())
182- {
183- return interface;
184- }
185- }
186-
187- for (const auto& interface : XMIR_INTERFACES)
188- {
189- if (ifaceset.find(interface) != ifaceset.end())
190- {
191- return interface;
192- }
193- }
194-
195- throw std::runtime_error("Interface not found for: " + std::string(appid));
196+ auto xMirEnable = app_info::Desktop::XMirEnable::from_raw(false);
197+ auto ubuntuLifecycle = Application::Info::UbuntuLifecycle::from_raw(false);
198+
199+ if (ifaceset.find(LIFECYCLE_INTERFACE) != ifaceset.end())
200+ {
201+ ubuntuLifecycle = Application::Info::UbuntuLifecycle::from_raw(true);
202+ }
203+
204+ if (ifaceset.find(MIR_INTERFACE) == ifaceset.end())
205+ {
206+ for (const auto& interface : X11_INTERFACES)
207+ {
208+ if (ifaceset.find(interface) != ifaceset.end())
209+ {
210+ xMirEnable = app_info::Desktop::XMirEnable::from_raw(true);
211+ break;
212+ }
213+ }
214+
215+ if (!xMirEnable.value())
216+ {
217+ throw std::runtime_error("Graphical interface not found for: " + std::string(appid));
218+ }
219+ }
220+
221+ return std::make_tuple(xMirEnable, ubuntuLifecycle);
222 }
223
224 /** Checks a PkgInfo structure to ensure that it matches the AppID */
225
226=== modified file 'libubuntu-app-launch/application-impl-snap.h'
227--- libubuntu-app-launch/application-impl-snap.h 2017-02-15 15:09:51 +0000
228+++ libubuntu-app-launch/application-impl-snap.h 2017-03-09 16:05:52 +0000
229@@ -34,7 +34,7 @@
230 system as Snaps. This class connects to snapd to get information
231 on the interfaces of the installed snaps and sees if any of them
232 are applicable to the user session. Currently that means if the
233- command has the unity8, unity7 or x11 interface.
234+ command has the mir, unity8, unity7 or x11 interfaces.
235
236 For Application IDs snaps use a very similar scheme to Click
237 packages. The package field is the name of the snap package, typically
238@@ -48,8 +48,10 @@
239 class Snap : public Base
240 {
241 public:
242+ typedef std::tuple<app_info::Desktop::XMirEnable, Application::Info::UbuntuLifecycle> InterfaceInfo;
243+
244 Snap(const AppID& appid, const std::shared_ptr<Registry>& registry);
245- Snap(const AppID& appid, const std::shared_ptr<Registry>& registry, const std::string& interface);
246+ Snap(const AppID& appid, const std::shared_ptr<Registry>& registry, const InterfaceInfo &interfaceInfo);
247
248 static std::list<std::shared_ptr<Application>> list(const std::shared_ptr<Registry>& registry);
249
250@@ -79,11 +81,6 @@
251
252 static std::shared_ptr<info_watcher::Base> createInfoWatcher(const std::shared_ptr<Registry>& reg);
253
254- const std::string& getInterface() const
255- {
256- return interface_;
257- }
258-
259 private:
260 /** AppID of the Snap. Should be the name of the snap package.
261 The name of the command. And then the revision. */
262@@ -91,14 +88,11 @@
263 /** The app's displayed information. Should be from a desktop
264 file that is put in ${SNAP_DIR}/meta/gui/${command}.desktop */
265 std::shared_ptr<app_info::Desktop> info_;
266- /** Which interface we thing we're coming from. Depends on how
267- we handle setting up the environment for the command. */
268- std::string interface_;
269 /** Information that we get from Snapd on the package */
270 std::shared_ptr<snapd::Info::PkgInfo> pkgInfo_;
271
272 std::list<std::pair<std::string, std::string>> launchEnv();
273- static std::string findInterface(const AppID& appid, const std::shared_ptr<Registry>& registry);
274+ static InterfaceInfo findInterfaceInfo(const AppID& appid, const std::shared_ptr<Registry>& registry);
275 static bool checkPkgInfo(const std::shared_ptr<snapd::Info::PkgInfo>& pkginfo, const AppID& appid);
276 };
277
278
279=== added file 'tests/applications/qmlapp.desktop'
280--- tests/applications/qmlapp.desktop 1970-01-01 00:00:00 +0000
281+++ tests/applications/qmlapp.desktop 2017-03-09 16:05:52 +0000
282@@ -0,0 +1,8 @@
283+[Desktop Entry]
284+Name=Qml App
285+Type=Application
286+Exec=qmlapp
287+NoDisplay=false
288+Hidden=false
289+Terminal=false
290+Icon=/snap/unity8-package/current/qmlapp.png
291
292=== modified file 'tests/libual-cpp-test.cc'
293--- tests/libual-cpp-test.cc 2017-02-15 15:10:07 +0000
294+++ tests/libual-cpp-test.cc 2017-03-09 16:05:52 +0000
295@@ -529,11 +529,15 @@
296 static std::pair<std::string, std::string> interfaces{
297 "GET /v2/interfaces HTTP/1.1\r\nHost: snapd\r\nAccept: */*\r\n\r\n",
298 SnapdMock::httpJsonResponse(SnapdMock::snapdOkay(
299- SnapdMock::interfacesJson({{"unity8", "unity8-package", {"foo", "single", "xmir", "noxmir"}}})))};
300+ SnapdMock::interfacesJson({{"mir", "unity8-package", {"foo", "single", "xmir", "noxmir"}}})))};
301 static std::pair<std::string, std::string> u8Package{
302 "GET /v2/snaps/unity8-package HTTP/1.1\r\nHost: snapd\r\nAccept: */*\r\n\r\n",
303 SnapdMock::httpJsonResponse(SnapdMock::snapdOkay(SnapdMock::packageJson(
304 "unity8-package", "active", "app", "1.2.3.4", "x123", {"foo", "single", "xmir", "noxmir"})))};
305+static std::pair<std::string, std::string> helloPackage{
306+ "GET /v2/snaps/hello HTTP/1.1\r\nHost: snapd\r\nAccept: */*\r\n\r\n",
307+ SnapdMock::httpJsonResponse(SnapdMock::snapdOkay(SnapdMock::packageJson(
308+ "hello", "active", "app", "1.0", "1", {"hello"})))};
309
310 TEST_F(LibUAL, ApplicationIdSnap)
311 {
312@@ -595,6 +599,25 @@
313 EXPECT_EQ(expected, app->info()->iconPath().value());
314 }
315
316+TEST_F(LibUAL, NoGraphicalSnapInterface)
317+{
318+ SnapdMock snapd{LOCAL_SNAPD_TEST_SOCKET, {helloPackage, interfaces, helloPackage}};
319+ registry = std::make_shared<ubuntu::app_launch::Registry>();
320+
321+ auto appid = ubuntu::app_launch::AppID::parse("hello_hello_1");
322+
323+ try {
324+ ubuntu::app_launch::Application::create(appid, registry);
325+ FAIL() << "Expected std::runtime_error";
326+ }
327+ catch(std::runtime_error const & err) {
328+ EXPECT_EQ(err.what(), std::string("Graphical interface not found for: hello_hello_1"));
329+ }
330+ catch(...) {
331+ FAIL() << "Expected std::runtime_error";
332+ }
333+}
334+
335 TEST_F(LibUAL, StartSnapApplication)
336 {
337 SnapdMock snapd{LOCAL_SNAPD_TEST_SOCKET, {u8Package, interfaces, u8Package}};
338
339=== modified file 'tests/list-apps.cpp'
340--- tests/list-apps.cpp 2017-02-14 15:57:05 +0000
341+++ tests/list-apps.cpp 2017-03-09 16:05:52 +0000
342@@ -211,6 +211,7 @@
343 "GET /v2/interfaces HTTP/1.1\r\nHost: snapd\r\nAccept: */*\r\n\r\n",
344 SnapdMock::httpJsonResponse(
345 SnapdMock::snapdOkay(SnapdMock::interfacesJson({{"unity8", "unity8-package", {"foo", "bar"}},
346+ {"mir", "unity8-package", {"qmlapp"}},
347 {"unity7", "unity8-package", {"foo"}},
348 {"unity7", "unity7-package", {"single", "multiple"}},
349 {"x11", "x11-package", {"multiple", "hidden"}}
350@@ -219,7 +220,7 @@
351 static std::pair<std::string, std::string> u8Package{
352 "GET /v2/snaps/unity8-package HTTP/1.1\r\nHost: snapd\r\nAccept: */*\r\n\r\n",
353 SnapdMock::httpJsonResponse(SnapdMock::snapdOkay(
354- SnapdMock::packageJson("unity8-package", "active", "app", "1.2.3.4", "x123", {"foo", "bar"})))};
355+ SnapdMock::packageJson("unity8-package", "active", "app", "1.2.3.4", "x123", {"foo", "bar", "qmlapp"})))};
356 static std::pair<std::string, std::string> u7Package{
357 "GET /v2/snaps/unity7-package HTTP/1.1\r\nHost: snapd\r\nAccept: */*\r\n\r\n",
358 SnapdMock::httpJsonResponse(SnapdMock::snapdOkay(SnapdMock::packageJson(
359@@ -232,9 +233,10 @@
360 TEST_F(ListApps, ListSnap)
361 {
362 SnapdMock mock{SNAPD_LIST_APPS_SOCKET,
363- {interfaces, u8Package, u8Package, u8Package, /* unity8 check */
364+ {interfaces, u8Package, /* unity8 check */
365+ interfaces, u8Package, u8Package, /* mir check */
366 interfaces, u8Package, u7Package, u7Package, u7Package, u8Package, /* unity7 check */
367- interfaces, x11Package, x11Package, x11Package}}; /* x11 check */
368+ interfaces, x11Package, x11Package, x11Package}}; /* x11 check */
369 auto registry = std::make_shared<ubuntu::app_launch::Registry>();
370
371 auto apps = ubuntu::app_launch::app_impls::Snap::list(registry);
372@@ -243,8 +245,9 @@
373
374 mock.result();
375
376- EXPECT_EQ(4, int(apps.size()));
377+ EXPECT_EQ(5, int(apps.size()));
378 EXPECT_TRUE(findApp(apps, "unity8-package_foo_x123"));
379+ EXPECT_TRUE(findApp(apps, "unity8-package_qmlapp_x123"));
380 EXPECT_TRUE(findApp(apps, "unity7-package_single_x123"));
381 EXPECT_TRUE(findApp(apps, "unity7-package_multiple_x123"));
382 EXPECT_TRUE(findApp(apps, "x11-package_multiple_x123"));
383@@ -253,18 +256,21 @@
384 EXPECT_FALSE(findApp(apps, "unity7-package_scope_x123"));
385 EXPECT_FALSE(findApp(apps, "x11-package_hidden_x123"));
386
387- EXPECT_EQ("unity8",
388- std::dynamic_pointer_cast<ubuntu::app_launch::app_impls::Snap>(getApp(apps, "unity8-package_foo_x123"))
389- ->getInterface());
390- EXPECT_EQ("unity7",
391- std::dynamic_pointer_cast<ubuntu::app_launch::app_impls::Snap>(getApp(apps, "unity7-package_single_x123"))
392- ->getInterface());
393- EXPECT_EQ("unity7", std::dynamic_pointer_cast<ubuntu::app_launch::app_impls::Snap>(
394- getApp(apps, "unity7-package_multiple_x123"))
395- ->getInterface());
396- EXPECT_EQ("x11",
397- std::dynamic_pointer_cast<ubuntu::app_launch::app_impls::Snap>(getApp(apps, "x11-package_multiple_x123"))
398- ->getInterface());
399+ EXPECT_TRUE(getApp(apps, "unity8-package_foo_x123")->info()
400+ ->supportsUbuntuLifecycle());
401+ EXPECT_FALSE(getApp(apps, "unity7-package_single_x123")->info()
402+ ->supportsUbuntuLifecycle());
403+ EXPECT_FALSE(getApp(apps, "unity7-package_multiple_x123")->info()
404+ ->supportsUbuntuLifecycle());
405+
406+ EXPECT_TRUE(std::dynamic_pointer_cast<ubuntu::app_launch::app_info::Desktop>(getApp(apps, "x11-package_multiple_x123")->info())
407+ ->xMirEnable());
408+ EXPECT_TRUE(std::dynamic_pointer_cast<ubuntu::app_launch::app_info::Desktop>(getApp(apps, "unity7-package_single_x123")->info())
409+ ->xMirEnable());
410+ EXPECT_TRUE(std::dynamic_pointer_cast<ubuntu::app_launch::app_info::Desktop>(getApp(apps, "unity8-package_foo_x123")->info())
411+ ->xMirEnable());
412+ EXPECT_FALSE(std::dynamic_pointer_cast<ubuntu::app_launch::app_info::Desktop>(getApp(apps, "unity8-package_qmlapp_x123")->info())
413+ ->xMirEnable());
414 }
415 #endif
416
417@@ -272,9 +278,10 @@
418 {
419 #ifdef ENABLE_SNAPPY
420 SnapdMock mock{SNAPD_LIST_APPS_SOCKET,
421- {interfaces, u8Package, u8Package, u8Package, /* unity8 check */
422+ {interfaces, u8Package, /* unity8 check */
423+ interfaces, u8Package, u8Package, /* mir check */
424 interfaces, u8Package, u7Package, u7Package, u7Package, u8Package, /* unity7 check */
425- interfaces, x11Package, x11Package, x11Package}}; /* x11 check */
426+ interfaces, x11Package, x11Package, x11Package}}; /* x11 check */
427 #endif
428 auto registry = std::make_shared<ubuntu::app_launch::Registry>();
429
430@@ -284,7 +291,7 @@
431 printApps(apps);
432
433 #ifdef ENABLE_SNAPPY
434- EXPECT_EQ(19, int(apps.size()));
435+ EXPECT_EQ(20, int(apps.size()));
436 #else
437 EXPECT_EQ(15, int(apps.size()));
438 #endif

Subscribers

People subscribed via source and target branches