summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2013-04-03 15:18:10 +1300
committerRobert Ancell <robert.ancell@canonical.com>2013-04-03 15:18:10 +1300
commit863828b75ce03b44c1ac1d304a55b4a116b12f60 (patch)
tree22dfaae9de9df367ab972785ae48ecf3390b4b31
parent2a98522f7168ca1565a134ac34b12272e9c63c07 (diff)
downloadlightdm-git-863828b75ce03b44c1ac1d304a55b4a116b12f60.tar.gz
Add regression tests for cancelling authentication
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/scripts/cancel-authentication.conf40
-rw-r--r--tests/src/test-gobject-greeter.c5
-rwxr-xr-xtests/src/test-python-greeter4
-rw-r--r--tests/src/test-qt-greeter.cpp5
-rwxr-xr-xtests/test-gobject-cancel-authentication2
-rwxr-xr-xtests/test-python-cancel-authentication2
-rwxr-xr-xtests/test-qt-cancel-authentication2
8 files changed, 64 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 68260514..af9a36a0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,6 +21,8 @@ TESTS = \
test-autologin-python-guest-timeout \
test-change-authentication \
test-restart-authentication \
+ test-gobject-cancel-authentication \
+ test-python-cancel-authentication \
test-pam \
test-login-pam \
test-denied \
@@ -140,6 +142,7 @@ if COMPILE_LIBLIGHTDM_QT
TESTS += \
test-autologin-qt-timeout \
test-autologin-qt-guest-timeout \
+ test-qt-cancel-authentication \
test-login-qt \
test-login-qt-manual \
test-login-qt-manual-previous-session \
@@ -189,6 +192,7 @@ EXTRA_DIST = \
scripts/autologin-timeout.conf \
scripts/autologin-xserver-crash.conf \
scripts/change-authentication.conf \
+ scripts/cancel-authentication.conf \
scripts/console-kit.conf \
scripts/crash-authenticate.conf \
scripts/cred-error.conf \
diff --git a/tests/scripts/cancel-authentication.conf b/tests/scripts/cancel-authentication.conf
new file mode 100644
index 00000000..ccd5eb40
--- /dev/null
+++ b/tests/scripts/cancel-authentication.conf
@@ -0,0 +1,40 @@
+#
+# Check can cancel authentication
+#
+
+[LightDM]
+minimum-display-number=50
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER :50 START
+#?XSERVER :50 INDICATE-READY
+
+# LightDM connects to X server
+#?XSERVER :50 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER :50 START
+#?XSERVER :50 ACCEPT-CONNECT
+#?GREETER :50 CONNECT-XSERVER
+#?GREETER :50 CONNECT-TO-DAEMON
+#?GREETER :50 CONNECTED-TO-DAEMON
+
+# Start authentication
+#?*GREETER :50 AUTHENTICATE USERNAME=have-password1
+#?GREETER :50 SHOW-PROMPT TEXT="Password:"
+
+# Cancel authentication
+#?*GREETER :50 CANCEL-AUTHENTICATION
+
+# Start new authentication
+#?*GREETER :50 AUTHENTICATE USERNAME=have-password2
+#?GREETER :50 SHOW-PROMPT TEXT="Password:"
+
+# Cleanup
+#?*STOP-DAEMON
+# Don't know what order they will terminate
+#?(GREETER :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
+#?(GREETER :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/src/test-gobject-greeter.c b/tests/src/test-gobject-greeter.c
index 6597b92e..b80b705a 100644
--- a/tests/src/test-gobject-greeter.c
+++ b/tests/src/test-gobject-greeter.c
@@ -98,6 +98,11 @@ request_cb (const gchar *request)
}
g_free (r);
+ r = g_strdup_printf ("GREETER %s CANCEL-AUTHENTICATION", getenv ("DISPLAY"));
+ if (strcmp (request, r) == 0)
+ lightdm_greeter_cancel_authentication (greeter);
+ g_free (r);
+
r = g_strdup_printf ("GREETER %s START-SESSION", getenv ("DISPLAY"));
if (strcmp (request, r) == 0)
{
diff --git a/tests/src/test-python-greeter b/tests/src/test-python-greeter
index 2ed1b9fa..07ea748b 100755
--- a/tests/src/test-python-greeter
+++ b/tests/src/test-python-greeter
@@ -60,6 +60,10 @@ def request_cb (channel, condition):
if request.startswith (r):
greeter.respond (request[len (r):-1])
+ r = 'GREETER %s CANCEL-AUTHENTICATION' % os.getenv ('DISPLAY')
+ if request == r:
+ greeter.cancel_authentication ():
+
r = 'GREETER %s START-SESSION' % os.getenv ('DISPLAY')
if request == r:
sys.stderr.write ("start-session\n");
diff --git a/tests/src/test-qt-greeter.cpp b/tests/src/test-qt-greeter.cpp
index 68ab1674..65926250 100644
--- a/tests/src/test-qt-greeter.cpp
+++ b/tests/src/test-qt-greeter.cpp
@@ -102,6 +102,11 @@ request_cb (const gchar *request)
}
g_free (r);
+ r = g_strdup_printf ("GREETER %s CANCEL-AUTHENTICATION", getenv ("DISPLAY"));
+ if (strcmp (request, r) == 0)
+ greeter->cancelAuthentication ();
+ g_free (r);
+
r = g_strdup_printf ("GREETER %s START-SESSION", getenv ("DISPLAY"));
if (strcmp (request, r) == 0)
{
diff --git a/tests/test-gobject-cancel-authentication b/tests/test-gobject-cancel-authentication
new file mode 100755
index 00000000..2a8cfb94
--- /dev/null
+++ b/tests/test-gobject-cancel-authentication
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner cancel-authentication test-gobject-greeter
diff --git a/tests/test-python-cancel-authentication b/tests/test-python-cancel-authentication
new file mode 100755
index 00000000..458757b9
--- /dev/null
+++ b/tests/test-python-cancel-authentication
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner cancel-authentication test-python-greeter
diff --git a/tests/test-qt-cancel-authentication b/tests/test-qt-cancel-authentication
new file mode 100755
index 00000000..3c753845
--- /dev/null
+++ b/tests/test-qt-cancel-authentication
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner cancel-authentication test-qt-greeter