~ubuntu-branches/ubuntu/quantal/vala/quantal

« back to all changes in this revision

Viewing changes to tests/dbus/structs.test

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-09-20 19:57:26 UTC
  • mfrom: (1.5.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20100920195726-cbxb3q400aj1hoqr
Tags: 0.10.0-0ubuntu1
* New upstream release
* debian/patches/90_revert_use_new_gir_version.patch:
  - don't build with new GIR

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
        }
63
63
}
64
64
 
65
 
Application app;
 
65
MainLoop main_loop;
66
66
 
67
67
void client_exit (Pid pid, int status) {
68
68
        // client finished, terminate server
69
69
        assert (status == 0);
70
 
        app.quit ();
 
70
        main_loop.quit ();
71
71
}
72
72
 
73
73
void main () {
75
75
        conn.register_object ("/org/example/test", new Test ());
76
76
 
77
77
        // try to register service in session bus
78
 
        app = new Application ("org.example.Test");
 
78
        var request_result = conn.call_sync ("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName",
 
79
                                              new Variant ("(su)", "org.example.Test", 0x4), null, 0, -1);
 
80
        assert ((uint) request_result.get_child_value (0) == 1);
79
81
 
80
82
        // server ready, spawn client
81
83
        Pid client_pid;
82
84
        Process.spawn_async (null, { "test", "/dbus/structs/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
83
85
        ChildWatch.add (client_pid, client_exit);
84
86
 
85
 
        app.run ();
 
87
        main_loop = new MainLoop ();
 
88
        main_loop.run ();
86
89
}