summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2018-04-30 12:27:24 +0200
committerCarlos Garnacho <mrgarnacho@gmail.com>2018-07-19 10:41:59 +0000
commitda20498b6244a8f897f5dead08ee816d7870dbbd (patch)
tree7a7371ef61203e11368848abb075d389cf85fe2b
parent5a804b5cc66fd9cc5cf4784da63f4ed26df4bea0 (diff)
downloadgnome-settings-daemon-da20498b6244a8f897f5dead08ee816d7870dbbd.tar.gz
power: Make power test more robust
Reset the idle time and wait for lid inhibition to be removed. This should make the test more reliable avoiding some potential race conditions.
-rwxr-xr-xplugins/power/test.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/power/test.py b/plugins/power/test.py
index eaa5341b..82f46c58 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -739,7 +739,12 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
def test_dim(self):
'''Check that we do go to dim'''
+ # Wait and flush log
+ time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 1)
+ self.plugin_log.read()
+
idle_delay = round(gsdpowerconstants.MINIMUM_IDLE_DIM_DELAY / gsdpowerconstants.IDLE_DELAY_TO_IDLE_DIM_MULTIPLIER)
+ self.reset_idle_timer()
self.settings_session['idle-delay'] = idle_delay
self.settings_gsd_power['sleep-inactive-battery-timeout'] = idle_delay + 1
@@ -751,7 +756,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
self.assertEqual(self.get_status(), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
# Wait and check we're not idle, but dimmed
- self.check_dim(gsdpowerconstants.MINIMUM_IDLE_DIM_DELAY)
+ self.check_dim(gsdpowerconstants.MINIMUM_IDLE_DIM_DELAY + 1)
# Give time for the brightness to change
time.sleep(2)
level = self.get_brightness();