Diff
Modified: trunk/Source/WebKit2/ChangeLog (107042 => 107043)
--- trunk/Source/WebKit2/ChangeLog 2012-02-08 06:56:26 UTC (rev 107042)
+++ trunk/Source/WebKit2/ChangeLog 2012-02-08 07:21:31 UTC (rev 107043)
@@ -1,3 +1,29 @@
+2012-02-07 Martin Robinson <mrobin...@igalia.com>
+
+ [GTK] [WK2] Add WebKitResponsePolicyDecision
+ https://bugs.webkit.org/show_bug.cgi?id=76789
+
+ Reviewed by Philippe Normand.
+
+ Add a WebKitResponsePolicyDecision GObject, use it for response
+ policy decisions and add a test.
+
+ * GNUmakefile.am: Added new source files to the list.
+ * UIProcess/API/gtk/WebKitPolicyClient.cpp:
+ (decidePolicyForResponseCallback): Added this callback which creates the request
+ and fires the signal.
+ (attachPolicyClientToPage): Added new callback to the C API policy client.
+ * UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp: Added.
+ * UIProcess/API/gtk/WebKitResponsePolicyDecision.h: Added.
+ * UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h: Added.
+ * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Added new docs.
+ * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Ditto.
+ * UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp:
+ (testResponsePolicy): Added this test for response policy decisions.
+ (serverCallback): Added a SoupServer to test policy response policy decisions.
+ (beforeAll): Ditto.
+ (afterAll): Ditto.
+
2012-02-07 Timothy Hatcher <timo...@apple.com>
Avoid making a window for the Web Inspector when it is docked.
Modified: trunk/Source/WebKit2/GNUmakefile.am (107042 => 107043)
--- trunk/Source/WebKit2/GNUmakefile.am 2012-02-08 06:56:26 UTC (rev 107042)
+++ trunk/Source/WebKit2/GNUmakefile.am 2012-02-08 07:21:31 UTC (rev 107043)
@@ -90,6 +90,7 @@
$(WebKit2)/UIProcess/API/gtk/WebKitError.h \
$(WebKit2)/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \
$(WebKit2)/UIProcess/API/gtk/WebKitPolicyDecision.h \
+ $(WebKit2)/UIProcess/API/gtk/WebKitResponsePolicyDecision.h \
$(WebKit2)/UIProcess/API/gtk/WebKitSettings.h \
$(WebKit2)/UIProcess/API/gtk/WebKitURIRequest.h \
$(WebKit2)/UIProcess/API/gtk/WebKitURIResponse.h \
@@ -549,6 +550,9 @@
Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.h \
Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp \
+ Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h \
+ Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h \
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp \
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h \
Source/WebKit2/UIProcess/API/gtk/WebKitSettingsPrivate.h \
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp (107042 => 107043)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp 2012-02-08 06:56:26 UTC (rev 107042)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp 2012-02-08 07:21:31 UTC (rev 107043)
@@ -23,6 +23,7 @@
#include "WebKitNavigationPolicyDecisionPrivate.h"
#include "WebKitPolicyDecision.h"
#include "WebKitPrivate.h"
+#include "WebKitResponsePolicyDecisionPrivate.h"
#include "WebKitWebViewBasePrivate.h"
#include "WebKitWebViewPrivate.h"
#include <wtf/gobject/GRefPtr.h>
@@ -57,6 +58,15 @@
WEBKIT_POLICY_DECISION(decision.get()));
}
+static void decidePolicyForResponseCallback(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo)
+{
+ GRefPtr<WebKitResponsePolicyDecision> decision =
+ adoptGRef(webkitResponsePolicyDecisionCreate(request, response, listener));
+ webkitWebViewMakePolicyDecision(WEBKIT_WEB_VIEW(clientInfo),
+ WEBKIT_POLICY_DECISION_TYPE_RESPONSE,
+ WEBKIT_POLICY_DECISION(decision.get()));
+}
+
void attachPolicyClientToPage(WebKitWebView* webView)
{
WKPagePolicyClient policyClient = {
@@ -64,7 +74,7 @@
webView, // clientInfo
decidePolicyForNavigationActionCallback,
decidePolicyForNewWindowActionCallback,
- 0, // decidePolicyForResponseCallback,
+ decidePolicyForResponseCallback,
0, // unableToImplementPolicy
};
WKPageSetPagePolicyClient(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))), &policyClient);
Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp (0 => 107043)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp 2012-02-08 07:21:31 UTC (rev 107043)
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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 "config.h"
+#include "WebKitResponsePolicyDecision.h"
+
+#include "WebKitPolicyDecisionPrivate.h"
+#include "WebKitPrivate.h"
+#include "WebKitURIRequestPrivate.h"
+#include "WebKitURIResponsePrivate.h"
+#include "WebURLRequest.h"
+#include "WebURLResponse.h"
+#include <glib/gi18n-lib.h>
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+using namespace WebKit;
+
+/**
+ * SECTION: WebKitResponsePolicyDecision
+ * @Short_description: A policy decision for resource responses
+ * @Title: WebKitResponsePolicyDecision
+ * @See_also: #WebKitPolicyDecision, #WebKitWebView
+ *
+ * WebKitResponsePolicyDecision represents a policy decision for a
+ * resource response, whether from the network or the local system.
+ * A very common usecase for these types of decision is deciding
+ * whether or not to download a particular resource or to load it
+ * normally.
+ */
+G_DEFINE_TYPE(WebKitResponsePolicyDecision, webkit_response_policy_decision, WEBKIT_TYPE_POLICY_DECISION)
+
+struct _WebKitResponsePolicyDecisionPrivate {
+ GRefPtr<WebKitURIRequest> request;
+ GRefPtr<WebKitURIResponse> response;
+};
+
+enum {
+ PROP_0,
+ PROP_REQUEST,
+ PROP_RESPONSE,
+};
+
+static void webkit_response_policy_decision_init(WebKitResponsePolicyDecision* decision)
+{
+ decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecisionPrivate);
+ new (decision->priv) WebKitResponsePolicyDecisionPrivate();
+}
+
+static void webkitResponsePolicyDecisionFinalize(GObject* object)
+{
+ WEBKIT_RESPONSE_POLICY_DECISION(object)->priv->~WebKitResponsePolicyDecisionPrivate();
+ G_OBJECT_CLASS(webkit_response_policy_decision_parent_class)->finalize(object);
+}
+
+static void webkitResponsePolicyDecisionGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
+{
+ WebKitResponsePolicyDecision* decision = WEBKIT_RESPONSE_POLICY_DECISION(object);
+ switch (propId) {
+ case PROP_REQUEST:
+ g_value_set_object(value, webkit_response_policy_decision_get_request(decision));
+ break;
+ case PROP_RESPONSE:
+ g_value_set_object(value, webkit_response_policy_decision_get_response(decision));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
+ break;
+ }
+}
+
+static void webkit_response_policy_decision_class_init(WebKitResponsePolicyDecisionClass* decisionClass)
+{
+ GObjectClass* objectClass = G_OBJECT_CLASS(decisionClass);
+ objectClass->finalize = webkitResponsePolicyDecisionFinalize;
+ objectClass->get_property = webkitResponsePolicyDecisionGetProperty;
+ g_type_class_add_private(decisionClass, sizeof(WebKitResponsePolicyDecisionPrivate));
+
+ /**
+ * WebKitResponsePolicyDecision:request:
+ *
+ * This property contains the #WebKitURIRequest associated with this
+ * policy decision.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_REQUEST,
+ g_param_spec_object("request",
+ _("Response URI request"),
+ _("The URI request that is associated with this policy decision"),
+ WEBKIT_TYPE_URI_REQUEST,
+ WEBKIT_PARAM_READABLE));
+
+ /**
+ * WebKitResponsePolicyDecision:response:
+ *
+ * This property contains the #WebKitURIResponse associated with this
+ * policy decision.
+ */
+ g_object_class_install_property(objectClass,
+ PROP_REQUEST,
+ g_param_spec_object("response",
+ _("URI response"),
+ _("The URI response that is associated with this policy decision"),
+ WEBKIT_TYPE_URI_REQUEST,
+ WEBKIT_PARAM_READABLE));
+
+}
+
+/**
+ * webkit_response_policy_decision_get_request:
+ * @decision: a #WebKitResponsePolicyDecision
+ *
+ * Gets the value of the #WebKitResponsePolicyDecision:request property.
+ *
+ * Returns: (transfer none): The URI request that is associated with this policy decision.
+ */
+WebKitURIRequest* webkit_response_policy_decision_get_request(WebKitResponsePolicyDecision* decision)
+{
+ g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), 0);
+ return decision->priv->request.get();
+}
+
+/**
+ * webkit_response_policy_decision_get_response:
+ * @decision: a #WebKitResponsePolicyDecision
+ *
+ * Gets the value of the #WebKitResponsePolicyDecision:response property.
+ *
+ * Returns: (transfer none): The URI response that is associated with this policy decision.
+ */
+WebKitURIResponse* webkit_response_policy_decision_get_response(WebKitResponsePolicyDecision* decision)
+{
+ g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), 0);
+ return decision->priv->response.get();
+}
+
+WebKitResponsePolicyDecision* webkitResponsePolicyDecisionCreate(WKURLRequestRef request, WKURLResponseRef response, WKFramePolicyListenerRef listener)
+{
+ WebKitResponsePolicyDecision* decision = WEBKIT_RESPONSE_POLICY_DECISION(g_object_new(WEBKIT_TYPE_RESPONSE_POLICY_DECISION, NULL));
+ decision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(toImpl(request)->resourceRequest()));
+ decision->priv->response = adoptGRef(webkitURIResponseCreateForResourceResponse(toImpl(response)->resourceResponse()));
+ webkitPolicyDecisionSetListener(WEBKIT_POLICY_DECISION(decision), listener);
+ return decision;
+}
Property changes on: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp
___________________________________________________________________
Added: svn:eol-style
Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h (0 => 107043)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h 2012-02-08 07:21:31 UTC (rev 107043)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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.
+ */
+
+#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION)
+#error "Only <webkit2/webkit2.h> can be included directly."
+#endif
+
+#ifndef WebKitResponsePolicyDecision_h
+#define WebKitResponsePolicyDecision_h
+
+#include <glib-object.h>
+#include <webkit2/WebKitDefines.h>
+#include <webkit2/WebKitPolicyDecision.h>
+#include <webkit2/WebKitURIResponse.h>
+#include <webkit2/WebKitURIRequest.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_TYPE_RESPONSE_POLICY_DECISION (webkit_response_policy_decision_get_type())
+#define WEBKIT_RESPONSE_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecision))
+#define WEBKIT_RESPONSE_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecisionClass))
+#define WEBKIT_IS_RESPONSE_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_RESPONSE_POLICY_DECISION))
+#define WEBKIT_IS_RESPONSE_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_RESPONSE_POLICY_DECISION))
+#define WEBKIT_RESPONSE_POLICY_DECISION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecisionClass))
+
+typedef struct _WebKitResponsePolicyDecision WebKitResponsePolicyDecision;
+typedef struct _WebKitResponsePolicyDecisionClass WebKitResponsePolicyDecisionClass;
+typedef struct _WebKitResponsePolicyDecisionPrivate WebKitResponsePolicyDecisionPrivate;
+
+struct _WebKitResponsePolicyDecision {
+ WebKitPolicyDecision parent;
+
+ /*< private >*/
+ WebKitResponsePolicyDecisionPrivate *priv;
+};
+
+struct _WebKitResponsePolicyDecisionClass {
+ WebKitPolicyDecisionClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_response_policy_decision_get_type (void);
+
+WEBKIT_API WebKitURIRequest *
+webkit_response_policy_decision_get_request (WebKitResponsePolicyDecision *decision);
+
+WEBKIT_API WebKitURIResponse *
+webkit_response_policy_decision_get_response (WebKitResponsePolicyDecision *decision);
+
+G_END_DECLS
+
+#endif
Property changes on: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h
___________________________________________________________________
Added: svn:eol-style
Added: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h (0 => 107043)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h 2012-02-08 07:21:31 UTC (rev 107043)
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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.
+ */
+
+#ifndef WebKitResponsePolicyDecisionPrivate_h
+#define WebKitResponsePolicyDecisionPrivate_h
+
+#include "WebKitPrivate.h"
+#include "WebKitResponsePolicyDecision.h"
+
+WebKitResponsePolicyDecision* webkitResponsePolicyDecisionCreate(WKURLRequestRef, WKURLResponseRef, WKFramePolicyListenerRef);
+
+#endif // WebKitResponsePolicyDecisionPrivate_h
Property changes on: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml (107042 => 107043)
--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml 2012-02-08 06:56:26 UTC (rev 107042)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml 2012-02-08 07:21:31 UTC (rev 107043)
@@ -23,6 +23,7 @@
<xi:include href=""
<xi:include href=""
<xi:include href=""
+ <xi:include href=""
<xi:include href=""
</chapter>
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (107042 => 107043)
--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt 2012-02-08 06:56:26 UTC (rev 107042)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt 2012-02-08 07:21:31 UTC (rev 107043)
@@ -368,6 +368,26 @@
</SECTION>
<SECTION>
+<FILE>WebKitResponsePolicyDecision</FILE>
+WebKitResponsePolicyDecision
+webkit_response_policy_decision_get_request
+webkit_response_policy_decision_get_response
+
+<SUBSECTION Standard>
+WebKitResponsePolicyDecisionClass
+WEBKIT_TYPE_RESPONSE_POLICY_DECISION
+WEBKIT_RESPONSE_POLICY_DECISION
+WEBKIT_IS_RESPONSE_POLICY_DECISION
+WEBKIT_RESPONSE_POLICY_DECISION_CLASS
+WEBKIT_IS_RESPONSE_POLICY_DECISION_CLASS
+WEBKIT_RESPONSE_POLICY_DECISION_GET_CLASS
+
+<SUBSECTION Private>
+WebKitResponsePolicyDecisionPrivate
+webkit_response_policy_decision_get_type
+</SECTION>
+
+<SECTION>
<FILE>WebKitError</FILE>
WEBKIT_NETWORK_ERROR
WEBKIT_PLUGIN_ERROR
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp (107042 => 107043)
--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp 2012-02-08 06:56:26 UTC (rev 107042)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp 2012-02-08 07:21:31 UTC (rev 107043)
@@ -20,9 +20,12 @@
#include "config.h"
#include "LoadTrackingTest.h"
+#include "WebKitTestServer.h"
#include <wtf/gobject/GRefPtr.h>
#include <wtf/text/CString.h>
+static WebKitTestServer* kServer;
+
class PolicyClientTest: public LoadTrackingTest {
public:
MAKE_GLIB_TEST_FIXTURE(PolicyClientTest);
@@ -142,6 +145,37 @@
g_assert_cmpint(test->m_loadEvents.size(), ==, 0);
}
+static void testResponsePolicy(PolicyClientTest* test, gconstpointer)
+{
+ test->m_policyDecisionTypeFilter = WEBKIT_POLICY_DECISION_TYPE_RESPONSE;
+
+ test->m_policyDecisionResponse = PolicyClientTest::Use;
+ test->loadURI(kServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+ g_assert_cmpint(test->m_loadEvents.size(), ==, 3);
+ g_assert_cmpint(test->m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+ g_assert_cmpint(test->m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
+ g_assert_cmpint(test->m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+
+ test->m_respondToPolicyDecisionAsynchronously = true;
+ test->loadURI(kServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+ g_assert_cmpint(test->m_loadEvents.size(), ==, 3);
+ g_assert_cmpint(test->m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+ g_assert_cmpint(test->m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted);
+ g_assert_cmpint(test->m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+
+ test->m_respondToPolicyDecisionAsynchronously = false;
+ test->m_policyDecisionResponse = PolicyClientTest::Ignore;
+ test->loadURI(kServer->getURIForPath("/").data());
+ test->waitUntilLoadFinished();
+
+ g_assert_cmpint(test->m_loadEvents.size(), ==, 3);
+ g_assert_cmpint(test->m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted);
+ g_assert_cmpint(test->m_loadEvents[1], ==, LoadTrackingTest::ProvisionalLoadFailed);
+ g_assert_cmpint(test->m_loadEvents[2], ==, LoadTrackingTest::LoadFinished);
+}
+
struct CreateCallbackData {
bool triedToOpenWindow;
GMainLoop* mainLoop;
@@ -191,12 +225,31 @@
g_assert(!data.triedToOpenWindow);
}
+static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
+{
+ if (message->method != SOUP_METHOD_GET) {
+ soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
+ return;
+ }
+
+ soup_message_set_status(message, SOUP_STATUS_OK);
+
+ static const char* responseString = "<html><body>Testing!</body></html>";
+ soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString));
+ soup_message_body_complete(message->response_body);
+}
+
void beforeAll()
{
+ kServer = new WebKitTestServer();
+ kServer->run(serverCallback);
+
PolicyClientTest::add("WebKitPolicyClient", "navigation-policy", testNavigationPolicy);
+ PolicyClientTest::add("WebKitPolicyClient", "response-policy", testResponsePolicy);
PolicyClientTest::add("WebKitPolicyClient", "new-window-policy", testNewWindowPolicy);
}
void afterAll()
{
+ delete kServer;
}