~mir-team/ubuntu-app-launch/mir-release-0.14.0

« back to all changes in this revision

Viewing changes to tests/libual-test.cc

  • Committer: Ted Gould
  • Date: 2014-04-30 16:18:29 UTC
  • mto: This revision was merged to the branch mainline in revision 150.
  • Revision ID: ted@gould.cx-20140430161829-xlmg4oauodcopo3f
Adjusting tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <gio/gio.h>
22
22
 
23
23
extern "C" {
24
 
#include "upstart-app-launch.h"
 
24
#include "ubuntu-app-launch.h"
25
25
#include "libdbustest/dbus-test.h"
26
26
}
27
27
 
69
69
 
70
70
                virtual void SetUp() {
71
71
                        gchar * linkfarmpath = g_build_filename(CMAKE_SOURCE_DIR, "link-farm", NULL);
72
 
                        g_setenv("UPSTART_APP_LAUNCH_LINK_FARM", linkfarmpath, TRUE);
 
72
                        g_setenv("UBUNTU_APP_LAUNCH_LINK_FARM", linkfarmpath, TRUE);
73
73
                        g_free(linkfarmpath);
74
74
 
75
75
                        g_setenv("XDG_DATA_DIRS", CMAKE_SOURCE_DIR, TRUE);
223
223
                        g_dbus_connection_set_exit_on_close(bus, FALSE);
224
224
                        g_object_add_weak_pointer(G_OBJECT(bus), (gpointer *)&bus);
225
225
 
226
 
                        ASSERT_TRUE(upstart_app_launch_observer_add_app_focus(focus_cb, this));
227
 
                        ASSERT_TRUE(upstart_app_launch_observer_add_app_resume(resume_cb, this));
 
226
                        ASSERT_TRUE(ubuntu_app_launch_observer_add_app_focus(focus_cb, this));
 
227
                        ASSERT_TRUE(ubuntu_app_launch_observer_add_app_resume(resume_cb, this));
228
228
                }
229
229
 
230
230
                virtual void TearDown() {
231
 
                        upstart_app_launch_observer_delete_app_focus(focus_cb, this);
232
 
                        upstart_app_launch_observer_delete_app_resume(resume_cb, this);
 
231
                        ubuntu_app_launch_observer_delete_app_focus(focus_cb, this);
 
232
                        ubuntu_app_launch_observer_delete_app_resume(resume_cb, this);
233
233
 
234
234
                        g_clear_object(&mock);
235
235
                        g_clear_object(&service);
304
304
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/test/application_click", "com.ubuntu.Upstart0_6.Job", NULL);
305
305
 
306
306
        /* Basic make sure we can send the event */
307
 
        ASSERT_TRUE(upstart_app_launch_start_application("foolike", NULL));
 
307
        ASSERT_TRUE(ubuntu_app_launch_start_application("foolike", NULL));
308
308
        EXPECT_EQ(1, dbus_test_dbus_mock_object_check_method_call(mock, obj, "Start", NULL, NULL));
309
309
 
310
310
        ASSERT_TRUE(dbus_test_dbus_mock_object_clear_method_calls(mock, obj, NULL));
311
311
 
312
312
        /* Now look at the details of the call */
313
 
        ASSERT_TRUE(upstart_app_launch_start_application("foolike", NULL));
 
313
        ASSERT_TRUE(ubuntu_app_launch_start_application("foolike", NULL));
314
314
 
315
315
        guint len = 0;
316
316
        const DbusTestDbusMockCall * calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL);
337
337
                "file:///home/phablet/test.txt",
338
338
                NULL
339
339
        };
340
 
        ASSERT_TRUE(upstart_app_launch_start_application("foolike", urls));
 
340
        ASSERT_TRUE(ubuntu_app_launch_start_application("foolike", urls));
341
341
 
342
342
        len = 0;
343
343
        calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL);
