[gnome-settings-daemon] power: Add test that inhibitors don't unblank the screensaver
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Add test that inhibitors don't unblank the screensaver
- Date: Mon, 15 Jan 2018 16:24:41 +0000 (UTC)
commit 7f7af94d9b9d57307b3968018341d69e5597518b
Author: Benjamin Berg <bberg redhat com>
Date: Wed Jan 3 22:59:58 2018 +0100
power: Add test that inhibitors don't unblank the screensaver
https://bugzilla.gnome.org/show_bug.cgi?id=792209
plugins/power/test.py | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index c81e57d..b748fcb 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -389,6 +389,15 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
log = self.plugin_log.read()
self.assertFalse('TESTSUITE: Blanked screen' in log, 'unexpected blank request')
+ def check_no_unblank(self, seconds):
+ '''Check that no unblank is requested in the given time'''
+
+ # wait for specified time to ensure it didn't unblank
+ time.sleep(seconds)
+ # check that it did not unblank
+ log = self.plugin_log.read()
+ self.assertFalse('TESTSUITE: Unblanked screen' in log, 'unexpected unblank request')
+
def test_screensaver(self):
# Note that the screensaver mock object
# doesn't know how to get out of being active,
@@ -459,6 +468,33 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id),
dbus_interface='org.gnome.SessionManager')
+ def test_screensaver_no_unblank(self):
+ '''Ensure the screensaver is not unblanked for new inhibitors.'''
+
+ # Lower idle delay a lot
+ self.settings_session['idle-delay'] = 1
+
+ # Bring down the screensaver
+ self.obj_screensaver.SetActive(True)
+ self.assertTrue(self.obj_screensaver.GetActive(), 'screensaver not turned on')
+
+ # Check that we blank
+ self.check_blank(2)
+
+ # Create the different possible inhibitors
+ inhibit_id = self.obj_session_mgr.Inhibit(
+ 'testsuite', dbus.UInt32(0), 'for testing',
+ dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_IDLE | gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND |
gsdpowerenums.GSM_INHIBITOR_FLAG_LOGOUT),
+ dbus_interface='org.gnome.SessionManager')
+
+ self.check_no_unblank(2)
+
+ # Drop inhibitor
+ self.obj_session_mgr.Uninhibit(dbus.UInt32(inhibit_id),
+ dbus_interface='org.gnome.SessionManager')
+
+ self.check_no_unblank(2)
+
def test_session_idle_delay(self):
'''verify that session idle delay works as expected when changed'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]