Commit faa4a9ee authored by Bastien Nocera's avatar Bastien Nocera

power: Export the LID_CLOSE_SAFETY_TIMEOUT constant

And use it in the tests.
parent 1e14c67c
......@@ -37,3 +37,7 @@
/* Default brightness values for the mock backlight used in the test suite */
#define GSD_MOCK_DEFAULT_BRIGHTNESS 50
#define GSD_MOCK_MAX_BRIGHTNESS 100
/* When unplugging the external monitor, give a certain amount
* of time before suspending the laptop */
#define LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */
......@@ -78,7 +78,6 @@
#define GSD_POWER_MANAGER_NOTIFY_TIMEOUT_LONG 30 * 1000 /* ms */
#define GSD_POWER_MANAGER_RECALL_DELAY 30 /* seconds */
#define GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT 30 /* seconds */
#define SYSTEMD_DBUS_NAME "org.freedesktop.login1"
#define SYSTEMD_DBUS_PATH "/org/freedesktop/login1"
......@@ -2195,9 +2194,9 @@ setup_inhibit_lid_switch_timer (GsdPowerManager *manager)
g_debug ("setting up lid close safety timer");
manager->priv->inhibit_lid_switch_timer_id = g_timeout_add_seconds (GSD_POWER_MANAGER_LID_CLOSE_SAFETY_TIMEOUT,
(GSourceFunc) inhibit_lid_switch_timer_cb,
manager);
manager->priv->inhibit_lid_switch_timer_id = g_timeout_add_seconds (LID_CLOSE_SAFETY_TIMEOUT,
(GSourceFunc) inhibit_lid_switch_timer_cb,
manager);
g_source_set_name_by_id (manager->priv->inhibit_lid_switch_timer_id, "[GsdPowerManager] lid close safety timer");
}
......
......@@ -13,3 +13,4 @@ MINIMUM_IDLE_DIM_DELAY = 10;
POWER_UP_TIME_ON_AC = 15;
GSD_MOCK_DEFAULT_BRIGHTNESS = 50;
GSD_MOCK_MAX_BRIGHTNESS = 100;
LID_CLOSE_SAFETY_TIMEOUT = 30;
......@@ -575,7 +575,7 @@ class PowerPluginTest(gsdtestcase.GSDTestCase):
# Unplug the external monitor
self.set_has_external_monitor(False)
# Wait for the safety timer + 3 seconds
time.sleep (30 + 3)
time.sleep (gsdpowerconstants.LID_CLOSE_SAFETY_TIMEOUT + 3)
# Check that we're uninhibited
self.check_for_uninhibited()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment