summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2018-01-04 16:16:59 +0100
committerBenjamin Berg <bberg@redhat.com>2018-01-15 15:19:43 +0100
commit975d901a5f97e6c73e41938d9bc5fb78e873236e (patch)
tree5586f5f06f7597464643198601d57636c93539df
parent75551e6b5f50aa9f0b7a0ce54fcc7a7ee204c93f (diff)
downloadgnome-settings-daemon-975d901a5f97e6c73e41938d9bc5fb78e873236e.tar.gz
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
-rwxr-xr-xplugins/power/test.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 0d629079..c60190da 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))