]> rtime.felk.cvut.cz Git - sojka/lightdm.git/commitdiff
Add test for set-next-session
authorMichael Terry <michael.terry@canonical.com>
Mon, 26 Aug 2013 15:16:00 +0000 (11:16 -0400)
committerMichael Terry <michael.terry@canonical.com>
Mon, 26 Aug 2013 15:16:00 +0000 (11:16 -0400)
src/seat-unity.c
tests/Makefile.am
tests/scripts/unity-compositor-next-session.conf [new file with mode: 0644]
tests/src/unity-system-compositor.c
tests/test-unity-compositor-next-session [new file with mode: 0755]

index 52a900ae8a6fc1542a997a2c9da7156b23a81d78..d8fd8eff207bf8f23604e6787fcf36839f81182a 100644 (file)
@@ -639,19 +639,20 @@ seat_unity_set_next_session (Seat *seat, Session *session)
         return;
 
     display_server = session_get_display_server (session);
-    if (IS_MIR_SERVER (display_server))
-    {
+
+    if (IS_X_SERVER_LOCAL (display_server))
+        id = x_server_local_get_mir_id (X_SERVER_LOCAL (display_server));
+    else if (IS_MIR_SERVER (display_server))
         id = mir_server_get_id (MIR_SERVER (display_server));
 
-        if (id)
-        {
-            g_debug ("Marking Mir session %s as the next session", id);
-            write_message (SEAT_UNITY (seat), USC_MESSAGE_SET_NEXT_SESSION, (const guint8 *) id, strlen (id));
-        }
-        else
-        {
-            g_warning ("Failed to work out session ID to mark");
-        }
+    if (id)
+    {
+        l_debug (seat, "Marking Mir session %s as the next session", id);
+        write_message (SEAT_UNITY (seat), USC_MESSAGE_SET_NEXT_SESSION, (const guint8 *) id, strlen (id));
+    }
+    else
+    {
+        l_debug (seat, "Failed to work out session ID to mark");
     }
 
     SEAT_CLASS (seat_unity_parent_class)->set_next_session (seat, session);
index b4a1832d6958ae9eb8b4d6c6c5e84eee4551e268..2c1bfddcb21880cc377b8e146b9e29cbfb3df055 100644 (file)
@@ -148,6 +148,7 @@ TESTS = \
        test-unity-compositor-command \
        test-unity-compositor-fail-start \
        test-unity-compositor-fail-ready \
+       test-unity-compositor-next-session \
        test-unity-autologin \
        test-unity-login \
        test-unity-switch \
diff --git a/tests/scripts/unity-compositor-next-session.conf b/tests/scripts/unity-compositor-next-session.conf
new file mode 100644 (file)
index 0000000..d3771db
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Check that we correctly set next session when switching selected greeter user
+#
+
+[SeatDefaults]
+type=unity
+user-session=default
+autologin-user=have-password2
+autologin-in-background=true
+
+#?RUNNER DAEMON-START
+
+# System compositor
+#?UNITY-SYSTEM-COMPOSITOR START VT=7 XDG_VTNR=7
+#?*UNITY-SYSTEM-COMPOSITOR READY
+
+# Greeter session
+#?XSERVER-0 START MIR-ID=0
+#?*XSERVER-0 INDICATE-READY
+#?XSERVER-0 INDICATE-READY
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7
+#?XSERVER-0 ACCEPT-CONNECT
+#?GREETER-X-0 CONNECT-XSERVER
+#?GREETER-X-0 CONNECT-TO-DAEMON
+#?GREETER-X-0 CONNECTED-TO-DAEMON
+
+# Background session
+#?XSERVER-1 START MIR-ID=1
+#?*XSERVER-1 INDICATE-READY
+#?XSERVER-1 INDICATE-READY
+#?XSERVER-1 ACCEPT-CONNECT
+#?SESSION-X-1 START XDG_SEAT=seat0 XDG_VTNR=7 USER=have-password2
+#?XSERVER-1 ACCEPT-CONNECT
+#?SESSION-X-1 CONNECT-XSERVER
+
+# System compositor switches to greeter
+#?UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=0
+
+# Switch to user without a session
+#?*GREETER-X-0 AUTHENTICATE USERNAME=have-password1
+#?GREETER-X-0 SHOW-PROMPT TEXT="Password:"
+
+# Switch to user with a session
+#?*GREETER-X-0 AUTHENTICATE USERNAME=have-password2
+#?GREETER-X-0 SHOW-PROMPT TEXT="Password:"
+#?UNITY-SYSTEM-COMPOSITOR SET-NEXT-SESSION ID=1
+
+# Cleanup
+#?*STOP-DAEMON
+#?GREETER-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?XSERVER-1 TERMINATE SIGNAL=15
+#?SESSION-X-1 TERMINATE SIGNAL=15
+#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
index 2f8e42cd6f5f81ee960cd61af51a238c9a292149..9479f544968598e1076fff89f8ee84ae0ba51062 100644 (file)
@@ -42,7 +42,8 @@ typedef enum
    USC_MESSAGE_PONG = 1,
    USC_MESSAGE_READY = 2,
    USC_MESSAGE_SESSION_CONNECTED = 3,
-   USC_MESSAGE_SET_ACTIVE_SESSION = 4
+   USC_MESSAGE_SET_ACTIVE_SESSION = 4,
+   USC_MESSAGE_SET_NEXT_SESSION = 5,
 } USCMessageID;
 
 static void
@@ -103,6 +104,9 @@ read_message_cb (GIOChannel *channel, GIOCondition condition, gpointer data)
     case USC_MESSAGE_SET_ACTIVE_SESSION:
         status_notify ("UNITY-SYSTEM-COMPOSITOR SET-ACTIVE-SESSION ID=%s", (gchar *)payload);
         break;
+    case USC_MESSAGE_SET_NEXT_SESSION:
+        status_notify ("UNITY-SYSTEM-COMPOSITOR SET-NEXT-SESSION ID=%s", (gchar *)payload);
+        break;
     default:
         g_printerr ("Ignoring message %d with %d octets\n", id, payload_length);
         break;
diff --git a/tests/test-unity-compositor-next-session b/tests/test-unity-compositor-next-session
new file mode 100755 (executable)
index 0000000..730c9ae
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner unity-compositor-next-session test-gobject-greeter