summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2018-04-12 13:28:55 +0200
committerBenjamin Berg <bberg@redhat.com>2018-04-12 14:01:15 +0200
commit20526020b08ed9eade4d6c273a7c3cd535cfab49 (patch)
tree5ddd41e9ffc50f92f98bcd3f04068dd28bf1b65e
parenta6e3ee40d90294c603e1108e19ef8fe8e6af61eb (diff)
downloadgnome-settings-daemon-20526020b08ed9eade4d6c273a7c3cd535cfab49.tar.gz
power: Test Suspend and SuspendAndHibernate separately
-rwxr-xr-xplugins/power/test.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 336d2428..93b8730f 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -581,8 +581,9 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
# And check we're not idle
self.assertEqual(self.get_status(), gsdpowerenums.GSM_PRESENCE_STATUS_AVAILABLE)
- def test_sleep_inactive_battery(self):
- '''sleep-inactive-battery-timeout'''
+ def test_sleep_inactive_battery_hibernate_then_suspend(self):
+ '''Verify we SuspendThenHibernate on sleep-inactive-battery-timeout when SuspendThenHibernate is available'''
+ # Hibernate then suspend is the default
self.settings_session['idle-delay'] = 2
self.settings_gsd_power['sleep-inactive-battery-timeout'] = 5
@@ -593,7 +594,24 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
# suspend should happen after inactive sleep timeout + 1 s notification
# delay + 1 s error margin
- self.check_for_suspend(7)
+ self.check_for_suspend(7, methods=['SuspendThenHibernate'])
+
+ def test_sleep_inactive_battery_no_hibernate_then_suspend(self):
+ '''Verify we Suspend on sleep-inactive-battery-timeout when SuspendThenHibernate is unavailable'''
+
+ # Patch up logind_ctl to not return "yes" for CanSuspendThenHibernate
+ self.logind_obj.AddMethod('org.freedesktop.login1.Manager', 'CanSuspendThenHibernate', '', 's', 'ret = "no"')
+
+ self.settings_session['idle-delay'] = 2
+ self.settings_gsd_power['sleep-inactive-battery-timeout'] = 5
+ self.settings_gsd_power['sleep-inactive-battery-type'] = 'suspend'
+
+ # wait for idle delay; should not yet suspend
+ self.check_no_suspend(2)
+
+ # suspend should happen after inactive sleep timeout + 1 s notification
+ # delay + 1 s error margin
+ self.check_for_suspend(7, methods=["Suspend"])
def _test_suspend_no_hibernate(self):
'''suspend-no-hibernate'''