356
356
{
357
357
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/test/application_click", "com.ubuntu.Upstart0_6.Job", NULL);
358
358
 
359
 
        ASSERT_TRUE(upstart_app_launch_start_application_test("foolike", NULL));
 
359
        ASSERT_TRUE(ubuntu_app_launch_start_application_test("foolike", NULL));
360
360
 
361
361
        guint len = 0;
362
362
        const DbusTestDbusMockCall * calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL);
380
380
{
381
381
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/test/application_click", "com.ubuntu.Upstart0_6.Job", NULL);
382
382
 
383
 
        ASSERT_TRUE(upstart_app_launch_stop_application("foo"));
 
383
        ASSERT_TRUE(ubuntu_app_launch_stop_application("foo"));
384
384
 
385
385
        ASSERT_EQ(dbus_test_dbus_mock_object_check_method_call(mock, obj, "Stop", NULL, NULL), 1);
386
386
 
388
388
 
389
389
TEST_F(LibUAL, ApplicationLog)
390
390
{
391
 
        gchar * click_log = upstart_app_launch_application_log_path("foo");
 
391
        gchar * click_log = ubuntu_app_launch_application_log_path("foo");
392
392
        EXPECT_STREQ(CMAKE_SOURCE_DIR "/upstart/application-click-foo.log", click_log);
393
393
        g_free(click_log);
394
394
 
395
 
        gchar * legacy_single = upstart_app_launch_application_log_path("single");
 
395
        gchar * legacy_single = ubuntu_app_launch_application_log_path("single");
396
396
        EXPECT_STREQ(CMAKE_SOURCE_DIR "/upstart/application-legacy-single-.log", legacy_single);
397
397
        g_free(legacy_single);
398
398
 
399
 
        gchar * legacy_multiple = upstart_app_launch_application_log_path("bar");
 
399
        gchar * legacy_multiple = ubuntu_app_launch_application_log_path("bar");
400
400
        EXPECT_STREQ(CMAKE_SOURCE_DIR "/upstart/application-legacy-bar-2342345.log", legacy_multiple);
401
401
        g_free(legacy_multiple);
402
402
}
403
403
 
404
404
TEST_F(LibUAL, ApplicationPid)
405
405
{
406
 
        EXPECT_EQ(upstart_app_launch_get_primary_pid("foo"), getpid());
407
 
        EXPECT_EQ(upstart_app_launch_get_primary_pid("bar"), 5678);
408
 
        EXPECT_TRUE(upstart_app_launch_pid_in_app_id(getpid(), "foo"));
409
 
        EXPECT_FALSE(upstart_app_launch_pid_in_app_id(5678, "foo"));
 
406
        EXPECT_EQ(ubuntu_app_launch_get_primary_pid("foo"), getpid());
 
407
        EXPECT_EQ(ubuntu_app_launch_get_primary_pid("bar"), 5678);
 
408
        EXPECT_TRUE(ubuntu_app_launch_pid_in_app_id(getpid(), "foo"));
 
409
        EXPECT_FALSE(ubuntu_app_launch_pid_in_app_id(5678, "foo"));
410
410
}
411
411
 
412
412
TEST_F(LibUAL, ApplicationId)
415
415
        g_setenv("TEST_CLICK_USER", "test-user", TRUE);
416
416
 
417
417
        /* Test with current-user-version, should return the version in the manifest */
418
 
        EXPECT_STREQ("com.test.good_application_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.good", "application", "current-user-version"));
 
418
        EXPECT_STREQ("com.test.good_application_1.2.3", ubuntu_app_launch_triplet_to_app_id("com.test.good", "application", "current-user-version"));
419
419
 
420
420
        /* Test with version specified, shouldn't even read the manifest */
421
 
        EXPECT_STREQ("com.test.good_application_1.2.4", upstart_app_launch_triplet_to_app_id("com.test.good", "application", "1.2.4"));
 
