[mutter] tests/mock/logind: Add mock seat and session
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests/mock/logind: Add mock seat and session
- Date: Fri, 14 Jan 2022 09:53:33 +0000 (UTC)
commit 8372af9cd70e156fe122a51a19528d9001fd5a47
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Dec 10 23:39:50 2021 +0100
tests/mock/logind: Add mock seat and session
Will be needed for KMS testing in KVM.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
src/tests/meta-dbus-runner.py | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/tests/meta-dbus-runner.py b/src/tests/meta-dbus-runner.py
index 5663fce107..69daa0af21 100755
--- a/src/tests/meta-dbus-runner.py
+++ b/src/tests/meta-dbus-runner.py
@@ -5,6 +5,7 @@ import sys
import os
import fcntl
import subprocess
+import getpass
from collections import OrderedDict
from dbusmock import DBusTestCase
from dbus.mainloop.glib import DBusGMainLoop
@@ -39,12 +40,14 @@ class MutterDBusTestCase(DBusTestCase):
(klass.mocks_manager, klass.mock_obj) = klass.start_from_local_template(
'meta-mocks-manager', {'templates-dir': get_templates_dir()})
- klass.start_from_template('logind')
+ logind = klass.start_from_template('logind')
klass.start_from_local_template('localed')
klass.system_bus_con = klass.get_dbus(system_bus=True)
klass.session_bus_con = klass.get_dbus(system_bus=False)
+ klass.add_logind_session(logind)
+
if klass.session_bus_con.name_has_owner('org.gnome.Mutter.DisplayConfig'):
raise Exception(
'org.gnome.Mutter.DisplayConfig already has owner on the session bus, bailing')
@@ -101,6 +104,15 @@ class MutterDBusTestCase(DBusTestCase):
assert klass.mocks.setdefault(mock_class, mocks) == mocks
return mocks
+ @classmethod
+ def add_logind_session(klass, logind):
+ [p_mock, obj] = logind
+ mock_iface = 'org.freedesktop.DBus.Mock'
+ obj.AddSeat('seat0', dbus_interface=mock_iface)
+ obj.AddSession('dummy', 'seat0',
+ dbus.types.UInt32(os.getuid()), getpass.getuser(),
+ True, dbus_interface=mock_iface)
+
def wrap_call(self, args):
env = {}
env.update(os.environ)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]