diff options
author | Benjamin Berg <bberg@redhat.com> | 2022-02-10 17:49:52 +0100 |
---|---|---|
committer | Benjamin Berg <benjamin@sipsolutions.net> | 2022-02-10 18:30:27 +0000 |
commit | ca1e78efd7d1d03b212186bdc92bba96227c1eac (patch) | |
tree | cd1aa85c39ee8e23face8dd9a3f17a7a1a9fc49f /plugins | |
parent | a96bf904468ce93fde86e75f960ebed0eb900adc (diff) | |
download | gnome-settings-daemon-ca1e78efd7d1d03b212186bdc92bba96227c1eac.tar.gz |
power: Make startup of lid tests more reliable
The lid-switch is inhibited at startup, and a number of tests rely on
this inhibition to have been released again. Unfortunately, it seems
that sometimes we were not clearing all messages properly. Either way,
explicitly waiting for the uninhibit that happens at startup is sane.
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/power/test.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/power/test.py b/plugins/power/test.py index daef0e1a..c35c1541 100755 --- a/plugins/power/test.py +++ b/plugins/power/test.py @@ -594,7 +594,8 @@ class PowerPluginTest4(PowerPluginBase): dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND), dbus_interface='org.gnome.SessionManager') - time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT) + # Wait for startup inhibition to be gone + self.check_for_lid_uninhibited(gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 2) # Close the lid self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True) @@ -621,7 +622,8 @@ class PowerPluginTest4(PowerPluginBase): dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND), dbus_interface='org.gnome.SessionManager') - time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT) + # Wait for startup inhibition to be gone + self.check_for_lid_uninhibited(gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 2) # Close the lid self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True) @@ -645,7 +647,8 @@ class PowerPluginTest4(PowerPluginBase): dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND), dbus_interface='org.gnome.SessionManager') - time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT) + # Wait for startup inhibition to be gone + self.check_for_lid_uninhibited(gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 2) # Close the lid self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True) @@ -669,9 +672,8 @@ class PowerPluginTest5(PowerPluginBase): 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.clear() + # Wait for startup inhibition to be gone + self.check_for_lid_uninhibited(gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 2) idle_delay = math.ceil(gsdpowerconstants.MINIMUM_IDLE_DIM_DELAY / gsdpowerconstants.IDLE_DELAY_TO_IDLE_DIM_MULTIPLIER) self.reset_idle_timer() @@ -718,9 +720,8 @@ class PowerPluginTest5(PowerPluginBase): def test_lid_close_inhibition(self): '''Check that we correctly inhibit suspend with an external monitor''' - # Wait and flush log - time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 1) - self.plugin_log.clear() + # Wait for startup inhibition to be gone + self.check_for_lid_uninhibited(gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 2) # Add an external monitor self.set_has_external_monitor(True) |