[gnome-settings-daemon] power: Wait for g-s-d to setup activity watch during testing



commit 975d901a5f97e6c73e41938d9bc5fb78e873236e
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Jan 4 16:16:59 2018 +0100

    power: Wait for g-s-d to setup activity watch during testing
    
    Some tests create activity just after the screen is blanked. There is a
    race condition as setting up the active monitor may only be done after
    the idle time has been reset.
    Prevent this by adding a short sleep. This race is inherent to
    GnomeIdleMonitor.
    
    Note that the race condition is actually between the call to
    gnome_idle_monitor_add_user_active_watch and mutter receiving the dbus
    method call.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792210

 plugins/power/test.py |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 0d62907..c60190d 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -436,8 +436,9 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
         # blank is supposed to happen straight away
         self.check_blank(2)
 
-        # wiggle the mouse now and check for unblank; this is expected to pop up
-        # the locked screen saver
+        # Wait a bit for the active watch to be registered through dbus, then
+        # fake user activity and check that the screen is unblanked.
+        time.sleep(0.5)
         self.reset_idle_timer()
         self.check_unblank(2)
 
@@ -448,9 +449,9 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
         # and check for blank after the blank timeout
         self.check_blank(10)
 
-        # and do it again
-
-        # wiggle
+        # Wait a bit for the active watch to be registered through dbus, then
+        # fake user activity and check that the screen is unblanked.
+        time.sleep(0.5)
         self.reset_idle_timer()
         self.check_unblank(2)
 
@@ -474,8 +475,9 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
         # blank is supposed to happen straight away
         self.check_blank(2)
 
-        # wiggle the mouse now and check for unblank; this is expected to pop up
-        # the locked screen saver
+        # Wait a bit for the active watch to be registered through dbus, then
+        # fake user activity and check that the screen is unblanked.
+        time.sleep(0.5)
         self.reset_idle_timer()
         self.check_unblank(2)
         self.assertTrue(self.get_brightness() == gsdpowerconstants.GSD_MOCK_DEFAULT_BRIGHTNESS , 'incorrect 
unblanked brightness (%d != %d)' % (self.get_brightness(), gsdpowerconstants.GSD_MOCK_DEFAULT_BRIGHTNESS))


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