diff --git a/tests/__init__.py b/tests/__init__.py index 0f3dc9eb9..8b898a009 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -91,18 +91,23 @@ def get_mock_iface(bus: dbus.Bus, bus_name: Optional[str] = None): return dbus.Interface(obj, dbusmock.MOCK_IFACE) -def portal_interface_name(portal_name) -> str: +def portal_interface_name(portal_name, domain: Optional[str] = None) -> str: """ Returns the fully qualified interface for a portal name. """ - return f"org.freedesktop.portal.{portal_name}" + if domain: + return f"org.freedesktop.{domain}.portal.{portal_name}" + else: + return f"org.freedesktop.portal.{portal_name}" -def get_portal_iface(bus: dbus.Bus, name: str) -> dbus.Interface: +def get_portal_iface( + bus: dbus.Bus, name: str, domain: Optional[str] = None +) -> dbus.Interface: """ Returns the dbus interface for a portal name. """ - name = portal_interface_name(name) + name = portal_interface_name(name, domain) return get_iface(bus, name) @@ -139,14 +144,16 @@ def get_xdp_dbus_object(bus: dbus.Bus) -> dbus.proxies.ProxyObject: return obj -def check_version(bus: dbus.Bus, portal_name: str, expected_version: int): +def check_version( + bus: dbus.Bus, portal_name: str, expected_version: int, domain: Optional[str] = None +): """ Checks that the portal_name portal version is equal to expected_version. """ properties_intf = dbus.Interface( get_xdp_dbus_object(bus), "org.freedesktop.DBus.Properties" ) - portal_iface_name = portal_interface_name(portal_name) + portal_iface_name = portal_interface_name(portal_name, domain) try: portal_version = properties_intf.Get(portal_iface_name, "version") assert int(portal_version) == expected_version diff --git a/tests/templates/__init__.py b/tests/templates/__init__.py index 466ee35f7..ea9fc2f3b 100644 --- a/tests/templates/__init__.py +++ b/tests/templates/__init__.py @@ -142,9 +142,11 @@ def __init__( mock: dbusmock.DBusMockObject, busname: str, handle: str, + app_id: str, ): self.mock = mock # the main mock object self.handle = handle + self.app_id = app_id self.closed = False self._close_callback: Optional[Callable] = None diff --git a/tests/templates/globalshortcuts.py b/tests/templates/globalshortcuts.py index cda286445..e028786ee 100644 --- a/tests/templates/globalshortcuts.py +++ b/tests/templates/globalshortcuts.py @@ -49,7 +49,7 @@ def CreateSession(self, handle, session_handle, app_id, options, cb_success, cb_ try: logger.debug(f"CreateSession({handle}, {session_handle}, {app_id}, {options})") - session = ImplSession(self, BUS_NAME, session_handle).export() + session = ImplSession(self, BUS_NAME, session_handle, app_id).export() self.sessions[session_handle] = session response = Response(self.response, {"session_handle": session.handle}) diff --git a/tests/templates/inhibit.py b/tests/templates/inhibit.py index 11a239d5c..dee67089a 100644 --- a/tests/templates/inhibit.py +++ b/tests/templates/inhibit.py @@ -116,7 +116,7 @@ def CreateMonitor(self, handle, session_handle, app_id, window, cb_success, cb_e try: logger.debug(f"CreateMonitor({handle}, {session_handle}, {app_id}, {window})") - session = ImplSession(self, BUS_NAME, session_handle).export() + session = ImplSession(self, BUS_NAME, session_handle, app_id).export() self.sessions[session_handle] = session def closed_callback(): diff --git a/tests/templates/remotedesktop.py b/tests/templates/remotedesktop.py index 9c2351734..f6669af54 100644 --- a/tests/templates/remotedesktop.py +++ b/tests/templates/remotedesktop.py @@ -52,7 +52,7 @@ def CreateSession(self, handle, session_handle, app_id, options, cb_success, cb_ try: logger.debug(f"CreateSession({handle}, {session_handle}, {app_id}, {options})") - session = ImplSession(self, BUS_NAME, session_handle).export() + session = ImplSession(self, BUS_NAME, session_handle, app_id).export() self.sessions[session_handle] = session response = Response(self.response, {"session_handle": session.handle})