mutter/0002-tests-dbusmock-templat...

66 lines
2.2 KiB
Diff

From 742316746d50084dda4ebda5ad081e59451e3256 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 11 Oct 2023 09:37:54 -0400
Subject: [PATCH 2/4] tests/dbusmock-templates/rtkit: Add
MakeThreadHighPriority
mutter will soon need to call an additional method in RTKit,
MakeThreadHighPriority.
In preparation for that, this commit stubs it out in the
dbusmock template.
---
src/tests/dbusmock-templates/rtkit.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/tests/dbusmock-templates/rtkit.py b/src/tests/dbusmock-templates/rtkit.py
index 168582de8..766bd681e 100644
--- a/src/tests/dbusmock-templates/rtkit.py
+++ b/src/tests/dbusmock-templates/rtkit.py
@@ -1,38 +1,42 @@
# 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) 2022 Red Hat Inc.'
import dbus
from dbusmock import MOCK_IFACE, mockobject
BUS_NAME = 'org.freedesktop.RealtimeKit1'
MAIN_OBJ = '/org/freedesktop/RealtimeKit1'
MAIN_IFACE = 'org.freedesktop.RealtimeKit1'
SYSTEM_BUS = True
def load(mock, parameters):
mock.AddProperty(MAIN_IFACE, 'RTTimeUSecMax', dbus.Int64(200000))
mock.AddProperty(MAIN_IFACE, 'MaxRealtimePriority', dbus.Int32(20))
mock.AddProperty(MAIN_IFACE, 'MinNiceLevel', dbus.Int32(-15))
mock.priorities = dict()
@dbus.service.method(MAIN_IFACE, in_signature='tu')
def MakeThreadRealtime(self, thread, priority):
self.priorities[thread] = priority
+@dbus.service.method(MAIN_IFACE, in_signature='tu')
+def MakeThreadHighPriority(self, thread, priority):
+ self.priorities[thread] = priority
+
@dbus.service.method(MOCK_IFACE)
def Reset(self):
self.priorities = dict()
@dbus.service.method(MOCK_IFACE, in_signature='t', out_signature='u')
def GetThreadPriority(self, thread):
if thread in self.priorities:
return self.priorities[thread]
else:
return 0
--
2.41.0