8 import dbus.mainloop.glib
10 print "Failed import, aborting test"
13 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
14 loop = gobject.MainLoop()
18 bus = dbus.SessionBus()
19 bus_iface = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus')
21 o = bus.get_object('org.freedesktop.DBus.TestSuiteForkingEchoService', '/org/freedesktop/TestSuite')
22 i = dbus.Interface(o, 'org.freedesktop.TestSuite')
25 reply = i.Echo("hello world")
26 print "TestSuiteForkingEchoService initial reply OK"
28 def ignore(*args, **kwargs):
31 # Now monitor for exits, when that happens, start it up again.
32 # The goal here is to try to hit any race conditions in activation.
34 def on_forking_echo_owner_changed(name, old, new):
39 print "Activated 10 times OK, TestSuiteForkingEchoService pass"
44 o = bus.get_object('org.freedesktop.DBus.TestSuiteForkingEchoService', '/org/freedesktop/TestSuite')
45 i = dbus.Interface(o, 'org.freedesktop.TestSuite')
46 i.Echo("counter %r" % counter)
47 i.Exit(reply_handler=ignore, error_handler=ignore)
49 bus_iface.connect_to_signal('NameOwnerChanged', on_forking_echo_owner_changed, arg0='org.freedesktop.DBus.TestSuiteForkingEchoService')
51 i.Exit(reply_handler=ignore, error_handler=ignore)
55 print "Failed to get NameOwnerChanged for TestSuiteForkingEchoService"
57 gobject.timeout_add(15000, check_counter)