mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 12:52:14 +00:00
tests/dbus-runner: Add mocked screensaver service
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3234>
This commit is contained in:
parent
4a600e1031
commit
10d8c5fa82
35
src/tests/dbusmock-templates/screensaver.py
Normal file
35
src/tests/dbusmock-templates/screensaver.py
Normal file
@ -0,0 +1,35 @@
|
||||
'''org.freedesktop.Screensaver proxy mock template
|
||||
'''
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Lesser General Public License as published by the Free
|
||||
# Software Foundation; either version 3 of the License, or (at your option) any
|
||||
# later version. See http://www.gnu.org/copyleft/lgpl.html for the full text
|
||||
# of the license.
|
||||
|
||||
__author__ = 'Jonas Ådahl'
|
||||
__copyright__ = '(c) 2023 Red Hat Inc.'
|
||||
|
||||
import dbus
|
||||
import os
|
||||
import random
|
||||
from dbusmock import MOCK_IFACE
|
||||
|
||||
|
||||
BUS_NAME = 'org.freedesktop.Screensaver'
|
||||
MAIN_OBJ = '/org/freedesktop/Screensaver'
|
||||
MAIN_IFACE = BUS_NAME
|
||||
SYSTEM_BUS = False
|
||||
|
||||
|
||||
def load(mock, parameters=None):
|
||||
pass
|
||||
|
||||
|
||||
@dbus.service.method(MAIN_IFACE, in_signature='ss', out_signature='u')
|
||||
def Inhibit(self, application_name, reason):
|
||||
return random.randint(0, 10000)
|
||||
|
||||
@dbus.service.method(MAIN_IFACE, in_signature='u')
|
||||
def Uninhibit(self, cookie):
|
||||
pass
|
@ -49,6 +49,7 @@ class MutterDBusRunner(DBusTestCase):
|
||||
klass.start_from_local_template('colord')
|
||||
klass.start_from_local_template('gsd-color')
|
||||
klass.start_from_local_template('rtkit')
|
||||
klass.start_from_local_template('screensaver')
|
||||
|
||||
klass.system_bus_con = klass.get_dbus(system_bus=True)
|
||||
klass.session_bus_con = klass.get_dbus(system_bus=False)
|
||||
|
Loading…
Reference in New Issue
Block a user