421
        EXPECT_STREQ("com.test.good_application_1.2.4", ubuntu_app_launch_triplet_to_app_id("com.test.good", "application", "1.2.4"));
422
422
 
423
423
        /* Test with out a version or app, should return the version in the manifest */
424
 
        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"));
 
424
        EXPECT_STREQ("com.test.good_application_1.2.3", ubuntu_app_launch_triplet_to_app_id("com.test.good", "first-listed-app", "current-user-version"));
425
425
 
426
426
        /* Test with a version or but wildcard app, should return the version in the manifest */
427
 
        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"));
 
427
        EXPECT_STREQ("com.test.good_application_1.2.4", ubuntu_app_launch_triplet_to_app_id("com.test.good", "last-listed-app", "1.2.4"));
428
428
 
429
429
        /* Make sure we can select the app from a list correctly */
430
 
        EXPECT_STREQ("com.test.multiple_first_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.multiple", "first-listed-app", NULL));
431
 
        EXPECT_STREQ("com.test.multiple_first_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.multiple", NULL, NULL));
432
 
        EXPECT_STREQ("com.test.multiple_fifth_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.multiple", "last-listed-app", NULL));
433
 
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.multiple", "only-listed-app", NULL));
434
 
        EXPECT_STREQ("com.test.good_application_1.2.3", upstart_app_launch_triplet_to_app_id("com.test.good", "only-listed-app", NULL));
 
430
        EXPECT_STREQ("com.test.multiple_first_1.2.3", ubuntu_app_launch_triplet_to_app_id("com.test.multiple", "first-listed-app", NULL));
 
431
        EXPECT_STREQ("com.test.multiple_first_1.2.3", ubuntu_app_launch_triplet_to_app_id("com.test.multiple", NULL, NULL));
 
432
        EXPECT_STREQ("com.test.multiple_fifth_1.2.3", ubuntu_app_launch_triplet_to_app_id("com.test.multiple", "last-listed-app", NULL));
 
433
        EXPECT_EQ(nullptr, ubuntu_app_launch_triplet_to_app_id("com.test.multiple", "only-listed-app", NULL));
 
434
        EXPECT_STREQ("com.test.good_application_1.2.3", ubuntu_app_launch_triplet_to_app_id("com.test.good", "only-listed-app", NULL));
435
435
 
436
436
        /* A bunch that should be NULL */
437
 
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-hooks", NULL, NULL));
438
 
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-json", NULL, NULL));
439
 
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-object", NULL, NULL));
440
 
        EXPECT_EQ(nullptr, upstart_app_launch_triplet_to_app_id("com.test.no-version", NULL, NULL));
 
437
        EXPECT_EQ(nullptr, ubuntu_app_launch_triplet_to_app_id("com.test.no-hooks", NULL, NULL));
 
438
        EXPECT_EQ(nullptr, ubuntu_app_launch_triplet_to_app_id("com.test.no-json", NULL, NULL));
 
439
        EXPECT_EQ(nullptr, ubuntu_app_launch_triplet_to_app_id("com.test.no-object", NULL, NULL));
 
440
        EXPECT_EQ(nullptr, ubuntu_app_launch_triplet_to_app_id("com.test.no-version", NULL, NULL));
441
441
}
442
442
 
