~ubuntu-branches/ubuntu/utopic/upstart-app-launch/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/libual-test.cc

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release, Ken VanDine, Ted Gould, CI bot
  • Date: 2014-01-29 20:08:11 UTC
  • mfrom: (1.1.22)
  • Revision ID: package-import@ubuntu.com-20140129200811-5whx5elc97o3o98v
Tags: 0.3+14.04.20140129.1-0ubuntu1
[ Ken VanDine ]
* Added upstart_app_launch_triplet_to_app_id to construct an appid
  from pkg, app, version triplet. If a specific version isn't
  provided, click is used to determine the version from the manifest.

[ Ted Gould ]
* Set the Upstart job environment using DBus.
* Tests for the exec utilities.
* Add an APP_DESKTOP_FILE_PATH to point to a readable desktop file
  under confinement.
* Include an architecture specific directory in the path.
* Making the application job a task.
* Add application list handling to the triplet function.

[ CI bot ]
* Upload to trusty

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
 
50
50
                virtual void SetUp() {
51
51
                        service = dbus_test_service_new(NULL);
 
52
                        g_setenv("XDG_DATA_DIRS", CMAKE_SOURCE_DIR, TRUE);
 
53
                        const gchar * oldpath = g_getenv("PATH");
 
54
                        gchar * newpath = g_strjoin(":", CMAKE_SOURCE_DIR, oldpath, NULL);
 
55
                        g_setenv("PATH", newpath, TRUE);
 
56
                        g_free(newpath);
52
57
 
53
58
                        debugConnection();
54
59
 
280
285
        ASSERT_FALSE(upstart_app_launch_pid_in_app_id(5678, "foo"));
281
286
}
282
287
 
 
288
TEST_F(LibUAL, ApplicationId)
 
289
{
 
290
        /* Test with current-user-version, should return the version in the manifest */
 
291
        EXPECT_STREQ("com.test.good_application_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.good", "application", "current-user-version"));
 
292
 
 
293
        /* Test with version specified, shouldn't even read the manifest */
 
294
        EXPECT_STREQ("com.test.good_application_1.2.4", upstart_app_launch_triplet_to_app_id("com.test.good", "application", "1.2.4"));
 
295
 
 
296
        /* Test with out a version or app, should return the version in the manifest */
 
297
        EXPECT_STREQ("com.test.good_application_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.good", "first-listed-app", "current-user-version"));
 
298
 
 
299
        /* Test with a version or but wildcard app, should return the version in the manifest */
 
300
        EXPECT_STREQ("com.test.good_application_1.2.4", upstart_app_launch_triplet_to_app_id("com.test.good", "last-listed-app", "1.2.4"));
 
301
 
 
302
        /* Make sure we can select the app from a list correctly */
 
303
        EXPECT_STREQ("com.test.multiple_first_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.multiple", "first-listed-app", NULL));
 
304
        EXPECT_STREQ("com.test.multiple_first_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.multiple", NULL, NULL));
 
305
        EXPECT_STREQ("com.test.multiple_fifth_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.multiple", "last-listed-app", NULL));
 
306
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.multiple", "only-listed-app", NULL));
 
307
        EXPECT_STREQ("com.test.good_application_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.good", "only-listed-app", NULL));
 
308
 
 
309
        /* A bunch that should be NULL */
 
310
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-hooks", NULL, NULL));
 
311
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-json", NULL, NULL));
 
312
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-object", NULL, NULL));
 
313
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-version", NULL, NULL));
 
314
}
 
315
 
283
316
TEST_F(LibUAL, ApplicationList)
284
317
{
285
318
        gchar ** apps = upstart_app_launch_list_running_apps();