tests/dbusmock/colord: Implement FindProfileById
It's used when cleaning up profiles on race conditions. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2622>
This commit is contained in:
parent
8a53020e80
commit
a2000a1132
@ -57,6 +57,9 @@ def profile_id_from_path(mock, path):
|
||||
class ColordAlreadyExistsException(dbus.DBusException):
|
||||
_dbus_error_name = 'org.freedesktop.ColorManager.AlreadyExists'
|
||||
|
||||
class ColordNotFoundException(dbus.DBusException):
|
||||
_dbus_error_name = 'org.freedesktop.ColorManager.NotFound'
|
||||
|
||||
|
||||
@dbus.service.method(MAIN_IFACE, in_signature='ssa{sv}', out_signature='o')
|
||||
def CreateDevice(self, device_id, scope, props):
|
||||
@ -122,6 +125,14 @@ def DeleteProfile(self, profile_path):
|
||||
self.EmitSignal(MAIN_IFACE, 'ProfileRemoved', 'o', [profile_path])
|
||||
|
||||
|
||||
@dbus.service.method(MAIN_IFACE, in_signature='s', out_signature='o')
|
||||
def FindProfileById(self, profile_id):
|
||||
if profile_id in self.devices:
|
||||
return self.devices[profile_id]
|
||||
else:
|
||||
raise ColordNotFoundException()
|
||||
|
||||
|
||||
@dbus.service.method(MOCK_IFACE)
|
||||
def Reset(self):
|
||||
for device_path in self.devices.values():
|
||||
|
Loading…
Reference in New Issue
Block a user