summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/scripts/console-kit-no-xdg-runtime.conf38
-rw-r--r--tests/scripts/console-kit.conf4
-rw-r--r--tests/src/test-runner.c22
-rwxr-xr-xtests/test-console-kit-no-xdg-runtime2
5 files changed, 66 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 770d96a5..d9f9556a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -199,6 +199,7 @@ TESTS = \
test-audit-autologin \
test-no-accounts-service \
test-console-kit \
+ test-console-kit-no-xdg-runtime \
test-no-console-kit \
test-no-login1 \
test-no-console-kit-or-login1 \
@@ -422,6 +423,7 @@ EXTRA_DIST = \
scripts/change-authentication.conf \
scripts/cancel-authentication.conf \
scripts/console-kit.conf \
+ scripts/console-kit-no-xdg-runtime.conf \
scripts/corrupt-xauthority.conf \
scripts/crash-authenticate.conf \
scripts/cred-error.conf \
diff --git a/tests/scripts/console-kit-no-xdg-runtime.conf b/tests/scripts/console-kit-no-xdg-runtime.conf
new file mode 100644
index 00000000..08e99f11
--- /dev/null
+++ b/tests/scripts/console-kit-no-xdg-runtime.conf
@@ -0,0 +1,38 @@
+#
+# Check ConsoleKit works when GetXDGRuntime is not supported
+#
+
+[test-runner-config]
+disable-login1=true
+ck-no-xdg-runtime=true
+
+[Seat:*]
+autologin-user=have-password1
+user-session=default
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7 SEAT=seat0
+
+# Daemon connects when X server is ready
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+
+# Session starts
+#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_COOKIE=ck-cookie-x:0 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1
+#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:0
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Check XDG_RUNTIME_DIR is NOT set
+#?*SESSION-X-0 READ-ENV NAME=XDG_RUNTIME_DIR
+#?SESSION-X-0 READ-ENV NAME=XDG_RUNTIME_DIR VALUE=
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/console-kit.conf b/tests/scripts/console-kit.conf
index 97dccfb4..16d4a863 100644
--- a/tests/scripts/console-kit.conf
+++ b/tests/scripts/console-kit.conf
@@ -26,6 +26,10 @@ user-session=default
#?XSERVER-0 ACCEPT-CONNECT
#?SESSION-X-0 CONNECT-XSERVER
+# Check XDG_RUNTIME_DIR is set
+#?*SESSION-X-0 READ-ENV NAME=XDG_RUNTIME_DIR
+#?SESSION-X-0 READ-ENV NAME=XDG_RUNTIME_DIR VALUE=/run/console-kit
+
# Cleanup
#?*STOP-DAEMON
#?SESSION-X-0 TERMINATE SIGNAL=15
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c
index 5694e5f4..1cc6962b 100644
--- a/tests/src/test-runner.c
+++ b/tests/src/test-runner.c
@@ -1395,7 +1395,11 @@ handle_ck_session_call (GDBusConnection *connection,
{
CKSession *session = user_data;
- if (strcmp (method_name, "Lock") == 0)
+ if (strcmp (method_name, "GetXDGRuntimeDir") == 0 && !g_key_file_get_boolean (config, "test-runner-config", "ck-no-xdg-runtime", NULL))
+ {
+ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", "/run/console-kit"));
+ }
+ else if (strcmp (method_name, "Lock") == 0)
{
if (!session->locked)
check_status ("CONSOLE-KIT LOCK-SESSION");
@@ -1464,9 +1468,20 @@ ck_name_acquired_cb (GDBusConnection *connection,
{
handle_ck_call,
};
+ const gchar *ck_session_interface_old =
+ "<node>"
+ " <interface name='org.freedesktop.ConsoleKit.Session'>"
+ " <method name='Lock'/>"
+ " <method name='Unlock'/>"
+ " <method name='Activate'/>"
+ " </interface>"
+ "</node>";
const gchar *ck_session_interface =
"<node>"
" <interface name='org.freedesktop.ConsoleKit.Session'>"
+ " <method name='GetXDGRuntimeDir'>"
+ " <arg name='dir' direction='out' type='s'/>"
+ " </method>"
" <method name='Lock'/>"
" <method name='Unlock'/>"
" <method name='Activate'/>"
@@ -1481,7 +1496,10 @@ ck_name_acquired_cb (GDBusConnection *connection,
g_clear_error (&error);
if (!ck_info)
return;
- ck_session_info = g_dbus_node_info_new_for_xml (ck_session_interface, &error);
+ if (g_key_file_get_boolean (config, "test-runner-config", "ck-no-xdg-runtime", NULL))
+ ck_session_info = g_dbus_node_info_new_for_xml (ck_session_interface_old, &error);
+ else
+ ck_session_info = g_dbus_node_info_new_for_xml (ck_session_interface, &error);
if (error)
g_warning ("Failed to parse D-Bus interface: %s", error->message);
g_clear_error (&error);
diff --git a/tests/test-console-kit-no-xdg-runtime b/tests/test-console-kit-no-xdg-runtime
new file mode 100755
index 00000000..e64b3850
--- /dev/null
+++ b/tests/test-console-kit-no-xdg-runtime
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner console-kit-no-xdg-runtime test-gobject-greeter