<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161138] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161138">161138</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-30 01:58:14 -0800 (Mon, 30 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Split WebKit2APITests/TestWebKitWebView
https://bugs.webkit.org/show_bug.cgi?id=126284

Reviewed by Philippe Normand.

Source/WebKit2:

WebKitWebView test is too big already making more difficult to
handle timeouts and skipped tests. Split it in 3 by moving
UIClient and auth tests to their own files.

* UIProcess/API/gtk/tests/GNUmakefile.am:
* UIProcess/API/gtk/tests/TestAuthentication.cpp: Added.
(testWebViewAuthenticationRequest):
(testWebViewAuthenticationCancel):
(testWebViewAuthenticationLoadCancelled):
(testWebViewAuthenticationFailure):
(testWebViewAuthenticationNoCredential):
(testWebViewAuthenticationStorage):
(testWebViewAuthenticationSuccess):
(serverCallback):
(beforeAll):
(afterAll):
* UIProcess/API/gtk/tests/TestUIClient.cpp: Added.
(testWebViewCreateReadyClose):
(checkMimeTypeForFilter):
(testWebViewAllowModalDialogs):
(testWebViewDisallowModalDialogs):
(testWebViewJavaScriptDialogs):
(testWebViewWindowProperties):
(testWebViewMouseTarget):
(testWebViewPermissionRequests):
(testWebViewFileChooserRequest):
(beforeAll):
(afterAll):
* UIProcess/API/gtk/tests/TestWebKitWebView.cpp:
(beforeAll):
(afterAll):

Tools:

Skip only WebKitWebView/mouse-target and all TestAuthentication
tests that are timing out when running under xvfb.

