summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp')
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp
index 0d0e0765d..ede422556 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestAuthentication.cpp
@@ -20,7 +20,7 @@
#include "config.h"
#include "LoadTrackingTest.h"
#include "WebKitTestServer.h"
-#include <wtf/glib/GRefPtr.h>
+#include <wtf/gobject/GRefPtr.h>
static WebKitTestServer* kServer;
@@ -232,22 +232,6 @@ static void testWebViewAuthenticationSuccess(AuthenticationTest* test, gconstpoi
g_assert_cmpstr(webkit_web_view_get_title(test->m_webView), ==, authExpectedSuccessTitle);
}
-static void testWebViewAuthenticationEmptyRealm(AuthenticationTest* test, gconstpointer)
-{
- test->loadURI(kServer->getURIForPath("/empty-realm.html").data());
- WebKitAuthenticationRequest* request = test->waitForAuthenticationRequest();
- WebKitCredential* credential = webkit_credential_new(authTestUsername, authTestPassword, WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION);
- webkit_authentication_request_authenticate(request, credential);
- webkit_credential_free(credential);
- test->waitUntilLoadFinished();
-
- g_assert_cmpint(test->m_loadEvents.size(), ==, 3);
- g_assert_cmpint(test->m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
- g_assert_cmpint(test->m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
- g_assert_cmpint(test->m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
- g_assert_cmpstr(webkit_web_view_get_title(test->m_webView), ==, authExpectedSuccessTitle);
-}
-
static void serverCallback(SoupServer*, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, void*)
{
if (message->method != SOUP_METHOD_GET) {
@@ -255,7 +239,7 @@ static void serverCallback(SoupServer*, SoupMessage* message, const char* path,
return;
}
- if (!strcmp(path, "/auth-test.html") || !strcmp(path, "/empty-realm.html")) {
+ if (!strcmp(path, "/auth-test.html")) {
const char* authorization = soup_message_headers_get_one(message->request_headers, "Authorization");
// Require authentication.
if (!g_strcmp0(authorization, authExpectedAuthorization)) {
@@ -266,10 +250,7 @@ static void serverCallback(SoupServer*, SoupMessage* message, const char* path,
} else if (++AuthenticationTest::authenticationRetries < 3) {
// No or invalid authorization header provided by the client, request authentication twice then fail.
soup_message_set_status(message, SOUP_STATUS_UNAUTHORIZED);
- if (!strcmp(path, "/empty-realm.html"))
- soup_message_headers_append(message->response_headers, "WWW-Authenticate", "Basic");
- else
- soup_message_headers_append(message->response_headers, "WWW-Authenticate", "Basic realm=\"my realm\"");
+ soup_message_headers_append(message->response_headers, "WWW-Authenticate", "Basic realm=\"my realm\"");
// Include a failure message in case the user attempts to proceed without authentication.
soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, authFailureHTMLString, strlen(authFailureHTMLString));
} else {
@@ -291,11 +272,12 @@ void beforeAll()
AuthenticationTest::add("WebKitWebView", "authentication-request", testWebViewAuthenticationRequest);
AuthenticationTest::add("WebKitWebView", "authentication-cancel", testWebViewAuthenticationCancel);
AuthenticationTest::add("WebKitWebView", "authentication-load-cancelled", testWebViewAuthenticationLoadCancelled);
- AuthenticationTest::add("WebKitWebView", "authentication-success", testWebViewAuthenticationSuccess);
AuthenticationTest::add("WebKitWebView", "authentication-failure", testWebViewAuthenticationFailure);
AuthenticationTest::add("WebKitWebView", "authentication-no-credential", testWebViewAuthenticationNoCredential);
AuthenticationTest::add("WebKitWebView", "authentication-storage", testWebViewAuthenticationStorage);
- AuthenticationTest::add("WebKitWebView", "authentication-empty-realm", testWebViewAuthenticationEmptyRealm);
+ // Testing authentication success must be done last because libsoup will never fire
+ // the authenticate signal again once authentication is successful.
+ AuthenticationTest::add("WebKitWebView", "authentication-success", testWebViewAuthenticationSuccess);
}
void afterAll()