mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-09 04:13:33 +02:00
tests: Add test for a client vanishing during claim
Note that this test only works if the virtual_image driver opens up a window for race condition by delaying the open callback.
This commit is contained in:
@ -650,6 +650,37 @@ class FPrintdVirtualDeviceTest(FPrintdVirtualDeviceBaseTest):
|
|||||||
self.device.Claim('(s)', 'testuser')
|
self.device.Claim('(s)', 'testuser')
|
||||||
self.device.Release()
|
self.device.Release()
|
||||||
|
|
||||||
|
def test_claim_disconnect(self):
|
||||||
|
addr = os.environ['DBUS_SYSTEM_BUS_ADDRESS']
|
||||||
|
|
||||||
|
# Get a separat bus connection
|
||||||
|
dbus = Gio.DBusConnection.new_for_address_sync(addr,
|
||||||
|
Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION |
|
||||||
|
Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT, None, None)
|
||||||
|
assert dbus.is_closed() == False
|
||||||
|
|
||||||
|
|
||||||
|
dev_path = self.device.get_object_path()
|
||||||
|
dev = Gio.DBusProxy.new_sync(dbus,
|
||||||
|
Gio.DBusProxyFlags.DO_NOT_AUTO_START,
|
||||||
|
None,
|
||||||
|
'net.reactivated.Fprint',
|
||||||
|
dev_path,
|
||||||
|
'net.reactivated.Fprint.Device',
|
||||||
|
None)
|
||||||
|
|
||||||
|
def call_done(obj, result, user_data):
|
||||||
|
# Ignore the callback (should be an error)
|
||||||
|
pass
|
||||||
|
|
||||||
|
# Do an async call to claim and immediately close
|
||||||
|
dev.Claim('(s)', 'testuser', result_handler=call_done)
|
||||||
|
|
||||||
|
# Ensure the call is on the wire, then close immediately
|
||||||
|
dbus.flush_sync()
|
||||||
|
dbus.close_sync()
|
||||||
|
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
class FPrintdVirtualDeviceClaimedTest(FPrintdVirtualDeviceBaseTest):
|
class FPrintdVirtualDeviceClaimedTest(FPrintdVirtualDeviceBaseTest):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user