diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2016-11-28 15:29:13 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2016-11-28 15:29:13 +1300 |
commit | 960444b539adec771de34d520e0edab872eb9f62 (patch) | |
tree | 7184593a3ffae4979975d65cf49a206e81e462e8 /tests/src | |
parent | 470340e184b7dc12641769a03037100e8bd4d597 (diff) | |
download | lightdm-git-960444b539adec771de34d520e0edab872eb9f62.tar.gz |
Add a test for logind TerminateSession calls
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/test-runner.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c index bcb6f8ee..d4d2ccfa 100644 --- a/tests/src/test-runner.c +++ b/tests/src/test-runner.c @@ -1871,6 +1871,28 @@ handle_login1_call (GDBusConnection *connection, g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); } + else if (strcmp (method_name, "TerminateSession") == 0) + { + const gchar *id; + Login1Session *session; + + g_variant_get (parameters, "(&s)", &id); + session = find_login1_session (id); + if (!session) + { + g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such session: %s", id); + return; + } + + if (g_key_file_get_boolean (config, "test-runner-config", "log-login1-terminate", NULL)) + { + gchar *status = g_strdup_printf ("LOGIN1 TERMINATE-SESSION SESSION=%s", id); + check_status (status); + g_free (status); + } + + g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); + } else if (strcmp (method_name, "CanReboot") == 0) { check_status ("LOGIN1 CAN-REBOOT"); @@ -1947,6 +1969,9 @@ login1_name_acquired_cb (GDBusConnection *connection, " <method name='ActivateSession'>" " <arg name='id' type='s' direction='in'/>" " </method>" + " <method name='TerminateSession'>" + " <arg name='id' type='s' direction='in'/>" + " </method>" " <method name='CanReboot'>" " <arg name='result' direction='out' type='s'/>" " </method>" |