443
443
TEST_F(LibUAL, AppIdParse)
444
444
{
445
 
        EXPECT_TRUE(upstart_app_launch_app_id_parse("com.ubuntu.test_test_123", NULL, NULL, NULL));
446
 
        EXPECT_FALSE(upstart_app_launch_app_id_parse("inkscape", NULL, NULL, NULL));
447
 
        EXPECT_FALSE(upstart_app_launch_app_id_parse("music-app", NULL, NULL, NULL));
 
445
        EXPECT_TRUE(ubuntu_app_launch_app_id_parse("com.ubuntu.test_test_123", NULL, NULL, NULL));
 
446
        EXPECT_FALSE(ubuntu_app_launch_app_id_parse("inkscape", NULL, NULL, NULL));
 
447
        EXPECT_FALSE(ubuntu_app_launch_app_id_parse("music-app", NULL, NULL, NULL));
448
448
 
449
449
        gchar * pkg;
450
450
        gchar * app;
451
451
        gchar * version;
452
452
 
453
 
        ASSERT_TRUE(upstart_app_launch_app_id_parse("com.ubuntu.test_test_123", &pkg, &app, &version));
 
453
        ASSERT_TRUE(ubuntu_app_launch_app_id_parse("com.ubuntu.test_test_123", &pkg, &app, &version));
454
454
        EXPECT_STREQ("com.ubuntu.test", pkg);
455
455
        EXPECT_STREQ("test", app);
456
456
        EXPECT_STREQ("123", version);
464
464
 
465
465
TEST_F(LibUAL, ApplicationList)
466
466
{
467
 
        gchar ** apps = upstart_app_launch_list_running_apps();
 
467
        gchar ** apps = ubuntu_app_launch_list_running_apps();
468
468
 
469
469
        ASSERT_NE(apps, nullptr);
470
470
        ASSERT_EQ(g_strv_length(apps), 2);
510
510
                .name = nullptr
511
511
        };
512
512
 
513
 
        ASSERT_TRUE(upstart_app_launch_observer_add_app_started(observer_cb, &start_data));
514
 
        ASSERT_TRUE(upstart_app_launch_observer_add_app_stop(observer_cb, &stop_data));
 
513
        ASSERT_TRUE(ubuntu_app_launch_observer_add_app_started(observer_cb, &start_data));
 
514
        ASSERT_TRUE(ubuntu_app_launch_observer_add_app_stop(observer_cb, &stop_data));
515
515
 
516
516
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/ubuntu/Upstart", "com.ubuntu.Upstart0_6", NULL);
517
517
 
619
619
 
620
620
 
621
621
        /* Remove */
622
 
        ASSERT_TRUE(upstart_app_launch_observer_delete_app_started(observer_cb, &start_data));
623
 
        ASSERT_TRUE(upstart_app_launch_observer_delete_app_stop(observer_cb, &stop_data));
 
622
        ASSERT_TRUE(ubuntu_app_launch_observer_delete_app_started(observer_cb, &start_data));
 
623
        ASSERT_TRUE(ubuntu_app_launch_observer_delete_app_stop(observer_cb, &stop_data));
624
624
}
625
625
 
626
626
static GDBusMessage *
654
654
                &starting_count,
655
655
                NULL);
656
656
 
657
 
        EXPECT_TRUE(upstart_app_launch_observer_add_app_starting(starting_observer, &last_observer));
 
657
        EXPECT_TRUE(ubuntu_app_launch_observer_add_app_starting(starting_observer, &last_observer));
658
658
 
659
659
        g_dbus_connection_emit_signal(session,
660
660
                NULL, /* destination */
669
669
        EXPECT_EQ("foo", last_observer);
670
670
        EXPECT_EQ(1, starting_count);
671
671
 
672
 
        EXPECT_TRUE(upstart_app_launch_observer_delete_app_starting(starting_observer, &last_observer));
 
672
        EXPECT_TRUE(ubuntu_app_launch_observer_delete_app_starting(starting_observer, &last_observer));
673
673
 
674
674
        g_dbus_connection_remove_filter(session, filter);
675
675
        g_object_unref(session);
677
677
 
678
678
TEST_F(LibUAL, AppIdTest)
679
679
{
680
 
        ASSERT_TRUE(upstart_app_launch_start_application("foo", NULL));
 
680
        ASSERT_TRUE(ubuntu_app_launch_start_application("foo", NULL));
681
681
        pause(50); /* Ensure all the events come through */
682
682
        EXPECT_EQ("foo", this->last_focus_appid);
683
683
        EXPECT_EQ("foo", this->last_resume_appid);
712
712
                "http://www.test.com",
713
713
                NULL
714
714
        };
715
 
        ASSERT_TRUE(upstart_app_launch_start_application("foo", uris));
 
715
        ASSERT_TRUE(ubuntu_app_launch_start_application("foo", uris));
716
716
        pause(100); /* Ensure all the events come through */
717
717
 
718
718
        EXPECT_EQ("foo", this->last_focus_appid);
746
746
                NULL
747
747
        };
