summaryrefslogtreecommitdiffstats
path: root/test/python/test-service.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/python/test-service.py')
-rwxr-xr-xtest/python/test-service.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/python/test-service.py b/test/python/test-service.py
index ecb9fd60..820514ae 100755
--- a/test/python/test-service.py
+++ b/test/python/test-service.py
@@ -80,6 +80,22 @@ class TestObject(dbus.service.Object, TestInterface):
def CheckInheritance(self):
return True
+ @dbus.service.method('org.freedesktop.DBus.TestSuiteInterface', in_signature='bbv', out_signature='v', async_callbacks=('return_cb', 'error_cb'))
+ def AsynchronousMethod(self, async, fail, variant, return_cb, error_cb):
+ try:
+ if async:
+ gobject.timeout_add(500, self.AsynchronousMethod, False, fail, variant, return_cb, error_cb)
+ return
+ else:
+ if fail:
+ raise RuntimeError
+ else:
+ return_cb(variant)
+
+ return False # do not run again
+ except Exception, e:
+ error_cb(e)
+
session_bus = dbus.SessionBus()
name = dbus.service.BusName("org.freedesktop.DBus.TestSuitePythonService", bus=session_bus)
object = TestObject(name)