[gnome-settings-daemon] power: Ensure test does not try to close the lid early



commit 75551e6b5f50aa9f0b7a0ce54fcc7a7ee204c93f
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Jan 4 16:02:42 2018 +0100

    power: Ensure test does not try to close the lid early
    
    GSD waits a while before a lid close action can affect anything. As the
    setup routine updates the monitors, this safety timeout will be taken
    into account.
    
    This could cause rare test failures if the initialisation was too quick.
    Add the explicit sleep to prevent any errors.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792210

 plugins/power/test.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 9f0120f..0d62907 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -603,6 +603,8 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
             dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND),
             dbus_interface='org.gnome.SessionManager')
 
+        time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT)
+
         # Close the lid
         self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True)
         self.obj_upower.EmitSignal('', 'Changed', '', [], dbus_interface='org.freedesktop.DBus.Mock')
@@ -627,6 +629,8 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
             dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND),
             dbus_interface='org.gnome.SessionManager')
 
+        time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT)
+
         # Close the lid
         self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True)
         self.obj_upower.EmitSignal('', 'Changed', '', [], dbus_interface='org.freedesktop.DBus.Mock')
@@ -648,6 +652,8 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
             dbus.UInt32(gsdpowerenums.GSM_INHIBITOR_FLAG_SUSPEND),
             dbus_interface='org.gnome.SessionManager')
 
+        time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT)
+
         # Close the lid
         self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True)
         self.obj_upower.EmitSignal('', 'Changed', '', [], dbus_interface='org.freedesktop.DBus.Mock')
@@ -712,7 +718,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
 
         # Add an external monitor
         self.set_has_external_monitor(True)
-        time.sleep (1)
+        time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 1)
 
         # Close the lid
         self.obj_upower.Set('org.freedesktop.UPower', 'LidIsClosed', True)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]