748
748
 
749
 
        ASSERT_TRUE(upstart_app_launch_start_application("foo", uris));
 
749
        ASSERT_TRUE(ubuntu_app_launch_start_application("foo", uris));
750
750
        pause(100); /* Ensure all the events come through */
751
751
 
752
752
        EXPECT_EQ("foo", this->last_focus_appid);
757
757
{
758
758
        this->resume_timeout = 100;
759
759
 
760
 
        ASSERT_TRUE(upstart_app_launch_start_application("foo", NULL));
 
760
        ASSERT_TRUE(ubuntu_app_launch_start_application("foo", NULL));
761
761
        pause(1000); /* Ensure all the events come through */
762
762
        EXPECT_EQ("foo", this->last_focus_appid);
763
763
        EXPECT_EQ("foo", this->last_resume_appid);
772
772
                NULL
773
773
        };
774
774
 
775
 
        ASSERT_TRUE(upstart_app_launch_start_application("foo", uris));
 
775
        ASSERT_TRUE(ubuntu_app_launch_start_application("foo", uris));
776
776
        pause(1000); /* Ensure all the events come through */
777
777
        EXPECT_EQ("foo", this->last_focus_appid);
778
778
        EXPECT_EQ("foo", this->last_resume_appid);
804
804
                NULL
805
805
        };
806
806
 
807
 
        ASSERT_TRUE(upstart_app_launch_start_application("foo", uris));
 
807
        ASSERT_TRUE(ubuntu_app_launch_start_application("foo", uris));
808
808
 
809
809
        guint end = g_get_monotonic_time();
810
810
 
825
825
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/test/application_legacy", "com.ubuntu.Upstart0_6.Job", NULL);
826
826
 
827
827
        /* Check for a single-instance app */
828
 
        ASSERT_TRUE(upstart_app_launch_start_application("single", NULL));
 
828
        ASSERT_TRUE(ubuntu_app_launch_start_application("single", NULL));
829
829
 
830
830
        guint len = 0;
831
831
        const DbusTestDbusMockCall * calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL);
847
847
        ASSERT_TRUE(dbus_test_dbus_mock_object_clear_method_calls(mock, obj, NULL));
848
848
 
849
849
        /* Check for a multi-instance app */
850
 
        ASSERT_TRUE(upstart_app_launch_start_application("multiple", NULL));
 
850
        ASSERT_TRUE(ubuntu_app_launch_start_application("multiple", NULL));
851
851
 
852
852
        len = 0;
853
853
        calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL);
868
868
}
869
869
 
870
870
static void
871
 
failed_observer (const gchar * appid, upstart_app_launch_app_failed_t reason, gpointer user_data)
 