* Scripts/run-gtk-tests:
(TestRunner):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtktestsGNUmakefileam">trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtktestsTestWebKitWebViewcpp">trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsrungtktests">trunk/Tools/Scripts/run-gtk-tests</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtktestsTestAuthenticationcpp">trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestAuthentication.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtktestsTestUIClientcpp">trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestUIClient.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161137 => 161138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-12-30 06:31:41 UTC (rev 161137)
+++ trunk/Source/WebKit2/ChangeLog        2013-12-30 09:58:14 UTC (rev 161138)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2013-12-30  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Split WebKit2APITests/TestWebKitWebView
+        https://bugs.webkit.org/show_bug.cgi?id=126284
+
+        Reviewed by Philippe Normand.
+
+        WebKitWebView test is too big already making more difficult to
+        handle timeouts and skipped tests. Split it in 3 by moving
+        UIClient and auth tests to their own files.
+
+        * UIProcess/API/gtk/tests/GNUmakefile.am:
+        * UIProcess/API/gtk/tests/TestAuthentication.cpp: Added.
+        (testWebViewAuthenticationRequest):
+        (testWebViewAuthenticationCancel):
+        (testWebViewAuthenticationLoadCancelled):
+        (testWebViewAuthenticationFailure):
+        (testWebViewAuthenticationNoCredential):
+        (testWebViewAuthenticationStorage):
+        (testWebViewAuthenticationSuccess):
+        (serverCallback):
+        (beforeAll):
+        (afterAll):
+        * UIProcess/API/gtk/tests/TestUIClient.cpp: Added.
+        (testWebViewCreateReadyClose):
+        (checkMimeTypeForFilter):
+        (testWebViewAllowModalDialogs):
+        (testWebViewDisallowModalDialogs):
+        (testWebViewJavaScriptDialogs):
+        (testWebViewWindowProperties):
+        (testWebViewMouseTarget):
+        (testWebViewPermissionRequests):
+        (testWebViewFileChooserRequest):
+        (beforeAll):
+        (afterAll):
+        * UIProcess/API/gtk/tests/TestWebKitWebView.cpp:
+        (beforeAll):
+        (afterAll):
+
</ins><span class="cx"> 2013-12-29  Martin Robinson  &lt;mrobinson@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] [CMake] Convenience libraries that export API should be compiled with --whole-archive on Unix
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtktestsGNUmakefileam"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am (161137 => 161138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am        2013-12-30 06:31:41 UTC (rev 161137)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am        2013-12-30 09:58:14 UTC (rev 161138)
</span><span class="lines">@@ -2,6 +2,7 @@
</span><span class="cx"> 
</span><span class="cx"> TEST_PROGS += \
</span><span class="cx">         Programs/WebKit2APITests/InspectorTestServer \
</span><ins>+        Programs/WebKit2APITests/TestAuthentication \
</ins><span class="cx">         Programs/WebKit2APITests/TestBackForwardList \
</span><span class="cx">         Programs/WebKit2APITests/TestContextMenu \
</span><span class="cx">         Programs/WebKit2APITests/TestCookieManager \
</span><span class="lines">@@ -14,6 +15,7 @@
</span><span class="cx">         Programs/WebKit2APITests/TestPrinting \
</span><span class="cx">         Programs/WebKit2APITests/TestResources \
</span><span class="cx">         Programs/WebKit2APITests/TestSSL \
</span><ins>+        Programs/WebKit2APITests/TestUIClient \
</ins><span class="cx">         Programs/WebKit2APITests/TestWebExtensions \
</span><span class="cx">         Programs/WebKit2APITests/TestWebKitVersion \
</span><span class="cx">         Programs/WebKit2APITests/TestWebKitFaviconDatabase \
</span><span class="lines">@@ -310,4 +312,16 @@
</span><span class="cx"> Programs_WebKit2APITests_TestFrame_LDADD = $(webkit2_tests_ldadd)
</span><span class="cx"> Programs_WebKit2APITests_TestFrame_LDFLAGS = $(webkit2_tests_ldflags)
</span><span class="cx"> 
</span><ins>+Programs_WebKit2APITests_TestAuthentication_SOURCES = \
+        Source/WebKit2/UIProcess/API/gtk/tests/TestAuthentication.cpp
+Programs_WebKit2APITests_TestAuthentication_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_TestAuthentication_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_TestAuthentication_LDFLAGS = $(webkit2_tests_ldflags)
+
+Programs_WebKit2APITests_TestUIClient_SOURCES = \
+        Source/WebKit2/UIProcess/API/gtk/tests/TestUIClient.cpp
+Programs_WebKit2APITests_TestUIClient_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_TestUIClient_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_TestUIClient_LDFLAGS = $(webkit2_tests_ldflags)
+
</ins><span class="cx"> endif # ENABLE_WEBKIT2
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtktestsTestAuthenticationcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestAuthentication.cpp (0 => 161138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestAuthentication.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestAuthentication.cpp        2013-12-30 09:58:14 UTC (rev 161138)
</span><span class="lines">@@ -0,0 +1,286 @@
</span><ins>+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;LoadTrackingTest.h&quot;
+#include &quot;WebKitTestServer.h&quot;
+#include &lt;wtf/gobject/GRefPtr.h&gt;
+
+static WebKitTestServer* kServer;
+
+class AuthenticationTest: public LoadTrackingTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(AuthenticationTest);
+
+    AuthenticationTest()
+    {
+        g_signal_connect(m_webView, &quot;authenticate&quot;, G_CALLBACK(runAuthenticationCallback), this);
+    }
+
+    ~AuthenticationTest()
+    {
+        g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+    }
+
+    static int authenticationRetries;
+    static bool authenticationCancelledReceived;
+
+    void loadURI(const char* uri)
+    {
+        // Reset the retry count of the fake server when a page is loaded.
+        authenticationRetries = 0;
+        authenticationCancelledReceived = false;
+        LoadTrackingTest::loadURI(uri);
+    }
+
+    static gboolean runAuthenticationCallback(WebKitWebView*, WebKitAuthenticationRequest* request, AuthenticationTest* test)
+    {
+        g_signal_connect(request, &quot;cancelled&quot;, G_CALLBACK(authenticationCancelledCallback), test);
+        test-&gt;runAuthentication(request);
+        return TRUE;
+    }
+
+    static void authenticationCancelledCallback(WebKitAuthenticationRequest*, AuthenticationTest*)
+    {
+        authenticationCancelledReceived = true;
+    }
+
+    void runAuthentication(WebKitAuthenticationRequest* request)
+    {
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request));
+        m_authenticationRequest = request;
+        g_main_loop_quit(m_mainLoop);
+    }
+
+    WebKitAuthenticationRequest* waitForAuthenticationRequest()
+    {
+        g_main_loop_run(m_mainLoop);
+        return m_authenticationRequest.get();
+    }
+
+private:
+    GRefPtr&lt;WebKitAuthenticationRequest&gt; m_authenticationRequest;
+};
+
+int AuthenticationTest::authenticationRetries = 0;
+bool AuthenticationTest::authenticationCancelledReceived = false;
+
+static const char authTestUsername[] = &quot;username&quot;;
+static const char authTestPassword[] = &quot;password&quot;;
+static const char authExpectedSuccessTitle[] = &quot;WebKit2Gtk+ Authentication test&quot;;
+static const char authExpectedFailureTitle[] = &quot;401 Authorization Required&quot;;
+static const char authExpectedAuthorization[] = &quot;Basic dXNlcm5hbWU6cGFzc3dvcmQ=&quot;; // Base64 encoding of &quot;username:password&quot;.
+static const char authSuccessHTMLString[] =
+    &quot;&lt;html&gt;&quot;
+    &quot;&lt;head&gt;&lt;title&gt;WebKit2Gtk+ Authentication test&lt;/title&gt;&lt;/head&gt;&quot;
+    &quot;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
+static const char authFailureHTMLString[] =
+    &quot;&lt;html&gt;&quot;
+    &quot;&lt;head&gt;&lt;title&gt;401 Authorization Required&lt;/title&gt;&lt;/head&gt;&quot;
+    &quot;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
+
+static void testWebViewAuthenticationRequest(AuthenticationTest* test, gconstpointer)
+{
+    // Test authentication request getters match soup authentication header.
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
+    g_assert_cmpstr(webkit_authentication_request_get_host(request), ==, soup_uri_get_host(kServer-&gt;baseURI()));
+    g_assert_cmpuint(webkit_authentication_request_get_port(request), ==, soup_uri_get_port(kServer-&gt;baseURI()));
+    g_assert_cmpstr(webkit_authentication_request_get_realm(request), ==, &quot;my realm&quot;);
+    g_assert(webkit_authentication_request_get_scheme(request) == WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC);
+    g_assert(!webkit_authentication_request_is_for_proxy(request));
+    g_assert(!webkit_authentication_request_is_retry(request));
+}
+
+static void testWebViewAuthenticationCancel(AuthenticationTest* test, gconstpointer)
+{
+    // Test cancel.
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
+    webkit_authentication_request_cancel(request);
+    // Server doesn't ask for new credentials.
+    test-&gt;waitUntilLoadFinished();
+
+    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
+    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::ProvisionalLoadFailed);
+    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+
+    g_assert_error(test-&gt;m_error.get(), WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED);
+}
+
+static void testWebViewAuthenticationLoadCancelled(AuthenticationTest* test, gconstpointer)
+{
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    test-&gt;waitForAuthenticationRequest();
+    webkit_web_view_stop_loading(test-&gt;m_webView);
+    // Expect empty page.
+    test-&gt;waitUntilLoadFinished();
+    g_assert(test-&gt;authenticationCancelledReceived);
+
+    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
+    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::ProvisionalLoadFailed);
+    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+
+    g_assert_error(test-&gt;m_error.get(), WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED);
+}
+
+static void testWebViewAuthenticationFailure(AuthenticationTest* test, gconstpointer)
+{
+    // Test authentication failures.
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
+    g_assert(!webkit_authentication_request_is_retry(request));
+    WebKitCredential* credential = webkit_credential_new(authTestUsername, &quot;wrongpassword&quot;, WEBKIT_CREDENTIAL_PERSISTENCE_NONE);
+    webkit_authentication_request_authenticate(request, credential);
+    webkit_credential_free(credential);
+    // Expect a second authentication request.
+    request = test-&gt;waitForAuthenticationRequest();
+    g_assert(webkit_authentication_request_is_retry(request));
+    // Test second failure.
+    credential = webkit_credential_new(authTestUsername, &quot;wrongpassword2&quot;, WEBKIT_CREDENTIAL_PERSISTENCE_NONE);
+    webkit_authentication_request_authenticate(request, credential);
+    webkit_credential_free(credential);
+    // Expect authentication failed page.
+    test-&gt;waitUntilLoadFinished();
+
+    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
+    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
+    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedFailureTitle);
+}
+
+static void testWebViewAuthenticationNoCredential(AuthenticationTest* test, gconstpointer)
+{
+    // Test continue without credentials.
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
+    webkit_authentication_request_authenticate(request, 0);
+    // Server doesn't ask for new credentials.
+    test-&gt;waitUntilLoadFinished();
+
+    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
+    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
+    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedFailureTitle);
+}
+
+static void testWebViewAuthenticationStorage(AuthenticationTest* test, gconstpointer)
+{
+    // Enable private browsing before authentication request to test that credentials can't be saved.
+    webkit_settings_set_enable_private_browsing(webkit_web_view_get_settings(test-&gt;m_webView), TRUE);
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
+    g_assert(!webkit_authentication_request_get_proposed_credential(request));
+    g_assert(!webkit_authentication_request_can_save_credentials(request));
+
+    // If WebKit has been compiled with libsecret, and private browsing is disabled
+    // then check that credentials can be saved.
+#if ENABLE(CREDENTIAL_STORAGE)
+    webkit_settings_set_enable_private_browsing(webkit_web_view_get_settings(test-&gt;m_webView), FALSE);
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    request = test-&gt;waitForAuthenticationRequest();
+    g_assert(!webkit_authentication_request_get_proposed_credential(request));
+    g_assert(webkit_authentication_request_can_save_credentials(request));
+#endif
+}
+
+static void testWebViewAuthenticationSuccess(AuthenticationTest* test, gconstpointer)
+{
+    // Test correct authentication.
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
+    WebKitCredential* credential = webkit_credential_new(authTestUsername, authTestPassword, WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION);
+    webkit_authentication_request_authenticate(request, credential);
+    webkit_credential_free(credential);
+    test-&gt;waitUntilLoadFinished();
+
+    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
+    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
+    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedSuccessTitle);
+
+    // Test loading the same (authorized) page again.
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
+    // There is no authentication challenge.
+    test-&gt;waitUntilLoadFinished();
+
+    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
+    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
+    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedSuccessTitle);
+}
+
+static void serverCallback(SoupServer*, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, void*)
+{
+    if (message-&gt;method != SOUP_METHOD_GET) {
+        soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
+        return;
+    }
+
+    if (!strcmp(path, &quot;/auth-test.html&quot;)) {
+        const char* authorization = soup_message_headers_get_one(message-&gt;request_headers, &quot;Authorization&quot;);
+        // Require authentication.
+        if (!g_strcmp0(authorization, authExpectedAuthorization)) {
+            // Successful authentication.
+            soup_message_set_status(message, SOUP_STATUS_OK);
+            soup_message_body_append(message-&gt;response_body, SOUP_MEMORY_STATIC, authSuccessHTMLString, strlen(authSuccessHTMLString));
+            AuthenticationTest::authenticationRetries = 0;
+        } else if (++AuthenticationTest::authenticationRetries &lt; 3) {
+            // No or invalid authorization header provided by the client, request authentication twice then fail.
+            soup_message_set_status(message, SOUP_STATUS_UNAUTHORIZED);
+            soup_message_headers_append(message-&gt;response_headers, &quot;WWW-Authenticate&quot;, &quot;Basic realm=\&quot;my realm\&quot;&quot;);
+            // Include a failure message in case the user attempts to proceed without authentication.
+            soup_message_body_append(message-&gt;response_body, SOUP_MEMORY_STATIC, authFailureHTMLString, strlen(authFailureHTMLString));
+        } else {
+            // Authentication not successful, display a &quot;401 Authorization Required&quot; page.
+            soup_message_set_status(message, SOUP_STATUS_OK);
+            soup_message_body_append(message-&gt;response_body, SOUP_MEMORY_STATIC, authFailureHTMLString, strlen(authFailureHTMLString));
+        }
+    } else
+        soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
+
+    soup_message_body_complete(message-&gt;response_body);
+}
+
+void beforeAll()
+{
+    kServer = new WebKitTestServer();
+    kServer-&gt;run(serverCallback);
+
+    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-request&quot;, testWebViewAuthenticationRequest);
+    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-cancel&quot;, testWebViewAuthenticationCancel);
+    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-load-cancelled&quot;, testWebViewAuthenticationLoadCancelled);
+    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-failure&quot;, testWebViewAuthenticationFailure);
+    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-no-credential&quot;, testWebViewAuthenticationNoCredential);
+    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-storage&quot;, testWebViewAuthenticationStorage);
+    // Testing authentication success must be done last because libsoup will never fire
+    // the authenticate signal again once authentication is successful.
+    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-success&quot;, testWebViewAuthenticationSuccess);
+}
+
+void afterAll()
+{
+    delete kServer;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtktestsTestUIClientcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestUIClient.cpp (0 => 161138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestUIClient.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestUIClient.cpp        2013-12-30 09:58:14 UTC (rev 161138)
</span><span class="lines">@@ -0,0 +1,679 @@
</span><ins>+/*
+ * Copyright (C) 2011 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2,1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;WebViewTest.h&quot;
+#include &lt;wtf/HashSet.h&gt;
+#include &lt;wtf/gobject/GRefPtr.h&gt;
+#include &lt;wtf/text/StringHash.h&gt;
+
+static const char* kAlertDialogMessage = &quot;WebKitGTK+ alert dialog message&quot;;
+static const char* kConfirmDialogMessage = &quot;WebKitGTK+ confirm dialog message&quot;;
+static const char* kPromptDialogMessage = &quot;WebKitGTK+ prompt dialog message&quot;;
+static const char* kPromptDialogReturnedText = &quot;WebKitGTK+ prompt dialog returned text&quot;;
+
+class UIClientTest: public WebViewTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(UIClientTest);
+
+    enum WebViewEvents {
+        Create,
+        ReadyToShow,
+        RunAsModal,
+        Close
+    };
+
+    class WindowProperties {
+    public:
+        WindowProperties()
+            : m_isNull(true)
+            , m_toolbarVisible(true)
+            , m_statusbarVisible(true)
+            , m_scrollbarsVisible(true)
+            , m_menubarVisible(true)
+            , m_locationbarVisible(true)
+            , m_resizable(true)
+            , m_fullscreen(false)
+        {
+            memset(&amp;m_geometry, 0, sizeof(GdkRectangle));
+        }
+
+        WindowProperties(WebKitWindowProperties* windowProperties)
+            : m_isNull(false)
+            , m_toolbarVisible(webkit_window_properties_get_toolbar_visible(windowProperties))
+            , m_statusbarVisible(webkit_window_properties_get_statusbar_visible(windowProperties))
+            , m_scrollbarsVisible(webkit_window_properties_get_scrollbars_visible(windowProperties))
+            , m_menubarVisible(webkit_window_properties_get_menubar_visible(windowProperties))
+            , m_locationbarVisible(webkit_window_properties_get_locationbar_visible(windowProperties))
+            , m_resizable(webkit_window_properties_get_resizable(windowProperties))
+            , m_fullscreen(webkit_window_properties_get_fullscreen(windowProperties))
+        {
+            webkit_window_properties_get_geometry(windowProperties, &amp;m_geometry);
+        }
+
+        WindowProperties(GdkRectangle* geometry, bool toolbarVisible, bool statusbarVisible, bool scrollbarsVisible, bool menubarVisible, bool locationbarVisible, bool resizable, bool fullscreen)
+            : m_isNull(false)
+            , m_geometry(*geometry)
+            , m_toolbarVisible(toolbarVisible)
+            , m_statusbarVisible(statusbarVisible)
+            , m_scrollbarsVisible(scrollbarsVisible)
+            , m_menubarVisible(menubarVisible)
+            , m_locationbarVisible(locationbarVisible)
+            , m_resizable(resizable)
+            , m_fullscreen(fullscreen)
+        {
+        }
+
+        bool isNull() const { return m_isNull; }
+
+        void assertEqual(const WindowProperties&amp; other) const
+        {
+            g_assert_cmpint(m_geometry.x, ==, other.m_geometry.x);
+            g_assert_cmpint(m_geometry.y, ==, other.m_geometry.y);
+            g_assert_cmpint(m_geometry.width, ==, other.m_geometry.width);
+            g_assert_cmpint(m_geometry.height, ==, other.m_geometry.height);
+            g_assert_cmpint(static_cast&lt;int&gt;(m_toolbarVisible), ==, static_cast&lt;int&gt;(other.m_toolbarVisible));
+            g_assert_cmpint(static_cast&lt;int&gt;(m_statusbarVisible), ==, static_cast&lt;int&gt;(other.m_statusbarVisible));
+            g_assert_cmpint(static_cast&lt;int&gt;(m_scrollbarsVisible), ==, static_cast&lt;int&gt;(other.m_scrollbarsVisible));
+            g_assert_cmpint(static_cast&lt;int&gt;(m_menubarVisible), ==, static_cast&lt;int&gt;(other.m_menubarVisible));
+            g_assert_cmpint(static_cast&lt;int&gt;(m_locationbarVisible), ==, static_cast&lt;int&gt;(other.m_locationbarVisible));
+            g_assert_cmpint(static_cast&lt;int&gt;(m_resizable), ==, static_cast&lt;int&gt;(other.m_resizable));
+            g_assert_cmpint(static_cast&lt;int&gt;(m_fullscreen), ==, static_cast&lt;int&gt;(other.m_fullscreen));
+        }
+
+    private:
+        bool m_isNull;
+
+        GdkRectangle m_geometry;
+
+        bool m_toolbarVisible;
+        bool m_statusbarVisible;
+        bool m_scrollbarsVisible;
+        bool m_menubarVisible;
+        bool m_locationbarVisible;
+
+        bool m_resizable;
+        bool m_fullscreen;
+    };
+
+    static void windowPropertiesNotifyCallback(GObject*, GParamSpec* paramSpec, UIClientTest* test)
+    {
+        test-&gt;m_windowPropertiesChanged.add(g_param_spec_get_name(paramSpec));
+    }
+
+    static GtkWidget* viewCreateCallback(WebKitWebView* webView, UIClientTest* test)
+    {
+        return test-&gt;viewCreate(webView);
+    }
+
+    static void viewReadyToShowCallback(WebKitWebView* webView, UIClientTest* test)
+    {
+        test-&gt;viewReadyToShow(webView);
+    }
+
+    static void viewCloseCallback(WebKitWebView* webView, UIClientTest* test)
+    {
+        test-&gt;viewClose(webView);
+    }
+
+    void scriptAlert(WebKitScriptDialog* dialog)
+    {
+        switch (m_scriptDialogType) {
+        case WEBKIT_SCRIPT_DIALOG_ALERT:
+            g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kAlertDialogMessage);
+            break;
+        case WEBKIT_SCRIPT_DIALOG_CONFIRM:
+            g_assert(m_scriptDialogConfirmed);
+            g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, &quot;confirmed&quot;);
+
+            break;
+        case WEBKIT_SCRIPT_DIALOG_PROMPT:
+            g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kPromptDialogReturnedText);
+            break;
+        }
+
+        g_main_loop_quit(m_mainLoop);
+    }
+
+    void scriptConfirm(WebKitScriptDialog* dialog)
+    {
+        g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kConfirmDialogMessage);
+        m_scriptDialogConfirmed = !m_scriptDialogConfirmed;
+        webkit_script_dialog_confirm_set_confirmed(dialog, m_scriptDialogConfirmed);
+    }
+
+    void scriptPrompt(WebKitScriptDialog* dialog)
+    {
+        g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kPromptDialogMessage);
+        g_assert_cmpstr(webkit_script_dialog_prompt_get_default_text(dialog), ==, &quot;default&quot;);
+        webkit_script_dialog_prompt_set_text(dialog, kPromptDialogReturnedText);
+    }
+
+    static gboolean scriptDialog(WebKitWebView*, WebKitScriptDialog* dialog, UIClientTest* test)
+    {
+        switch (webkit_script_dialog_get_dialog_type(dialog)) {
+        case WEBKIT_SCRIPT_DIALOG_ALERT:
+            test-&gt;scriptAlert(dialog);
+            break;
+        case WEBKIT_SCRIPT_DIALOG_CONFIRM:
+            test-&gt;scriptConfirm(dialog);
+            break;
+        case WEBKIT_SCRIPT_DIALOG_PROMPT:
+            test-&gt;scriptPrompt(dialog);
+            break;
+        }
+
+        return TRUE;
+    }
+
+    static void mouseTargetChanged(WebKitWebView*, WebKitHitTestResult* hitTestResult, guint modifiers, UIClientTest* test)
+    {
+        g_assert(WEBKIT_IS_HIT_TEST_RESULT(hitTestResult));
+        test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(hitTestResult));
+
+        test-&gt;m_mouseTargetHitTestResult = hitTestResult;
+        test-&gt;m_mouseTargetModifiers = modifiers;
+        g_main_loop_quit(test-&gt;m_mainLoop);
+    }
+
+    static gboolean permissionRequested(WebKitWebView*, WebKitPermissionRequest* request, UIClientTest* test)
+    {
+        g_assert(WEBKIT_IS_PERMISSION_REQUEST(request));
+        test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request));
+
+        if (test-&gt;m_allowPermissionRequests)
+            webkit_permission_request_allow(request);
+        else
+            webkit_permission_request_deny(request);
+
+        return TRUE;
+    }
+
+    UIClientTest()
+        : m_scriptDialogType(WEBKIT_SCRIPT_DIALOG_ALERT)
+        , m_scriptDialogConfirmed(true)
+        , m_allowPermissionRequests(false)
+        , m_mouseTargetModifiers(0)
+    {
+        webkit_settings_set_javascript_can_open_windows_automatically(webkit_web_view_get_settings(m_webView), TRUE);
+        g_signal_connect(m_webView, &quot;create&quot;, G_CALLBACK(viewCreateCallback), this);
+        g_signal_connect(m_webView, &quot;script-dialog&quot;, G_CALLBACK(scriptDialog), this);
+        g_signal_connect(m_webView, &quot;mouse-target-changed&quot;, G_CALLBACK(mouseTargetChanged), this);
+        g_signal_connect(m_webView, &quot;permission-request&quot;, G_CALLBACK(permissionRequested), this);
+    }
+
+    ~UIClientTest()
+    {
+        g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
+    }
+
+    void waitUntilMainLoopFinishes()
+    {
+        g_main_loop_run(m_mainLoop);
+    }
+
+    void setExpectedWindowProperties(const WindowProperties&amp; windowProperties)
+    {
+        m_windowProperties = windowProperties;
+    }
+
+    WebKitHitTestResult* moveMouseAndWaitUntilMouseTargetChanged(int x, int y, unsigned mouseModifiers = 0)
+    {
+        mouseMoveTo(x, y, mouseModifiers);
+        g_main_loop_run(m_mainLoop);
+        return m_mouseTargetHitTestResult.get();
+    }
+
+    virtual GtkWidget* viewCreate(WebKitWebView* webView)
+    {
+        g_assert(webView == m_webView);
+
+        GtkWidget* newWebView = webkit_web_view_new_with_context(webkit_web_view_get_context(webView));
+        g_object_ref_sink(newWebView);
+
+        m_webViewEvents.append(Create);
+
+        WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(newWebView));
+        g_assert(windowProperties);
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(windowProperties));
+        m_windowPropertiesChanged.clear();
+
+        g_signal_connect(windowProperties, &quot;notify&quot;, G_CALLBACK(windowPropertiesNotifyCallback), this);
+        g_signal_connect(newWebView, &quot;ready-to-show&quot;, G_CALLBACK(viewReadyToShowCallback), this);
+        g_signal_connect(newWebView, &quot;close&quot;, G_CALLBACK(viewCloseCallback), this);
+
+        return newWebView;
+    }
+
+    virtual void viewReadyToShow(WebKitWebView* webView)
+    {
+        g_assert(webView != m_webView);
+
+        WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(webView);
+        g_assert(windowProperties);
+        if (!m_windowProperties.isNull())
+            WindowProperties(windowProperties).assertEqual(m_windowProperties);
+
+        m_webViewEvents.append(ReadyToShow);
+    }
+
+    virtual void viewClose(WebKitWebView* webView)
+    {
+        g_assert(webView != m_webView);
+
+        m_webViewEvents.append(Close);
+        g_object_unref(webView);
+
+        g_main_loop_quit(m_mainLoop);
+    }
+
+    Vector&lt;WebViewEvents&gt; m_webViewEvents;
+    WebKitScriptDialogType m_scriptDialogType;
+    bool m_scriptDialogConfirmed;
+    bool m_allowPermissionRequests;
+    WindowProperties m_windowProperties;
+    HashSet&lt;WTF::String&gt; m_windowPropertiesChanged;
+    GRefPtr&lt;WebKitHitTestResult&gt; m_mouseTargetHitTestResult;
+    unsigned m_mouseTargetModifiers;
+};
+
+static void testWebViewCreateReadyClose(UIClientTest* test, gconstpointer)
+{
+    test-&gt;loadHtml(&quot;&lt;html&gt;&lt;body onLoad=\&quot;window.open().close();\&quot;&gt;&lt;/html&gt;&quot;, 0);
+    test-&gt;waitUntilMainLoopFinishes();
+
+    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
+    g_assert_cmpint(events.size(), ==, 3);
+    g_assert_cmpint(events[0], ==, UIClientTest::Create);
+    g_assert_cmpint(events[1], ==, UIClientTest::ReadyToShow);
+    g_assert_cmpint(events[2], ==, UIClientTest::Close);
+}
+
+static gboolean checkMimeTypeForFilter(GtkFileFilter* filter, const gchar* mimeType)
+{
+    GtkFileFilterInfo filterInfo;
+    filterInfo.contains = GTK_FILE_FILTER_MIME_TYPE;
+    filterInfo.mime_type = mimeType;
+    return gtk_file_filter_filter(filter, &amp;filterInfo);
+}
+
+class ModalDialogsTest: public UIClientTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(ModalDialogsTest);
+
+    static void dialogRunAsModalCallback(WebKitWebView* webView, ModalDialogsTest* test)
+    {
+        g_assert(webView != test-&gt;m_webView);
+        test-&gt;m_webViewEvents.append(RunAsModal);
+    }
+
+    GtkWidget* viewCreate(WebKitWebView* webView)
+    {
+        g_assert(webView == m_webView);
+
+        GtkWidget* newWebView = UIClientTest::viewCreate(webView);
+        g_signal_connect(newWebView, &quot;run-as-modal&quot;, G_CALLBACK(dialogRunAsModalCallback), this);
+        return newWebView;
+    }
+
+    void viewReadyToShow(WebKitWebView* webView)
+    {
+        g_assert(webView != m_webView);
+        m_webViewEvents.append(ReadyToShow);
+    }
+};
+
+static void testWebViewAllowModalDialogs(ModalDialogsTest* test, gconstpointer)
+{
+    WebKitSettings* settings = webkit_web_view_get_settings(test-&gt;m_webView);
+    webkit_settings_set_allow_modal_dialogs(settings, TRUE);
+
+    test-&gt;loadHtml(&quot;&lt;html&gt;&lt;body onload=\&quot;window.showModalDialog('data:text/html,&lt;html&gt;&lt;body/&gt;&lt;script&gt;window.close();&lt;/script&gt;&lt;/html&gt;')\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;, 0);
+    test-&gt;waitUntilMainLoopFinishes();
+
+    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
+    g_assert_cmpint(events.size(), ==, 4);
+    g_assert_cmpint(events[0], ==, UIClientTest::Create);
+    g_assert_cmpint(events[1], ==, UIClientTest::ReadyToShow);
+    g_assert_cmpint(events[2], ==, UIClientTest::RunAsModal);
+    g_assert_cmpint(events[3], ==, UIClientTest::Close);
+}
+
+static void testWebViewDisallowModalDialogs(ModalDialogsTest* test, gconstpointer)
+{
+    WebKitSettings* settings = webkit_web_view_get_settings(test-&gt;m_webView);
+    webkit_settings_set_allow_modal_dialogs(settings, FALSE);
+
+    test-&gt;loadHtml(&quot;&lt;html&gt;&lt;body onload=\&quot;window.showModalDialog('data:text/html,&lt;html&gt;&lt;body/&gt;&lt;script&gt;window.close();&lt;/script&gt;&lt;/html&gt;')\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;, 0);
+    // We need to use a timeout here because the viewClose() function
+    // won't ever be called as the dialog won't be created.
+    test-&gt;wait(1);
+
+    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
+    g_assert_cmpint(events.size(), ==, 0);
+}
+
+static void testWebViewJavaScriptDialogs(UIClientTest* test, gconstpointer)
+{
+    static const char* htmlOnLoadFormat = &quot;&lt;html&gt;&lt;body onLoad=\&quot;%s\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
+    static const char* jsAlertFormat = &quot;alert('%s')&quot;;
+    static const char* jsConfirmFormat = &quot;do { confirmed = confirm('%s'); } while (!confirmed); alert('confirmed');&quot;;
+    static const char* jsPromptFormat = &quot;alert(prompt('%s', 'default'));&quot;;
+
+    test-&gt;m_scriptDialogType = WEBKIT_SCRIPT_DIALOG_ALERT;
+    GOwnPtr&lt;char&gt; alertDialogMessage(g_strdup_printf(jsAlertFormat, kAlertDialogMessage));
+    GOwnPtr&lt;char&gt; alertHTML(g_strdup_printf(htmlOnLoadFormat, alertDialogMessage.get()));
+    test-&gt;loadHtml(alertHTML.get(), 0);
+    test-&gt;waitUntilMainLoopFinishes();
+
+    test-&gt;m_scriptDialogType = WEBKIT_SCRIPT_DIALOG_CONFIRM;
+    GOwnPtr&lt;char&gt; confirmDialogMessage(g_strdup_printf(jsConfirmFormat, kConfirmDialogMessage));
+    GOwnPtr&lt;char&gt; confirmHTML(g_strdup_printf(htmlOnLoadFormat, confirmDialogMessage.get()));
+    test-&gt;loadHtml(confirmHTML.get(), 0);
+    test-&gt;waitUntilMainLoopFinishes();
+
+    test-&gt;m_scriptDialogType = WEBKIT_SCRIPT_DIALOG_PROMPT;
+    GOwnPtr&lt;char&gt; promptDialogMessage(g_strdup_printf(jsPromptFormat, kPromptDialogMessage));
+    GOwnPtr&lt;char&gt; promptHTML(g_strdup_printf(htmlOnLoadFormat, promptDialogMessage.get()));
+    test-&gt;loadHtml(promptHTML.get(), 0);
+    test-&gt;waitUntilMainLoopFinishes();
+}
+
+static void testWebViewWindowProperties(UIClientTest* test, gconstpointer)
+{
+    static const char* windowProrpertiesString = &quot;left=100,top=150,width=400,height=400,location=no,menubar=no,status=no,toolbar=no,scrollbars=no&quot;;
+    GdkRectangle geometry = { 100, 150, 400, 400 };
+    test-&gt;setExpectedWindowProperties(UIClientTest::WindowProperties(&amp;geometry, false, false, false, false, false, true, false));
+
+    GOwnPtr&lt;char&gt; htmlString(g_strdup_printf(&quot;&lt;html&gt;&lt;body onLoad=\&quot;window.open('', '', '%s').close();\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;, windowProrpertiesString));
+    test-&gt;loadHtml(htmlString.get(), 0);
+    test-&gt;waitUntilMainLoopFinishes();
+
+    static const char* propertiesChanged[] = {
+        &quot;geometry&quot;, &quot;locationbar-visible&quot;, &quot;menubar-visible&quot;, &quot;statusbar-visible&quot;, &quot;toolbar-visible&quot;, &quot;scrollbars-visible&quot;
+    };
+    for (size_t i = 0; i &lt; G_N_ELEMENTS(propertiesChanged); ++i)
+        g_assert(test-&gt;m_windowPropertiesChanged.contains(propertiesChanged[i]));
+
+    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
+    g_assert_cmpint(events.size(), ==, 3);
+    g_assert_cmpint(events[0], ==, UIClientTest::Create);
+    g_assert_cmpint(events[1], ==, UIClientTest::ReadyToShow);
+    g_assert_cmpint(events[2], ==, UIClientTest::Close);
+}
+
+static void testWebViewMouseTarget(UIClientTest* test, gconstpointer)
+{
+    test-&gt;showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
+
+    const char* linksHoveredHTML =
+        &quot;&lt;html&gt;&lt;body&gt;&quot;
+        &quot; &lt;a style='position:absolute; left:1; top:1' href='http://www.webkitgtk.org' title='WebKitGTK+ Title'&gt;WebKitGTK+ Website&lt;/a&gt;&quot;
+        &quot; &lt;img style='position:absolute; left:1; top:10' src='0xdeadbeef' width=5 height=5&gt;&lt;/img&gt;&quot;
+        &quot; &lt;a style='position:absolute; left:1; top:20' href='http://www.webkitgtk.org/logo' title='WebKitGTK+ Logo'&gt;&lt;img src='0xdeadbeef' width=5 height=5&gt;&lt;/img&gt;&lt;/a&gt;&quot;
+        &quot; &lt;input style='position:absolute; left:1; top:30' size='10'&gt;&lt;/input&gt;&quot;
+        &quot; &lt;div style='position:absolute; left:1; top:50; width:30; height:30; overflow:scroll'&gt;&amp;nbsp;&lt;/div&gt;&quot;
+        &quot; &lt;video style='position:absolute; left:1; top:100' width='300' height='300' controls='controls' preload='none'&gt;&lt;source src='movie.ogg' type='video/ogg' /&gt;&lt;/video&gt;&quot;
+        &quot;&lt;/body&gt;&lt;/html&gt;&quot;;
+
+    test-&gt;loadHtml(linksHoveredHTML, &quot;file:///&quot;);
+    test-&gt;waitUntilLoadFinished();
+
+    // Move over link.
+    WebKitHitTestResult* hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 1);
+    g_assert(webkit_hit_test_result_context_is_link(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, &quot;http://www.webkitgtk.org/&quot;);
+    g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, &quot;WebKitGTK+ Title&quot;);
+    g_assert_cmpstr(webkit_hit_test_result_get_link_label(hitTestResult), ==, &quot;WebKitGTK+ Website&quot;);
+    g_assert(!test-&gt;m_mouseTargetModifiers);
+
+    // Move out of the link.
+    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(0, 0);
+    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert(!test-&gt;m_mouseTargetModifiers);
+
+    // Move over image with GDK_CONTROL_MASK.
+    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 10, GDK_CONTROL_MASK);
+    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
+    g_assert(webkit_hit_test_result_context_is_image(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
+    g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, &quot;file:///0xdeadbeef&quot;);
+    g_assert(test-&gt;m_mouseTargetModifiers &amp; GDK_CONTROL_MASK);
+
+    // Move over image link.
+    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 20);
+    g_assert(webkit_hit_test_result_context_is_link(hitTestResult));
+    g_assert(webkit_hit_test_result_context_is_image(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
+    g_assert_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, &quot;http://www.webkitgtk.org/logo&quot;);
+    g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, &quot;file:///0xdeadbeef&quot;);
+    g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, &quot;WebKitGTK+ Logo&quot;);
+    g_assert(!webkit_hit_test_result_get_link_label(hitTestResult));
+    g_assert(!test-&gt;m_mouseTargetModifiers);
+
+    // Move over media.
+    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 100);
+    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
+    g_assert(webkit_hit_test_result_context_is_media(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
+    g_assert_cmpstr(webkit_hit_test_result_get_media_uri(hitTestResult), ==, &quot;file:///movie.ogg&quot;);
+    g_assert(!test-&gt;m_mouseTargetModifiers);
+
+    // Mover over input.
+    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(5, 35);
+    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
+    g_assert(webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert(!test-&gt;m_mouseTargetModifiers);
+
+    // Move over scrollbar.
+    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(5, 75);
+    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
+    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
+    g_assert(webkit_hit_test_result_context_is_scrollbar(hitTestResult));
+    g_assert(!test-&gt;m_mouseTargetModifiers);
+}
+
+static void testWebViewPermissionRequests(UIClientTest* test, gconstpointer)
+{
+    // Some versions of geoclue give a runtime warning because it tries
+    // to register the error quark twice. See https://bugs.webkit.org/show_bug.cgi?id=89858.
+    // Make warnings non-fatal for this test to make it pass.
+    test-&gt;removeLogFatalFlag(G_LOG_LEVEL_WARNING);
+    test-&gt;showInWindowAndWaitUntilMapped();
+    static const char* geolocationRequestHTML =
+        &quot;&lt;html&gt;&quot;
+        &quot;  &lt;script&gt;&quot;
+        &quot;  function runTest()&quot;
+        &quot;  {&quot;
+        &quot;    navigator.geolocation.getCurrentPosition(function(p) { document.title = \&quot;OK\&quot; },&quot;
+        &quot;                                             function(e) { document.title = e.code });&quot;
+        &quot;  }&quot;
+        &quot;  &lt;/script&gt;&quot;
+        &quot;  &lt;body onload='runTest();'&gt;&lt;/body&gt;&quot;
+        &quot;&lt;/html&gt;&quot;;
+
+    // Test denying a permission request.
+    test-&gt;m_allowPermissionRequests = false;
+    test-&gt;loadHtml(geolocationRequestHTML, 0);
+    test-&gt;waitUntilTitleChanged();
+
+    // According to the Geolocation API specification, '1' is the
+    // error code returned for the PERMISSION_DENIED error.
+    // http://dev.w3.org/geo/api/spec-source.html#position_error_interface
+    const gchar* result = webkit_web_view_get_title(test-&gt;m_webView);
+    g_assert_cmpstr(result, ==, &quot;1&quot;);
+
+    // Test allowing a permission request.
+    test-&gt;m_allowPermissionRequests = true;
+    test-&gt;loadHtml(geolocationRequestHTML, 0);
+    test-&gt;waitUntilTitleChanged();
+
+    // Check that we did not get the PERMISSION_DENIED error now.
+    result = webkit_web_view_get_title(test-&gt;m_webView);
+    g_assert_cmpstr(result, !=, &quot;1&quot;);
+    test-&gt;addLogFatalFlag(G_LOG_LEVEL_WARNING);
+}
+
+class FileChooserTest: public UIClientTest {
+public:
+    MAKE_GLIB_TEST_FIXTURE(FileChooserTest);
+
+    FileChooserTest()
+    {
+        g_signal_connect(m_webView, &quot;run-file-chooser&quot;, G_CALLBACK(runFileChooserCallback), this);
+    }
+
+    static gboolean runFileChooserCallback(WebKitWebView*, WebKitFileChooserRequest* request, FileChooserTest* test)
+    {
+        test-&gt;runFileChooser(request);
+        return TRUE;
+    }
+
+    void runFileChooser(WebKitFileChooserRequest* request)
+    {
+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request));
+        m_fileChooserRequest = request;
+        g_main_loop_quit(m_mainLoop);
+    }
+
+    WebKitFileChooserRequest* clickMouseButtonAndWaitForFileChooserRequest(int x, int y)
+    {
+        clickMouseButton(x, y);
+        g_main_loop_run(m_mainLoop);
+        return m_fileChooserRequest.get();
+    }
+
+private:
+    GRefPtr&lt;WebKitFileChooserRequest&gt; m_fileChooserRequest;
+};
+
+static void testWebViewFileChooserRequest(FileChooserTest* test, gconstpointer)
+{
+    test-&gt;showInWindowAndWaitUntilMapped();
+    static const char* fileChooserHTMLFormat = &quot;&lt;html&gt;&lt;body&gt;&lt;input style='position:absolute;left:0;top:0;margin:0;padding:0' type='file' %s/&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
+
+    // Multiple selections not allowed, no MIME filtering.
+    GOwnPtr&lt;char&gt; simpleFileUploadHTML(g_strdup_printf(fileChooserHTMLFormat, &quot;&quot;));
+    test-&gt;loadHtml(simpleFileUploadHTML.get(), 0);
+    test-&gt;waitUntilLoadFinished();
+    WebKitFileChooserRequest* fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
+    g_assert(!webkit_file_chooser_request_get_select_multiple(fileChooserRequest));
+
+    const gchar* const* mimeTypes = webkit_file_chooser_request_get_mime_types(fileChooserRequest);
+    g_assert(!mimeTypes);
+    GtkFileFilter* filter = webkit_file_chooser_request_get_mime_types_filter(fileChooserRequest);
+    g_assert(!filter);
+    const gchar* const* selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
+    g_assert(!selectedFiles);
+    webkit_file_chooser_request_cancel(fileChooserRequest);
+
+    // Multiple selections allowed, no MIME filtering, some pre-selected files.
+    GOwnPtr&lt;char&gt; multipleSelectionFileUploadHTML(g_strdup_printf(fileChooserHTMLFormat, &quot;multiple&quot;));
+    test-&gt;loadHtml(multipleSelectionFileUploadHTML.get(), 0);
+    test-&gt;waitUntilLoadFinished();
+    fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
+    g_assert(webkit_file_chooser_request_get_select_multiple(fileChooserRequest));
+
+    mimeTypes = webkit_file_chooser_request_get_mime_types(fileChooserRequest);
+    g_assert(!mimeTypes);
+    filter = webkit_file_chooser_request_get_mime_types_filter(fileChooserRequest);
+    g_assert(!filter);
+    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
+    g_assert(!selectedFiles);
+
+    // Select some files.
+    const gchar* filesToSelect[4] = { &quot;/foo&quot;, &quot;/foo/bar&quot;, &quot;/foo/bar/baz&quot;, 0 };
+    webkit_file_chooser_request_select_files(fileChooserRequest, filesToSelect);
+
+    // Check the files that have been just selected.
+    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
+    g_assert(selectedFiles);
+    g_assert_cmpstr(selectedFiles[0], ==, &quot;/foo&quot;);
+    g_assert_cmpstr(selectedFiles[1], ==, &quot;/foo/bar&quot;);
+    g_assert_cmpstr(selectedFiles[2], ==, &quot;/foo/bar/baz&quot;);
+    g_assert(!selectedFiles[3]);
+
+    // Perform another request to check if the list of files selected
+    // in the previous step appears now as part of the new request.
+    fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
+    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
+    g_assert(selectedFiles);
+    g_assert_cmpstr(selectedFiles[0], ==, &quot;/foo&quot;);
+    g_assert_cmpstr(selectedFiles[1], ==, &quot;/foo/bar&quot;);
+    g_assert_cmpstr(selectedFiles[2], ==, &quot;/foo/bar/baz&quot;);
+    g_assert(!selectedFiles[3]);
+    webkit_file_chooser_request_cancel(fileChooserRequest);
+
+    // Multiple selections not allowed, only accept images, audio and video files..
+    GOwnPtr&lt;char&gt; mimeFilteredFileUploadHTML(g_strdup_printf(fileChooserHTMLFormat, &quot;accept='audio/*,video/*,image/*'&quot;));
+    test-&gt;loadHtml(mimeFilteredFileUploadHTML.get(), 0);
+    test-&gt;waitUntilLoadFinished();
+    fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
+    g_assert(!webkit_file_chooser_request_get_select_multiple(fileChooserRequest));
+
+    mimeTypes = webkit_file_chooser_request_get_mime_types(fileChooserRequest);
+    g_assert(mimeTypes);
+    g_assert_cmpstr(mimeTypes[0], ==, &quot;audio/*&quot;);
+    g_assert_cmpstr(mimeTypes[1], ==, &quot;video/*&quot;);
+    g_assert_cmpstr(mimeTypes[2], ==, &quot;image/*&quot;);
+    g_assert(!mimeTypes[3]);
+
+    filter = webkit_file_chooser_request_get_mime_types_filter(fileChooserRequest);
+    g_assert(GTK_IS_FILE_FILTER(filter));
+    g_assert(checkMimeTypeForFilter(filter, &quot;audio/*&quot;));
+    g_assert(checkMimeTypeForFilter(filter, &quot;video/*&quot;));
+    g_assert(checkMimeTypeForFilter(filter, &quot;image/*&quot;));
+
+    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
+    g_assert(!selectedFiles);
+    webkit_file_chooser_request_cancel(fileChooserRequest);
+}
+
+void beforeAll()
+{
+    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;create-ready-close&quot;, testWebViewCreateReadyClose);
+    ModalDialogsTest::add(&quot;WebKitWebView&quot;, &quot;allow-modal-dialogs&quot;, testWebViewAllowModalDialogs);
+    ModalDialogsTest::add(&quot;WebKitWebView&quot;, &quot;disallow-modal-dialogs&quot;, testWebViewDisallowModalDialogs);
+    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;javascript-dialogs&quot;, testWebViewJavaScriptDialogs);
+    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;window-properties&quot;, testWebViewWindowProperties);
+    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;mouse-target&quot;, testWebViewMouseTarget);
+    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;permission-requests&quot;, testWebViewPermissionRequests);
+    FileChooserTest::add(&quot;WebKitWebView&quot;, &quot;file-chooser-request&quot;, testWebViewFileChooserRequest);
+}
+
+void afterAll()
+{
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtktestsTestWebKitWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp (161137 => 161138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp        2013-12-30 06:31:41 UTC (rev 161137)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp        2013-12-30 09:58:14 UTC (rev 161138)
</span><span class="lines">@@ -18,18 +18,12 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><del>-#include &quot;LoadTrackingTest.h&quot;
-#include &quot;WebKitTestServer.h&quot;
</del><span class="cx"> #include &quot;WebViewTest.h&quot;
</span><span class="cx"> #include &lt;JavaScriptCore/JSStringRef.h&gt;
</span><span class="cx"> #include &lt;JavaScriptCore/JSValueRef.h&gt;
</span><span class="cx"> #include &lt;glib/gstdio.h&gt;
</span><del>-#include &lt;wtf/HashSet.h&gt;
</del><span class="cx"> #include &lt;wtf/gobject/GRefPtr.h&gt;
</span><del>-#include &lt;wtf/text/StringHash.h&gt;
</del><span class="cx"> 
</span><del>-static WebKitTestServer* kServer;
-
</del><span class="cx"> static void testWebViewDefaultContext(WebViewTest* test, gconstpointer)
</span><span class="cx"> {
</span><span class="cx">     g_assert(webkit_web_view_get_context(test-&gt;m_webView) == webkit_web_context_get_default());
</span><span class="lines">@@ -75,531 +69,6 @@
</span><span class="cx">     g_assert(webkit_settings_get_enable_javascript(settings));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static const char* kAlertDialogMessage = &quot;WebKitGTK+ alert dialog message&quot;;
-static const char* kConfirmDialogMessage = &quot;WebKitGTK+ confirm dialog message&quot;;
-static const char* kPromptDialogMessage = &quot;WebKitGTK+ prompt dialog message&quot;;
-static const char* kPromptDialogReturnedText = &quot;WebKitGTK+ prompt dialog returned text&quot;;
-
-class UIClientTest: public WebViewTest {
-public:
-    MAKE_GLIB_TEST_FIXTURE(UIClientTest);
-
-    enum WebViewEvents {
-        Create,
-        ReadyToShow,
-        RunAsModal,
-        Close
-    };
-
-    class WindowProperties {
-    public:
-        WindowProperties()
-            : m_isNull(true)
-            , m_toolbarVisible(true)
-            , m_statusbarVisible(true)
-            , m_scrollbarsVisible(true)
-            , m_menubarVisible(true)
-            , m_locationbarVisible(true)
-            , m_resizable(true)
-            , m_fullscreen(false)
-        {
-            memset(&amp;m_geometry, 0, sizeof(GdkRectangle));
-        }
-
-        WindowProperties(WebKitWindowProperties* windowProperties)
-            : m_isNull(false)
-            , m_toolbarVisible(webkit_window_properties_get_toolbar_visible(windowProperties))
-            , m_statusbarVisible(webkit_window_properties_get_statusbar_visible(windowProperties))
-            , m_scrollbarsVisible(webkit_window_properties_get_scrollbars_visible(windowProperties))
-            , m_menubarVisible(webkit_window_properties_get_menubar_visible(windowProperties))
-            , m_locationbarVisible(webkit_window_properties_get_locationbar_visible(windowProperties))
-            , m_resizable(webkit_window_properties_get_resizable(windowProperties))
-            , m_fullscreen(webkit_window_properties_get_fullscreen(windowProperties))
-        {
-            webkit_window_properties_get_geometry(windowProperties, &amp;m_geometry);
-        }
-
-        WindowProperties(GdkRectangle* geometry, bool toolbarVisible, bool statusbarVisible, bool scrollbarsVisible, bool menubarVisible,
-                         bool locationbarVisible, bool resizable, bool fullscreen)
-            : m_isNull(false)
-            , m_geometry(*geometry)
-            , m_toolbarVisible(toolbarVisible)
-            , m_statusbarVisible(statusbarVisible)
-            , m_scrollbarsVisible(scrollbarsVisible)
-            , m_menubarVisible(menubarVisible)
-            , m_locationbarVisible(locationbarVisible)
-            , m_resizable(resizable)
-            , m_fullscreen(fullscreen)
-        {
-        }
-
-        bool isNull() const { return m_isNull; }
-
-        void assertEqual(const WindowProperties&amp; other) const
-        {
-            g_assert_cmpint(m_geometry.x, ==, other.m_geometry.x);
-            g_assert_cmpint(m_geometry.y, ==, other.m_geometry.y);
-            g_assert_cmpint(m_geometry.width, ==, other.m_geometry.width);
-            g_assert_cmpint(m_geometry.height, ==, other.m_geometry.height);
-            g_assert_cmpint(static_cast&lt;int&gt;(m_toolbarVisible), ==, static_cast&lt;int&gt;(other.m_toolbarVisible));
-            g_assert_cmpint(static_cast&lt;int&gt;(m_statusbarVisible), ==, static_cast&lt;int&gt;(other.m_statusbarVisible));
-            g_assert_cmpint(static_cast&lt;int&gt;(m_scrollbarsVisible), ==, static_cast&lt;int&gt;(other.m_scrollbarsVisible));
-            g_assert_cmpint(static_cast&lt;int&gt;(m_menubarVisible), ==, static_cast&lt;int&gt;(other.m_menubarVisible));
-            g_assert_cmpint(static_cast&lt;int&gt;(m_locationbarVisible), ==, static_cast&lt;int&gt;(other.m_locationbarVisible));
-            g_assert_cmpint(static_cast&lt;int&gt;(m_resizable), ==, static_cast&lt;int&gt;(other.m_resizable));
-            g_assert_cmpint(static_cast&lt;int&gt;(m_fullscreen), ==, static_cast&lt;int&gt;(other.m_fullscreen));
-        }
-
-    private:
-        bool m_isNull;
-
-        GdkRectangle m_geometry;
-
-        bool m_toolbarVisible;
-        bool m_statusbarVisible;
-        bool m_scrollbarsVisible;
-        bool m_menubarVisible;
-        bool m_locationbarVisible;
-
-        bool m_resizable;
-        bool m_fullscreen;
-    };
-
-    static void windowPropertiesNotifyCallback(GObject*, GParamSpec* paramSpec, UIClientTest* test)
-    {
-        test-&gt;m_windowPropertiesChanged.add(g_param_spec_get_name(paramSpec));
-    }
-
-    static GtkWidget* viewCreateCallback(WebKitWebView* webView, UIClientTest* test)
-    {
-        return test-&gt;viewCreate(webView);
-    }
-
-    static void viewReadyToShowCallback(WebKitWebView* webView, UIClientTest* test)
-    {
-        test-&gt;viewReadyToShow(webView);
-    }
-
-    static void viewCloseCallback(WebKitWebView* webView, UIClientTest* test)
-    {
-        test-&gt;viewClose(webView);
-    }
-
-    void scriptAlert(WebKitScriptDialog* dialog)
-    {
-        switch (m_scriptDialogType) {
-        case WEBKIT_SCRIPT_DIALOG_ALERT:
-            g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kAlertDialogMessage);
-            break;
-        case WEBKIT_SCRIPT_DIALOG_CONFIRM:
-            g_assert(m_scriptDialogConfirmed);
-            g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, &quot;confirmed&quot;);
-
-            break;
-        case WEBKIT_SCRIPT_DIALOG_PROMPT:
-            g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kPromptDialogReturnedText);
-            break;
-        }
-
-        g_main_loop_quit(m_mainLoop);
-    }
-
-    void scriptConfirm(WebKitScriptDialog* dialog)
-    {
-        g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kConfirmDialogMessage);
-        m_scriptDialogConfirmed = !m_scriptDialogConfirmed;
-        webkit_script_dialog_confirm_set_confirmed(dialog, m_scriptDialogConfirmed);
-    }
-
-    void scriptPrompt(WebKitScriptDialog* dialog)
-    {
-        g_assert_cmpstr(webkit_script_dialog_get_message(dialog), ==, kPromptDialogMessage);
-        g_assert_cmpstr(webkit_script_dialog_prompt_get_default_text(dialog), ==, &quot;default&quot;);
-        webkit_script_dialog_prompt_set_text(dialog, kPromptDialogReturnedText);
-    }
-
-    static gboolean scriptDialog(WebKitWebView*, WebKitScriptDialog* dialog, UIClientTest* test)
-    {
-        switch (webkit_script_dialog_get_dialog_type(dialog)) {
-        case WEBKIT_SCRIPT_DIALOG_ALERT:
-            test-&gt;scriptAlert(dialog);
-            break;
-        case WEBKIT_SCRIPT_DIALOG_CONFIRM:
-            test-&gt;scriptConfirm(dialog);
-            break;
-        case WEBKIT_SCRIPT_DIALOG_PROMPT:
-            test-&gt;scriptPrompt(dialog);
-            break;
-        }
-
-        return TRUE;
-    }
-
-    static void mouseTargetChanged(WebKitWebView*, WebKitHitTestResult* hitTestResult, guint modifiers, UIClientTest* test)
-    {
-        g_assert(WEBKIT_IS_HIT_TEST_RESULT(hitTestResult));
-        test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(hitTestResult));
-
-        test-&gt;m_mouseTargetHitTestResult = hitTestResult;
-        test-&gt;m_mouseTargetModifiers = modifiers;
-        g_main_loop_quit(test-&gt;m_mainLoop);
-    }
-
-    static gboolean permissionRequested(WebKitWebView*, WebKitPermissionRequest* request, UIClientTest* test)
-    {
-        g_assert(WEBKIT_IS_PERMISSION_REQUEST(request));
-        test-&gt;assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request));
-
-        if (test-&gt;m_allowPermissionRequests)
-            webkit_permission_request_allow(request);
-        else
-            webkit_permission_request_deny(request);
-
-        return TRUE;
-    }
-
-    UIClientTest()
-        : m_scriptDialogType(WEBKIT_SCRIPT_DIALOG_ALERT)
-        , m_scriptDialogConfirmed(true)
-        , m_allowPermissionRequests(false)
-        , m_mouseTargetModifiers(0)
-    {
-        webkit_settings_set_javascript_can_open_windows_automatically(webkit_web_view_get_settings(m_webView), TRUE);
-        g_signal_connect(m_webView, &quot;create&quot;, G_CALLBACK(viewCreateCallback), this);
-        g_signal_connect(m_webView, &quot;script-dialog&quot;, G_CALLBACK(scriptDialog), this);
-        g_signal_connect(m_webView, &quot;mouse-target-changed&quot;, G_CALLBACK(mouseTargetChanged), this);
-        g_signal_connect(m_webView, &quot;permission-request&quot;, G_CALLBACK(permissionRequested), this);
-    }
-
-    ~UIClientTest()
-    {
-        g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
-    }
-
-    void waitUntilMainLoopFinishes()
-    {
-        g_main_loop_run(m_mainLoop);
-    }
-
-    void setExpectedWindowProperties(const WindowProperties&amp; windowProperties)
-    {
-        m_windowProperties = windowProperties;
-    }
-
-    WebKitHitTestResult* moveMouseAndWaitUntilMouseTargetChanged(int x, int y, unsigned int mouseModifiers = 0)
-    {
-        mouseMoveTo(x, y, mouseModifiers);
-        g_main_loop_run(m_mainLoop);
-        return m_mouseTargetHitTestResult.get();
-    }
-
-    virtual GtkWidget* viewCreate(WebKitWebView* webView)
-    {
-        g_assert(webView == m_webView);
-
-        GtkWidget* newWebView = webkit_web_view_new_with_context(webkit_web_view_get_context(webView));
-        g_object_ref_sink(newWebView);
-
-        m_webViewEvents.append(Create);
-
-        WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(WEBKIT_WEB_VIEW(newWebView));
-        g_assert(windowProperties);
-        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(windowProperties));
-        m_windowPropertiesChanged.clear();
-
-        g_signal_connect(windowProperties, &quot;notify&quot;, G_CALLBACK(windowPropertiesNotifyCallback), this);
-        g_signal_connect(newWebView, &quot;ready-to-show&quot;, G_CALLBACK(viewReadyToShowCallback), this);
-        g_signal_connect(newWebView, &quot;close&quot;, G_CALLBACK(viewCloseCallback), this);
-
-        return newWebView;
-    }
-
-    virtual void viewReadyToShow(WebKitWebView* webView)
-    {
-        g_assert(webView != m_webView);
-
-        WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(webView);
-        g_assert(windowProperties);
-        if (!m_windowProperties.isNull())
-            WindowProperties(windowProperties).assertEqual(m_windowProperties);
-
-        m_webViewEvents.append(ReadyToShow);
-    }
-
-    virtual void viewClose(WebKitWebView* webView)
-    {
-        g_assert(webView != m_webView);
-
-        m_webViewEvents.append(Close);
-        g_object_unref(webView);
-
-        g_main_loop_quit(m_mainLoop);
-    }
-
-    Vector&lt;WebViewEvents&gt; m_webViewEvents;
-    WebKitScriptDialogType m_scriptDialogType;
-    bool m_scriptDialogConfirmed;
-    bool m_allowPermissionRequests;
-    WindowProperties m_windowProperties;
-    HashSet&lt;WTF::String&gt; m_windowPropertiesChanged;
-    GRefPtr&lt;WebKitHitTestResult&gt; m_mouseTargetHitTestResult;
-    unsigned int m_mouseTargetModifiers;
-};
-
-static void testWebViewCreateReadyClose(UIClientTest* test, gconstpointer)
-{
-    test-&gt;loadHtml(&quot;&lt;html&gt;&lt;body onLoad=\&quot;window.open().close();\&quot;&gt;&lt;/html&gt;&quot;, 0);
-    test-&gt;waitUntilMainLoopFinishes();
-
-    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
-    g_assert_cmpint(events.size(), ==, 3);
-    g_assert_cmpint(events[0], ==, UIClientTest::Create);
-    g_assert_cmpint(events[1], ==, UIClientTest::ReadyToShow);
-    g_assert_cmpint(events[2], ==, UIClientTest::Close);
-}
-
-static gboolean checkMimeTypeForFilter(GtkFileFilter* filter, const gchar* mimeType)
-{
-    GtkFileFilterInfo filterInfo;
-    filterInfo.contains = GTK_FILE_FILTER_MIME_TYPE;
-    filterInfo.mime_type = mimeType;
-    return gtk_file_filter_filter(filter, &amp;filterInfo);
-}
-
-class ModalDialogsTest: public UIClientTest {
-public:
-    MAKE_GLIB_TEST_FIXTURE(ModalDialogsTest);
-
-    static void dialogRunAsModalCallback(WebKitWebView* webView, ModalDialogsTest* test)
-    {
-        g_assert(webView != test-&gt;m_webView);
-        test-&gt;m_webViewEvents.append(RunAsModal);
-    }
-
-    GtkWidget* viewCreate(WebKitWebView* webView)
-    {
-        g_assert(webView == m_webView);
-
-        GtkWidget* newWebView = UIClientTest::viewCreate(webView);
-        g_signal_connect(newWebView, &quot;run-as-modal&quot;, G_CALLBACK(dialogRunAsModalCallback), this);
-        return newWebView;
-    }
-
-    void viewReadyToShow(WebKitWebView* webView)
-    {
-        g_assert(webView != m_webView);
-        m_webViewEvents.append(ReadyToShow);
-    }
-};
-
-static void testWebViewAllowModalDialogs(ModalDialogsTest* test, gconstpointer)
-{
-    WebKitSettings* settings = webkit_web_view_get_settings(test-&gt;m_webView);
-    webkit_settings_set_allow_modal_dialogs(settings, TRUE);
-
-    test-&gt;loadHtml(&quot;&lt;html&gt;&lt;body onload=\&quot;window.showModalDialog('data:text/html,&lt;html&gt;&lt;body/&gt;&lt;script&gt;window.close();&lt;/script&gt;&lt;/html&gt;')\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;, 0);
-    test-&gt;waitUntilMainLoopFinishes();
-
-    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
-    g_assert_cmpint(events.size(), ==, 4);
-    g_assert_cmpint(events[0], ==, UIClientTest::Create);
-    g_assert_cmpint(events[1], ==, UIClientTest::ReadyToShow);
-    g_assert_cmpint(events[2], ==, UIClientTest::RunAsModal);
-    g_assert_cmpint(events[3], ==, UIClientTest::Close);
-}
-
-static void testWebViewDisallowModalDialogs(ModalDialogsTest* test, gconstpointer)
-{
-    WebKitSettings* settings = webkit_web_view_get_settings(test-&gt;m_webView);
-    webkit_settings_set_allow_modal_dialogs(settings, FALSE);
-
-    test-&gt;loadHtml(&quot;&lt;html&gt;&lt;body onload=\&quot;window.showModalDialog('data:text/html,&lt;html&gt;&lt;body/&gt;&lt;script&gt;window.close();&lt;/script&gt;&lt;/html&gt;')\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;, 0);
-    // We need to use a timeout here because the viewClose() function
-    // won't ever be called as the dialog won't be created.
-    test-&gt;wait(1);
-
-    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
-    g_assert_cmpint(events.size(), ==, 0);
-}
-
-static void testWebViewJavaScriptDialogs(UIClientTest* test, gconstpointer)
-{
-    static const char* htmlOnLoadFormat = &quot;&lt;html&gt;&lt;body onLoad=\&quot;%s\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
-    static const char* jsAlertFormat = &quot;alert('%s')&quot;;
-    static const char* jsConfirmFormat = &quot;do { confirmed = confirm('%s'); } while (!confirmed); alert('confirmed');&quot;;
-    static const char* jsPromptFormat = &quot;alert(prompt('%s', 'default'));&quot;;
-
-    test-&gt;m_scriptDialogType = WEBKIT_SCRIPT_DIALOG_ALERT;
-    GOwnPtr&lt;char&gt; alertDialogMessage(g_strdup_printf(jsAlertFormat, kAlertDialogMessage));
-    GOwnPtr&lt;char&gt; alertHTML(g_strdup_printf(htmlOnLoadFormat, alertDialogMessage.get()));
-    test-&gt;loadHtml(alertHTML.get(), 0);
-    test-&gt;waitUntilMainLoopFinishes();
-
-    test-&gt;m_scriptDialogType = WEBKIT_SCRIPT_DIALOG_CONFIRM;
-    GOwnPtr&lt;char&gt; confirmDialogMessage(g_strdup_printf(jsConfirmFormat, kConfirmDialogMessage));
-    GOwnPtr&lt;char&gt; confirmHTML(g_strdup_printf(htmlOnLoadFormat, confirmDialogMessage.get()));
-    test-&gt;loadHtml(confirmHTML.get(), 0);
-    test-&gt;waitUntilMainLoopFinishes();
-
-    test-&gt;m_scriptDialogType = WEBKIT_SCRIPT_DIALOG_PROMPT;
-    GOwnPtr&lt;char&gt; promptDialogMessage(g_strdup_printf(jsPromptFormat, kPromptDialogMessage));
-    GOwnPtr&lt;char&gt; promptHTML(g_strdup_printf(htmlOnLoadFormat, promptDialogMessage.get()));
-    test-&gt;loadHtml(promptHTML.get(), 0);
-    test-&gt;waitUntilMainLoopFinishes();
-}
-
-static void testWebViewWindowProperties(UIClientTest* test, gconstpointer)
-{
-    static const char* windowProrpertiesString = &quot;left=100,top=150,width=400,height=400,location=no,menubar=no,status=no,toolbar=no,scrollbars=no&quot;;
-    GdkRectangle geometry = { 100, 150, 400, 400 };
-    test-&gt;setExpectedWindowProperties(UIClientTest::WindowProperties(&amp;geometry, false, false, false, false, false, true, false));
-
-    GOwnPtr&lt;char&gt; htmlString(g_strdup_printf(&quot;&lt;html&gt;&lt;body onLoad=\&quot;window.open('', '', '%s').close();\&quot;&gt;&lt;/body&gt;&lt;/html&gt;&quot;, windowProrpertiesString));
-    test-&gt;loadHtml(htmlString.get(), 0);
-    test-&gt;waitUntilMainLoopFinishes();
-
-    static const char* propertiesChanged[] = {
-        &quot;geometry&quot;, &quot;locationbar-visible&quot;, &quot;menubar-visible&quot;, &quot;statusbar-visible&quot;, &quot;toolbar-visible&quot;, &quot;scrollbars-visible&quot;
-    };
-    for (size_t i = 0; i &lt; G_N_ELEMENTS(propertiesChanged); ++i)
-        g_assert(test-&gt;m_windowPropertiesChanged.contains(propertiesChanged[i]));
-
-    Vector&lt;UIClientTest::WebViewEvents&gt;&amp; events = test-&gt;m_webViewEvents;
-    g_assert_cmpint(events.size(), ==, 3);
-    g_assert_cmpint(events[0], ==, UIClientTest::Create);
-    g_assert_cmpint(events[1], ==, UIClientTest::ReadyToShow);
-    g_assert_cmpint(events[2], ==, UIClientTest::Close);
-}
-
-static void testWebViewMouseTarget(UIClientTest* test, gconstpointer)
-{
-    test-&gt;showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
-
-    const char* linksHoveredHTML =
-        &quot;&lt;html&gt;&lt;body&gt;&quot;
-        &quot; &lt;a style='position:absolute; left:1; top:1' href='http://www.webkitgtk.org' title='WebKitGTK+ Title'&gt;WebKitGTK+ Website&lt;/a&gt;&quot;
-        &quot; &lt;img style='position:absolute; left:1; top:10' src='0xdeadbeef' width=5 height=5&gt;&lt;/img&gt;&quot;
-        &quot; &lt;a style='position:absolute; left:1; top:20' href='http://www.webkitgtk.org/logo' title='WebKitGTK+ Logo'&gt;&lt;img src='0xdeadbeef' width=5 height=5&gt;&lt;/img&gt;&lt;/a&gt;&quot;
-        &quot; &lt;input style='position:absolute; left:1; top:30' size='10'&gt;&lt;/input&gt;&quot;
-        &quot; &lt;div style='position:absolute; left:1; top:50; width:30; height:30; overflow:scroll'&gt;&amp;nbsp;&lt;/div&gt;&quot;
-        &quot; &lt;video style='position:absolute; left:1; top:100' width='300' height='300' controls='controls' preload='none'&gt;&lt;source src='movie.ogg' type='video/ogg' /&gt;&lt;/video&gt;&quot;
-        &quot;&lt;/body&gt;&lt;/html&gt;&quot;;
-
-    test-&gt;loadHtml(linksHoveredHTML, &quot;file:///&quot;);
-    test-&gt;waitUntilLoadFinished();
-
-    // Move over link.
-    WebKitHitTestResult* hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 1);
-    g_assert(webkit_hit_test_result_context_is_link(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
-    g_assert_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, &quot;http://www.webkitgtk.org/&quot;);
-    g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, &quot;WebKitGTK+ Title&quot;);
-    g_assert_cmpstr(webkit_hit_test_result_get_link_label(hitTestResult), ==, &quot;WebKitGTK+ Website&quot;);
-    g_assert(!test-&gt;m_mouseTargetModifiers);
-
-    // Move out of the link.
-    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(0, 0);
-    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
-    g_assert(!test-&gt;m_mouseTargetModifiers);
-
-    // Move over image with GDK_CONTROL_MASK.
-    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 10, GDK_CONTROL_MASK);
-    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
-    g_assert(webkit_hit_test_result_context_is_image(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
-    g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, &quot;file:///0xdeadbeef&quot;);
-    g_assert(test-&gt;m_mouseTargetModifiers &amp; GDK_CONTROL_MASK);
-
-    // Move over image link.
-    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 20);
-    g_assert(webkit_hit_test_result_context_is_link(hitTestResult));
-    g_assert(webkit_hit_test_result_context_is_image(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
-    g_assert_cmpstr(webkit_hit_test_result_get_link_uri(hitTestResult), ==, &quot;http://www.webkitgtk.org/logo&quot;);
-    g_assert_cmpstr(webkit_hit_test_result_get_image_uri(hitTestResult), ==, &quot;file:///0xdeadbeef&quot;);
-    g_assert_cmpstr(webkit_hit_test_result_get_link_title(hitTestResult), ==, &quot;WebKitGTK+ Logo&quot;);
-    g_assert(!webkit_hit_test_result_get_link_label(hitTestResult));
-    g_assert(!test-&gt;m_mouseTargetModifiers);
-
-    // Move over media.
-    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(1, 100);
-    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
-    g_assert(webkit_hit_test_result_context_is_media(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
-    g_assert_cmpstr(webkit_hit_test_result_get_media_uri(hitTestResult), ==, &quot;file:///movie.ogg&quot;);
-    g_assert(!test-&gt;m_mouseTargetModifiers);
-
-    // Mover over input.
-    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(5, 35);
-    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_scrollbar(hitTestResult));
-    g_assert(webkit_hit_test_result_context_is_editable(hitTestResult));
-    g_assert(!test-&gt;m_mouseTargetModifiers);
-
-    // Move over scrollbar.
-    hitTestResult = test-&gt;moveMouseAndWaitUntilMouseTargetChanged(5, 75);
-    g_assert(!webkit_hit_test_result_context_is_link(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_image(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_media(hitTestResult));
-    g_assert(!webkit_hit_test_result_context_is_editable(hitTestResult));
-    g_assert(webkit_hit_test_result_context_is_scrollbar(hitTestResult));
-    g_assert(!test-&gt;m_mouseTargetModifiers);
-}
-
-static void testWebViewPermissionRequests(UIClientTest* test, gconstpointer)
-{
-    // Some versions of geoclue give a runtime warning because it tries
-    // to register the error quark twice. See https://bugs.webkit.org/show_bug.cgi?id=89858.
-    // Make warnings non-fatal for this test to make it pass.
-    test-&gt;removeLogFatalFlag(G_LOG_LEVEL_WARNING);
-    test-&gt;showInWindowAndWaitUntilMapped();
-    static const char* geolocationRequestHTML =
-        &quot;&lt;html&gt;&quot;
-        &quot;  &lt;script&gt;&quot;
-        &quot;  function runTest()&quot;
-        &quot;  {&quot;
-        &quot;    navigator.geolocation.getCurrentPosition(function(p) { document.title = \&quot;OK\&quot; },&quot;
-        &quot;                                             function(e) { document.title = e.code });&quot;
-        &quot;  }&quot;
-        &quot;  &lt;/script&gt;&quot;
-        &quot;  &lt;body onload='runTest();'&gt;&lt;/body&gt;&quot;
-        &quot;&lt;/html&gt;&quot;;
-
-    // Test denying a permission request.
-    test-&gt;m_allowPermissionRequests = false;
-    test-&gt;loadHtml(geolocationRequestHTML, 0);
-    test-&gt;waitUntilTitleChanged();
-
-    // According to the Geolocation API specification, '1' is the
-    // error code returned for the PERMISSION_DENIED error.
-    // http://dev.w3.org/geo/api/spec-source.html#position_error_interface
-    const gchar* result = webkit_web_view_get_title(test-&gt;m_webView);
-    g_assert_cmpstr(result, ==, &quot;1&quot;);
-
-    // Test allowing a permission request.
-    test-&gt;m_allowPermissionRequests = true;
-    test-&gt;loadHtml(geolocationRequestHTML, 0);
-    test-&gt;waitUntilTitleChanged();
-
-    // Check that we did not get the PERMISSION_DENIED error now.
-    result = webkit_web_view_get_title(test-&gt;m_webView);
-    g_assert_cmpstr(result, !=, &quot;1&quot;);
-    test-&gt;addLogFatalFlag(G_LOG_LEVEL_WARNING);
-}
-
</del><span class="cx"> static void testWebViewZoomLevel(WebViewTest* test, gconstpointer)
</span><span class="cx"> {
</span><span class="cx">     g_assert_cmpfloat(webkit_web_view_get_zoom_level(test-&gt;m_webView), ==, 1);
</span><span class="lines">@@ -682,121 +151,6 @@
</span><span class="cx">     g_assert_error(error.get(), WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-class FileChooserTest: public UIClientTest {
-public:
-    MAKE_GLIB_TEST_FIXTURE(FileChooserTest);
-
-    FileChooserTest()
-    {
-        g_signal_connect(m_webView, &quot;run-file-chooser&quot;, G_CALLBACK(runFileChooserCallback), this);
-    }
-
-    static gboolean runFileChooserCallback(WebKitWebView*, WebKitFileChooserRequest* request, FileChooserTest* test)
-    {
-        test-&gt;runFileChooser(request);
-        return TRUE;
-    }
-
-    void runFileChooser(WebKitFileChooserRequest* request)
-    {
-        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request));
-        m_fileChooserRequest = request;
-        g_main_loop_quit(m_mainLoop);
-    }
-
-    WebKitFileChooserRequest* clickMouseButtonAndWaitForFileChooserRequest(int x, int y)
-    {
-        clickMouseButton(x, y);
-        g_main_loop_run(m_mainLoop);
-        return m_fileChooserRequest.get();
-    }
-
-private:
-    GRefPtr&lt;WebKitFileChooserRequest&gt; m_fileChooserRequest;
-};
-
-static void testWebViewFileChooserRequest(FileChooserTest* test, gconstpointer)
-{
-    test-&gt;showInWindowAndWaitUntilMapped();
-    static const char* fileChooserHTMLFormat = &quot;&lt;html&gt;&lt;body&gt;&lt;input style='position:absolute;left:0;top:0;margin:0;padding:0' type='file' %s/&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
-
-    // Multiple selections not allowed, no MIME filtering.
-    GOwnPtr&lt;char&gt; simpleFileUploadHTML(g_strdup_printf(fileChooserHTMLFormat, &quot;&quot;));
-    test-&gt;loadHtml(simpleFileUploadHTML.get(), 0);
-    test-&gt;waitUntilLoadFinished();
-    WebKitFileChooserRequest* fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
-    g_assert(!webkit_file_chooser_request_get_select_multiple(fileChooserRequest));
-
-    const gchar* const* mimeTypes = webkit_file_chooser_request_get_mime_types(fileChooserRequest);
-    g_assert(!mimeTypes);
-    GtkFileFilter* filter = webkit_file_chooser_request_get_mime_types_filter(fileChooserRequest);
-    g_assert(!filter);
-    const gchar* const* selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
-    g_assert(!selectedFiles);
-    webkit_file_chooser_request_cancel(fileChooserRequest);
-
-    // Multiple selections allowed, no MIME filtering, some pre-selected files.
-    GOwnPtr&lt;char&gt; multipleSelectionFileUploadHTML(g_strdup_printf(fileChooserHTMLFormat, &quot;multiple&quot;));
-    test-&gt;loadHtml(multipleSelectionFileUploadHTML.get(), 0);
-    test-&gt;waitUntilLoadFinished();
-    fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
-    g_assert(webkit_file_chooser_request_get_select_multiple(fileChooserRequest));
-
-    mimeTypes = webkit_file_chooser_request_get_mime_types(fileChooserRequest);
-    g_assert(!mimeTypes);
-    filter = webkit_file_chooser_request_get_mime_types_filter(fileChooserRequest);
-    g_assert(!filter);
-    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
-    g_assert(!selectedFiles);
-
-    // Select some files.
-    const gchar* filesToSelect[4] = { &quot;/foo&quot;, &quot;/foo/bar&quot;, &quot;/foo/bar/baz&quot;, 0 };
-    webkit_file_chooser_request_select_files(fileChooserRequest, filesToSelect);
-
-    // Check the files that have been just selected.
-    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
-    g_assert(selectedFiles);
-    g_assert_cmpstr(selectedFiles[0], ==, &quot;/foo&quot;);
-    g_assert_cmpstr(selectedFiles[1], ==, &quot;/foo/bar&quot;);
-    g_assert_cmpstr(selectedFiles[2], ==, &quot;/foo/bar/baz&quot;);
-    g_assert(!selectedFiles[3]);
-
-    // Perform another request to check if the list of files selected
-    // in the previous step appears now as part of the new request.
-    fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
-    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
-    g_assert(selectedFiles);
-    g_assert_cmpstr(selectedFiles[0], ==, &quot;/foo&quot;);
-    g_assert_cmpstr(selectedFiles[1], ==, &quot;/foo/bar&quot;);
-    g_assert_cmpstr(selectedFiles[2], ==, &quot;/foo/bar/baz&quot;);
-    g_assert(!selectedFiles[3]);
-    webkit_file_chooser_request_cancel(fileChooserRequest);
-
-    // Multiple selections not allowed, only accept images, audio and video files..
-    GOwnPtr&lt;char&gt; mimeFilteredFileUploadHTML(g_strdup_printf(fileChooserHTMLFormat, &quot;accept='audio/*,video/*,image/*'&quot;));
-    test-&gt;loadHtml(mimeFilteredFileUploadHTML.get(), 0);
-    test-&gt;waitUntilLoadFinished();
-    fileChooserRequest = test-&gt;clickMouseButtonAndWaitForFileChooserRequest(5, 5);
-    g_assert(!webkit_file_chooser_request_get_select_multiple(fileChooserRequest));
-
-    mimeTypes = webkit_file_chooser_request_get_mime_types(fileChooserRequest);
-    g_assert(mimeTypes);
-    g_assert_cmpstr(mimeTypes[0], ==, &quot;audio/*&quot;);
-    g_assert_cmpstr(mimeTypes[1], ==, &quot;video/*&quot;);
-    g_assert_cmpstr(mimeTypes[2], ==, &quot;image/*&quot;);
-    g_assert(!mimeTypes[3]);
-
-    filter = webkit_file_chooser_request_get_mime_types_filter(fileChooserRequest);
-    g_assert(GTK_IS_FILE_FILTER(filter));
-    g_assert(checkMimeTypeForFilter(filter, &quot;audio/*&quot;));
-    g_assert(checkMimeTypeForFilter(filter, &quot;video/*&quot;));
-    g_assert(checkMimeTypeForFilter(filter, &quot;image/*&quot;));
-
-    selectedFiles = webkit_file_chooser_request_get_selected_files(fileChooserRequest);
-    g_assert(!selectedFiles);
-    webkit_file_chooser_request_cancel(fileChooserRequest);
-}
-
</del><span class="cx"> class FullScreenClientTest: public WebViewTest {
</span><span class="cx"> public:
</span><span class="cx">     MAKE_GLIB_TEST_FIXTURE(FullScreenClientTest);
</span><span class="lines">@@ -1233,264 +587,13 @@
</span><span class="cx">     g_assert(test-&gt;getSnapshotAndCancel());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-class AuthenticationTest: public LoadTrackingTest {
-public:
-    MAKE_GLIB_TEST_FIXTURE(AuthenticationTest);
-
-    AuthenticationTest()
-    {
-        g_signal_connect(m_webView, &quot;authenticate&quot;, G_CALLBACK(runAuthenticationCallback), this);
-    }
-
-    ~AuthenticationTest()
-    {
-        g_signal_handlers_disconnect_matched(m_webView, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this);
-    }
-
-    static int authenticationRetries;
-    static bool authenticationCancelledReceived;
-
-    void loadURI(const char* uri)
-    {
-        // Reset the retry count of the fake server when a page is loaded.
-        authenticationRetries = 0;
-        authenticationCancelledReceived = false;
-        LoadTrackingTest::loadURI(uri);
-    }
-
-    static gboolean runAuthenticationCallback(WebKitWebView*, WebKitAuthenticationRequest* request, AuthenticationTest* test)
-    {
-        g_signal_connect(request, &quot;cancelled&quot;, G_CALLBACK(authenticationCancelledCallback), test);
-        test-&gt;runAuthentication(request);
-        return TRUE;
-    }
-
-    static void authenticationCancelledCallback(WebKitAuthenticationRequest*, AuthenticationTest*)
-    {
-        authenticationCancelledReceived = true;
-    }
-
-    void runAuthentication(WebKitAuthenticationRequest* request)
-    {
-        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(request));
-        m_authenticationRequest = request;
-        g_main_loop_quit(m_mainLoop);
-    }
-
-    WebKitAuthenticationRequest* waitForAuthenticationRequest()
-    {
-        g_main_loop_run(m_mainLoop);
-        return m_authenticationRequest.get();
-    }
-
-private:
-    GRefPtr&lt;WebKitAuthenticationRequest&gt; m_authenticationRequest;
-};
-
-int AuthenticationTest::authenticationRetries = 0;
-bool AuthenticationTest::authenticationCancelledReceived = false;
-
-static const char authTestUsername[] = &quot;username&quot;;
-static const char authTestPassword[] = &quot;password&quot;;
-static const char authExpectedSuccessTitle[] = &quot;WebKit2Gtk+ Authentication test&quot;;
-static const char authExpectedFailureTitle[] = &quot;401 Authorization Required&quot;;
-static const char authExpectedAuthorization[] = &quot;Basic dXNlcm5hbWU6cGFzc3dvcmQ=&quot;; // Base64 encoding of &quot;username:password&quot;.
-static const char authSuccessHTMLString[] =
-    &quot;&lt;html&gt;&quot;
-    &quot;&lt;head&gt;&lt;title&gt;WebKit2Gtk+ Authentication test&lt;/title&gt;&lt;/head&gt;&quot;
-    &quot;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
-static const char authFailureHTMLString[] =
-    &quot;&lt;html&gt;&quot;
-    &quot;&lt;head&gt;&lt;title&gt;401 Authorization Required&lt;/title&gt;&lt;/head&gt;&quot;
-    &quot;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;&quot;;
-
-static void testWebViewAuthenticationRequest(AuthenticationTest* test, gconstpointer)
-{
-    // Test authentication request getters match soup authentication header.
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
-    g_assert_cmpstr(webkit_authentication_request_get_host(request), ==, soup_uri_get_host(kServer-&gt;baseURI()));
-    g_assert_cmpuint(webkit_authentication_request_get_port(request), ==, soup_uri_get_port(kServer-&gt;baseURI()));
-    g_assert_cmpstr(webkit_authentication_request_get_realm(request), ==, &quot;my realm&quot;);
-    g_assert(webkit_authentication_request_get_scheme(request) == WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC);
-    g_assert(!webkit_authentication_request_is_for_proxy(request));
-    g_assert(!webkit_authentication_request_is_retry(request));
-}
-
-static void testWebViewAuthenticationCancel(AuthenticationTest* test, gconstpointer)
-{
-    // Test cancel.
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
-    webkit_authentication_request_cancel(request);
-    // Server doesn't ask for new credentials.
-    test-&gt;waitUntilLoadFinished();
-
-    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
-    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
-    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::ProvisionalLoadFailed);
-    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
-
-    g_assert_error(test-&gt;m_error.get(), WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED);
-}
-
-static void testWebViewAuthenticationLoadCancelled(AuthenticationTest* test, gconstpointer)
-{
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    test-&gt;waitForAuthenticationRequest();
-    webkit_web_view_stop_loading(test-&gt;m_webView);
-    // Expect empty page.
-    test-&gt;waitUntilLoadFinished();
-    g_assert(test-&gt;authenticationCancelledReceived);
-
-    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
-    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
-    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::ProvisionalLoadFailed);
-    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
-
-    g_assert_error(test-&gt;m_error.get(), WEBKIT_NETWORK_ERROR, WEBKIT_NETWORK_ERROR_CANCELLED);
-}
-
-static void testWebViewAuthenticationFailure(AuthenticationTest* test, gconstpointer)
-{
-    // Test authentication failures.
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
-    g_assert(!webkit_authentication_request_is_retry(request));
-    WebKitCredential* credential = webkit_credential_new(authTestUsername, &quot;wrongpassword&quot;, WEBKIT_CREDENTIAL_PERSISTENCE_NONE);
-    webkit_authentication_request_authenticate(request, credential);
-    webkit_credential_free(credential);
-    // Expect a second authentication request.
-    request = test-&gt;waitForAuthenticationRequest();
-    g_assert(webkit_authentication_request_is_retry(request));
-    // Test second failure.
-    credential = webkit_credential_new(authTestUsername, &quot;wrongpassword2&quot;, WEBKIT_CREDENTIAL_PERSISTENCE_NONE);
-    webkit_authentication_request_authenticate(request, credential);
-    webkit_credential_free(credential);
-    // Expect authentication failed page.
-    test-&gt;waitUntilLoadFinished();
-
-    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
-    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
-    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
-    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
-    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedFailureTitle);
-}
-
-static void testWebViewAuthenticationNoCredential(AuthenticationTest* test, gconstpointer)
-{
-    // Test continue without credentials.
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
-    webkit_authentication_request_authenticate(request, 0);
-    // Server doesn't ask for new credentials.
-    test-&gt;waitUntilLoadFinished();
-
-    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
-    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
-    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
-    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
-    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedFailureTitle);
-}
-
-static void testWebViewAuthenticationStorage(AuthenticationTest* test, gconstpointer)
-{
-    // Enable private browsing before authentication request to test that credentials can't be saved.
-    webkit_settings_set_enable_private_browsing(webkit_web_view_get_settings(test-&gt;m_webView), TRUE);
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
-    g_assert(!webkit_authentication_request_get_proposed_credential(request));
-    g_assert(!webkit_authentication_request_can_save_credentials(request));
-
-    // If WebKit has been compiled with libsecret, and private browsing is disabled
-    // then check that credentials can be saved.
-#if ENABLE(CREDENTIAL_STORAGE)
-    webkit_settings_set_enable_private_browsing(webkit_web_view_get_settings(test-&gt;m_webView), FALSE);
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    request = test-&gt;waitForAuthenticationRequest();
-    g_assert(!webkit_authentication_request_get_proposed_credential(request));
-    g_assert(webkit_authentication_request_can_save_credentials(request));
-#endif
-}
-
-static void testWebViewAuthenticationSuccess(AuthenticationTest* test, gconstpointer)
-{
-    // Test correct authentication.
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    WebKitAuthenticationRequest* request = test-&gt;waitForAuthenticationRequest();
-    WebKitCredential* credential = webkit_credential_new(authTestUsername, authTestPassword, WEBKIT_CREDENTIAL_PERSISTENCE_FOR_SESSION);
-    webkit_authentication_request_authenticate(request, credential);
-    webkit_credential_free(credential);
-    test-&gt;waitUntilLoadFinished();
-
-    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
-    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
-    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
-    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
-    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedSuccessTitle);
-
-    // Test loading the same (authorized) page again.
-    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/auth-test.html&quot;).data());
-    // There is no authentication challenge.
-    test-&gt;waitUntilLoadFinished();
-
-    g_assert_cmpint(test-&gt;m_loadEvents.size(), ==, 3);
-    g_assert_cmpint(test-&gt;m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
-    g_assert_cmpint(test-&gt;m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
-    g_assert_cmpint(test-&gt;m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
-    g_assert_cmpstr(webkit_web_view_get_title(test-&gt;m_webView), ==, authExpectedSuccessTitle);
-}
-
-static void serverCallback(SoupServer*, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, void*)
-{
-    if (message-&gt;method != SOUP_METHOD_GET) {
-        soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
-        return;
-    }
-
-    if (!strcmp(path, &quot;/auth-test.html&quot;)) {
-        const char* authorization = soup_message_headers_get_one(message-&gt;request_headers, &quot;Authorization&quot;);
-        // Require authentication.
-        if (!g_strcmp0(authorization, authExpectedAuthorization)) {
-            // Successful authentication.
-            soup_message_set_status(message, SOUP_STATUS_OK);
-            soup_message_body_append(message-&gt;response_body, SOUP_MEMORY_STATIC, authSuccessHTMLString, strlen(authSuccessHTMLString));
-            AuthenticationTest::authenticationRetries = 0;
-        } else if (++AuthenticationTest::authenticationRetries &lt; 3) {
-            // No or invalid authorization header provided by the client, request authentication twice then fail.
-            soup_message_set_status(message, SOUP_STATUS_UNAUTHORIZED);
-            soup_message_headers_append(message-&gt;response_headers, &quot;WWW-Authenticate&quot;, &quot;Basic realm=\&quot;my realm\&quot;&quot;);
-            // Include a failure message in case the user attempts to proceed without authentication.
-            soup_message_body_append(message-&gt;response_body, SOUP_MEMORY_STATIC, authFailureHTMLString, strlen(authFailureHTMLString));
-        } else {
-            // Authentication not successful, display a &quot;401 Authorization Required&quot; page.
-            soup_message_set_status(message, SOUP_STATUS_OK);
-            soup_message_body_append(message-&gt;response_body, SOUP_MEMORY_STATIC, authFailureHTMLString, strlen(authFailureHTMLString));
-        }
-    } else
-        soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
-
-    soup_message_body_complete(message-&gt;response_body);
-}
-
</del><span class="cx"> void beforeAll()
</span><span class="cx"> {
</span><del>-    kServer = new WebKitTestServer();
-    kServer-&gt;run(serverCallback);
-
</del><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;default-context&quot;, testWebViewDefaultContext);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;custom-charset&quot;, testWebViewCustomCharset);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;settings&quot;, testWebViewSettings);
</span><del>-    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;create-ready-close&quot;, testWebViewCreateReadyClose);
-    ModalDialogsTest::add(&quot;WebKitWebView&quot;, &quot;allow-modal-dialogs&quot;, testWebViewAllowModalDialogs);
-    ModalDialogsTest::add(&quot;WebKitWebView&quot;, &quot;disallow-modal-dialogs&quot;, testWebViewDisallowModalDialogs);
-    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;javascript-dialogs&quot;, testWebViewJavaScriptDialogs);
-    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;window-properties&quot;, testWebViewWindowProperties);
-    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;mouse-target&quot;, testWebViewMouseTarget);
-    UIClientTest::add(&quot;WebKitWebView&quot;, &quot;permission-requests&quot;, testWebViewPermissionRequests);
</del><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;zoom-level&quot;, testWebViewZoomLevel);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;run-javascript&quot;, testWebViewRunJavaScript);
</span><del>-    FileChooserTest::add(&quot;WebKitWebView&quot;, &quot;file-chooser-request&quot;, testWebViewFileChooserRequest);
</del><span class="cx">     FullScreenClientTest::add(&quot;WebKitWebView&quot;, &quot;fullscreen&quot;, testWebViewFullScreen);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;can-show-mime-type&quot;, testWebViewCanShowMIMEType);
</span><span class="cx">     FormClientTest::add(&quot;WebKitWebView&quot;, &quot;submit-form&quot;, testWebViewSubmitForm);
</span><span class="lines">@@ -1498,18 +601,8 @@
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;view-mode&quot;, testWebViewMode);
</span><span class="cx">     SnapshotWebViewTest::add(&quot;WebKitWebView&quot;, &quot;snapshot&quot;, testWebViewSnapshot);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebView&quot;, &quot;page-visibility&quot;, testWebViewPageVisibility);
</span><del>-    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-request&quot;, testWebViewAuthenticationRequest);
-    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-cancel&quot;, testWebViewAuthenticationCancel);
-    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-load-cancelled&quot;, testWebViewAuthenticationLoadCancelled);
-    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-failure&quot;, testWebViewAuthenticationFailure);
-    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-no-credential&quot;, testWebViewAuthenticationNoCredential);
-    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-storage&quot;, testWebViewAuthenticationStorage);
-    // Testing authentication success must be done last because libsoup will never fire
-    // the authenticate signal again once authentication is successful.
-    AuthenticationTest::add(&quot;WebKitWebView&quot;, &quot;authentication-success&quot;, testWebViewAuthenticationSuccess);
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void afterAll()
</span><span class="cx"> {
</span><del>-    delete kServer;
</del><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (161137 => 161138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2013-12-30 06:31:41 UTC (rev 161137)
+++ trunk/Tools/ChangeLog        2013-12-30 09:58:14 UTC (rev 161138)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2013-12-30  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Split WebKit2APITests/TestWebKitWebView
+        https://bugs.webkit.org/show_bug.cgi?id=126284
+
+        Reviewed by Philippe Normand.
+
+        Skip only WebKitWebView/mouse-target and all TestAuthentication
+        tests that are timing out when running under xvfb.
+
+        * Scripts/run-gtk-tests:
+        (TestRunner):
+
</ins><span class="cx"> 2013-12-29  Michał Pakuła vel Rutka  &lt;m.pakula@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][WK2] Disable geolocation API test
</span></span></pre></div>
<a id="trunkToolsScriptsrungtktests"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/run-gtk-tests (161137 => 161138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/run-gtk-tests        2013-12-30 06:31:41 UTC (rev 161137)
+++ trunk/Tools/Scripts/run-gtk-tests        2013-12-30 09:58:14 UTC (rev 161138)
</span><span class="lines">@@ -67,7 +67,8 @@
</span><span class="cx">         SkippedTest(&quot;unittests/testwebresource&quot;, &quot;/webkit/webresource/sub_resource_loading&quot;, &quot;Test fails in GTK Linux 64-bit Release bot&quot;, 82330),
</span><span class="cx">         SkippedTest(&quot;unittests/testwebview&quot;, &quot;/webkit/webview/icon-uri&quot;, &quot;Test times out in GTK Linux 64-bit Release bot&quot;, 82328),
</span><span class="cx">         SkippedTest(&quot;WebKit2APITests/TestResources&quot;, &quot;/webkit2/WebKitWebView/resources&quot;, &quot;Test is flaky in GTK Linux 32-bit Release bot&quot;, 82868),
</span><del>-        SkippedTest(&quot;WebKit2APITests/TestWebKitWebView&quot;, SkippedTest.ENTIRE_SUITE, &quot;Test times out after r150890&quot;, 117689),
</del><ins>+        SkippedTest(&quot;WebKit2APITests/TestUIClient&quot;, &quot;/webkit2/WebKitWebView/mouse-target&quot;, &quot;Test times out after r150890&quot;, 117689),
+        SkippedTest(&quot;WebKit2APITests/TestAuthentication&quot;, SkippedTest.ENTIRE_SUITE, &quot;Test times out after r150890&quot;, 117689),
</ins><span class="cx">         SkippedTest(&quot;WebKit2APITests/TestContextMenu&quot;, SkippedTest.ENTIRE_SUITE, &quot;Test times out after r150890&quot;, 117689),
</span><span class="cx">         SkippedTest(&quot;TestWebKitAPI/TestWebKit2&quot;, &quot;WebKit2.MouseMoveAfterCrash&quot;, &quot;Test is flaky&quot;, 85066),
</span><span class="cx">         SkippedTest(&quot;TestWebKitAPI/TestWebKit2&quot;, &quot;WebKit2.NewFirstVisuallyNonEmptyLayoutForImages&quot;, &quot;Test is flaky&quot;, 85066),
</span></span></pre>
</div>
</div>

</body>
</html>