[gnome-settings-daemon] power: Add tests for gnome-session's idle-delay handling
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Add tests for gnome-session's idle-delay handling
- Date: Mon, 21 Jan 2013 22:32:33 +0000 (UTC)
commit 82d550c0b975866c4df32d925a2e84dc4061994f
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jan 21 23:26:56 2013 +0100
power: Add tests for gnome-session's idle-delay handling
It's currently broken, see bug 692082
plugins/power/test.py | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 6a7dad6..687ab7a 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -11,6 +11,7 @@ import sys
import time
import os
import os.path
+import signal
project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
builddir = os.environ.get('BUILDDIR', os.path.dirname(__file__))
@@ -201,6 +202,38 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
# and check for blank after the blank timeout
self.check_blank(10)
+ def test_session_idle_delay(self):
+ '''verify that session idle delay works as expected when changed'''
+
+ obj_session_presence = self.session_bus_con.get_object(
+ 'org.gnome.SessionManager', '/org/gnome/SessionManager/Presence')
+ dbus_props = dbus.Interface(obj_session_presence, dbus.PROPERTIES_IFACE)
+
+ # Verify that idle is set after 5 seconds
+ self.settings_session['idle-delay'] = 5
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
+ time.sleep(7)
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_IDLE)
+
+ # Raise the idle delay, and see that we stop being idle
+ # and get idle again after the timeout
+ self.settings_session['idle-delay'] = 10
+ self.reset_idle_timer()
+ time.sleep(5)
+ os.kill(self.session.pid, signal.SIGUSR2)
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
+ time.sleep(10)
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_IDLE)
+
+ # Lower the delay again, and see that we get idle as we should
+ self.settings_session['idle-delay'] = 5
+ self.reset_idle_timer()
+ time.sleep(2)
+ os.kill(self.session.pid, signal.SIGUSR2)
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
+ time.sleep(5)
+ self.assertEqual(dbus_props.Get('org.gnome.SessionManager.Presence', 'status'), gsdpowerenums.GSM_PRESENCE_STATUS_IDLE)
+
def test_sleep_inactive_battery(self):
'''sleep-inactive-battery-timeout'''
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]