871
failed_observer (const gchar * appid, ubuntu_app_launch_app_failed_t reason, gpointer user_data)
872
872
{
873
 
        if (reason == UPSTART_APP_LAUNCH_APP_FAILED_CRASH) {
 
873
        if (reason == UBUNTU_APP_LAUNCH_APP_FAILED_CRASH) {
874
874
                std::string * last = static_cast<std::string *>(user_data);
875
875
                *last = appid;
876
876
        }
882
882
        std::string last_observer;
883
883
        GDBusConnection * session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
884
884
 
885
 
        EXPECT_TRUE(upstart_app_launch_observer_add_app_failed(failed_observer, &last_observer));
 
885
        EXPECT_TRUE(ubuntu_app_launch_observer_add_app_failed(failed_observer, &last_observer));
886
886
 
887
887
        g_dbus_connection_emit_signal(session,
888
888
                NULL, /* destination */
924
924
 
925
925
        EXPECT_TRUE(last_observer.empty());
926
926
 
927
 
        EXPECT_TRUE(upstart_app_launch_observer_delete_app_failed(failed_observer, &last_observer));
 
927
        EXPECT_TRUE(ubuntu_app_launch_observer_delete_app_failed(failed_observer, &last_observer));
928
928
 
929
929
        g_object_unref(session);
930
930
}
934
934
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/test/untrusted/helper", "com.ubuntu.Upstart0_6.Job", NULL);
935
935
 
936
936
        /* Basic make sure we can send the event */
937
 
        ASSERT_TRUE(upstart_app_launch_start_helper("untrusted-type", "foolike", NULL));
 
937
        ASSERT_TRUE(ubuntu_app_launch_start_helper("untrusted-type", "foolike", NULL));
938
938
        EXPECT_EQ(1, dbus_test_dbus_mock_object_check_method_call(mock, obj, "Start", NULL, NULL));
939
939
 
940
940
        ASSERT_TRUE(dbus_test_dbus_mock_object_clear_method_calls(mock, obj, NULL));
941
941
 
942
942
        /* Now look at the details of the call */
943
 
        ASSERT_TRUE(upstart_app_launch_start_helper("untrusted-type", "foolike", NULL));
 
943
        ASSERT_TRUE(ubuntu_app_launch_start_helper("untrusted-type", "foolike", NULL));
944
944
 
945
945
        guint len = 0;
946
946
        const DbusTestDbusMockCall * calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL);
963
963
        ASSERT_TRUE(dbus_test_dbus_mock_object_clear_method_calls(mock, obj, NULL));
964
964
 
965
965
        /* Now check a multi out */ 
966
 
        gchar * instance_id = upstart_app_launch_start_multiple_helper("untrusted-type", "foolike", NULL);
 
966
        gchar * instance_id = ubuntu_app_launch_start_multiple_helper("untrusted-type", "foolike", NULL);
967
967
        ASSERT_NE(nullptr, instance_id);
968
968
        g_debug("Multi-instance ID: %s", instance_id);
969
969
 
995
995
                "file:///home/phablet/test.txt",
996
996
                NULL
997
997
        };
998
 
        ASSERT_TRUE(upstart_app_launch_start_helper("untrusted-type", "foolike", urls));
 
998
        ASSERT_TRUE(ubuntu_app_launch_start_helper("untrusted-type", "foolike", urls));
999
999
 
1000
1000
        len = 0;
1001
1001
        calls = dbus_test_dbus_mock_object_get_method_calls(mock, obj, "Start", &len, NULL);
1017
1017
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/test/untrusted/helper", "com.ubuntu.Upstart0_6.Job", NULL);
1018
1018
 
1019
1019
        /* Basic helper */
1020
 
        ASSERT_TRUE(upstart_app_launch_stop_helper("untrusted-type", "foo"));
 
1020
        ASSERT_TRUE(ubuntu_app_launch_stop_helper("untrusted-type", "foo"));
1021
1021
 
1022
1022
        ASSERT_EQ(dbus_test_dbus_mock_object_check_method_call(mock, obj, "Stop", NULL, NULL), 1);
1023
1023
 
1042
1042
        ASSERT_TRUE(dbus_test_dbus_mock_object_clear_method_calls(mock, obj, NULL));
1043
1043
 
1044
1044
        /* Multi helper */
1045
 
        ASSERT_TRUE(upstart_app_launch_stop_multiple_helper("untrusted-type", "foo", "instance-me"));
 
1045
        ASSERT_TRUE(ubuntu_app_launch_stop_multiple_helper("untrusted-type", "foo", "instance-me"));
1046
1046
 
1047
1047
        ASSERT_EQ(dbus_test_dbus_mock_object_check_method_call(mock, obj, "Stop", NULL, NULL), 1);
