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);
280
285
ASSERT_FALSE(upstart_app_launch_pid_in_app_id(5678, "foo"));
288
TEST_F(LibUAL, ApplicationId)
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"));
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"));
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"));
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"));
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));
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));
283
316
TEST_F(LibUAL, ApplicationList)
285
318
gchar ** apps = upstart_app_launch_list_running_apps();