summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2018-01-03 22:59:58 +0100
committerBenjamin Berg <bberg@redhat.com>2018-01-15 17:23:38 +0100
commit7f7af94d9b9d57307b3968018341d69e5597518b (patch)
tree5a34f9f032dfbafc51542af948e74645e7b28e5c /plugins
parent75b331eb8bfc94d66148aae474ed35ceff0df31f (diff)
downloadgnome-settings-daemon-7f7af94d9b9d57307b3968018341d69e5597518b.tar.gz
power: Add test that inhibitors don't unblank the screensaver
https://bugzilla.gnome.org/show_bug.cgi?id=792209
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/power/test.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/plugins/power/test.py b/plugins/power/test.py
index c81e57d0..b748fcb9 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'''