1048
1048
 
1071
1071
 
1072
1072
TEST_F(LibUAL, HelperList)
1073
1073
{
1074
 
        gchar ** blanktype = upstart_app_launch_list_helpers("not-a-type");
 
1074
        gchar ** blanktype = ubuntu_app_launch_list_helpers("not-a-type");
1075
1075
 
1076
1076
        EXPECT_NE(nullptr, blanktype);
1077
1077
        EXPECT_EQ(0, g_strv_length(blanktype));
1078
1078
 
1079
1079
        g_strfreev(blanktype);
1080
1080
 
1081
 
        gchar ** goodtype = upstart_app_launch_list_helpers("untrusted-type");
 
1081
        gchar ** goodtype = ubuntu_app_launch_list_helpers("untrusted-type");
1082
1082
 
1083
1083
        EXPECT_NE(nullptr, goodtype);
1084
1084
        EXPECT_EQ(2, g_strv_length(goodtype));
1096
1096
 
1097
1097
TEST_F(LibUAL, HelperInstanceList)
1098
1098
{
1099
 
        gchar ** blanktype = upstart_app_launch_list_helper_instances("not-a-type", "com.bar_foo_8432.13.1");
 
1099
        gchar ** blanktype = ubuntu_app_launch_list_helper_instances("not-a-type", "com.bar_foo_8432.13.1");
1100
1100
 
1101
1101
        EXPECT_NE(nullptr, blanktype);
1102
1102
        EXPECT_EQ(0, g_strv_length(blanktype));
1103
1103
 
1104
1104
        g_strfreev(blanktype);
1105
1105
 
1106
 
        gchar ** goodtype = upstart_app_launch_list_helper_instances("untrusted-type", "com.bar_foo_8432.13.1");
 
1106
        gchar ** goodtype = ubuntu_app_launch_list_helper_instances("untrusted-type", "com.bar_foo_8432.13.1");
1107
1107
 
1108
1108
        EXPECT_NE(nullptr, goodtype);
1109
1109
        EXPECT_EQ(1, g_strv_length(goodtype));
1147
1147
                .instance = "1234"
1148
1148
        };
1149
1149
 
1150
 
        ASSERT_TRUE(upstart_app_launch_observer_add_helper_started(helper_observer_cb, "my-type-is-scorpio", &start_data));
1151
 
        ASSERT_TRUE(upstart_app_launch_observer_add_helper_stop(helper_observer_cb, "my-type-is-libra", &stop_data));
 
1150
        ASSERT_TRUE(ubuntu_app_launch_observer_add_helper_started(helper_observer_cb, "my-type-is-scorpio", &start_data));
 
1151
        ASSERT_TRUE(ubuntu_app_launch_observer_add_helper_stop(helper_observer_cb, "my-type-is-libra", &stop_data));
1152
1152
 
1153
1153
        DbusTestDbusMockObject * obj = dbus_test_dbus_mock_get_object(mock, "/com/ubuntu/Upstart", "com.ubuntu.Upstart0_6", NULL);
1154
1154
 
1181
1181
        ASSERT_EQ(stop_data.count, 1);
1182
1182
 
1183
1183
        /* Remove */
1184
 
        ASSERT_TRUE(upstart_app_launch_observer_delete_helper_started(helper_observer_cb, "my-type-is-scorpio", &start_data));
1185
 
        ASSERT_TRUE(upstart_app_launch_observer_delete_helper_stop(helper_observer_cb, "my-type-is-libra", &stop_data));
 
1184
        ASSERT_TRUE(ubuntu_app_launch_observer_delete_helper_started(helper_observer_cb, "my-type-is-scorpio", &start_data));
 
1185
        ASSERT_TRUE(ubuntu_app_launch_observer_delete_helper_stop(helper_observer_cb, "my-type-is-libra", &stop_data));
1186
1186
}