Merge lp:~ted/indicator-datetime/tests-fixes into lp:indicator-datetime

Proposed by Ted Gould
Status: Merged
Approved by: Charles Kerr
Approved revision: 460
Merged at revision: 465
Proposed branch: lp:~ted/indicator-datetime/tests-fixes
Merge into: lp:indicator-datetime
Diff against target: 21 lines (+3/-1)
1 file modified
src/notifications.cpp (+3/-1)
To merge this branch: bzr merge lp:~ted/indicator-datetime/tests-fixes
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
unity-api-1-bot continuous-integration Approve
Review via email: mp+306402@code.launchpad.net

Commit message

Use an explicit registry object so that it gets free'd when the function exits

Description of the change

Upstream UAL changed so that discover() is using the registry. If it isn't given one it uses a default registry, but that only gets free'd when the process exits. Which is fine for running applications but can break tests as they'll run multiple tests in the same PID. By using an explicit registry we can control the lifecycle of it directly.

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:460
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-datetime-ci/3/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/720
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/726
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=vivid+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=yakkety/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=vivid+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=yakkety/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=vivid+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/534/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/534
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=yakkety/534/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-indicator-datetime-ci/3/rebuild

review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) :
review: Approve
Revision history for this message
Charles Kerr (charlesk) wrote :

Approved, but doesn't this make the single-argument version of discover() useful only for apps that don't have tests? If so, shouldn't it be removed upstream?

Revision history for this message
Ted Gould (ted) wrote :

On Wed, 2016-09-21 at 23:56 +0000, Charles Kerr wrote:
> Approved, but doesn't this make the single-argument version of
> discover() useful only for apps that don't have tests? If so,
> shouldn't it be removed upstream?
Yes, and I probably will next ABI change. But, the other option is
there's a clearDefault() command that can force the default registry
instance to be free'd that can go in TearDown(). Here it made more
sense to put it in the function because we don't need the registry
sitting around at all for such a simple lookup that is relatively
infrequent.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/notifications.cpp'
2--- src/notifications.cpp 2016-06-30 00:37:56 +0000
3+++ src/notifications.cpp 2016-09-21 22:10:24 +0000
4@@ -25,6 +25,7 @@
5 #include <messaging-menu/messaging-menu-message.h>
6
7 #include <libubuntu-app-launch-2/ubuntu-app-launch/appid.h>
8+#include <libubuntu-app-launch-2/ubuntu-app-launch/registry.h>
9
10 #include <uuid/uuid.h>
11
12@@ -460,7 +461,8 @@
13
14 static std::string calendar_app_id()
15 {
16- auto app_id = ubuntu::app_launch::AppID::discover("com.ubuntu.calendar");
17+ auto registry = std::make_shared<ubuntu::app_launch::Registry>();
18+ auto app_id = ubuntu::app_launch::AppID::discover(registry, "com.ubuntu.calendar");
19 if (!app_id.empty())
20 // Due the use of old API by messaging_menu we need append a extra ".desktop" to the app_id.
21 return std::string(app_id) + ".desktop";

Subscribers

People subscribed via source and target branches