summaryrefslogtreecommitdiff
path: root/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2016-04-10 09:28:39 +0000
commit32761a6cee1d0dee366b885b7b9c777e67885688 (patch)
treed6bec92bebfb216f4126356e55518842c2f476a1 /Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp
parenta4e969f4965059196ca948db781e52f7cfebf19e (diff)
downloadWebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp')
-rw-r--r--Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp92
1 files changed, 3 insertions, 89 deletions
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp
index 227b389ff..331915e00 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp
@@ -82,13 +82,6 @@ static void testLoadAlternateHTML(LoadTrackingTest* test, gconstpointer)
assertNormalLoadHappened(test->m_loadEvents);
}
-static void testLoadAlternateHTMLForLocalPage(LoadTrackingTest* test, gconstpointer)
-{
- test->loadAlternateHTML("<html><body>Alternate page</body></html>", "file:///not/actually/loaded.html", 0);
- test->waitUntilLoadFinished();
- assertNormalLoadHappened(test->m_loadEvents);
-}
-
static void testLoadPlainText(LoadTrackingTest* test, gconstpointer)
{
test->loadPlainText("Hello WebKit-GTK+");
@@ -96,18 +89,6 @@ static void testLoadPlainText(LoadTrackingTest* test, gconstpointer)
assertNormalLoadHappened(test->m_loadEvents);
}
-static void testLoadBytes(LoadTrackingTest* test, gconstpointer)
-{
- GUniquePtr<char> filePath(g_build_filename(Test::getResourcesDir().data(), "blank.ico", nullptr));
- char* contents;
- gsize contentsLength;
- g_file_get_contents(filePath.get(), &contents, &contentsLength, nullptr);
- GRefPtr<GBytes> bytes = adoptGRef(g_bytes_new_take(contents, contentsLength));
- test->loadBytes(bytes.get(), "image/vnd.microsoft.icon", nullptr, nullptr);
- test->waitUntilLoadFinished();
- assertNormalLoadHappened(test->m_loadEvents);
-}
-
static void testLoadRequest(LoadTrackingTest* test, gconstpointer)
{
GRefPtr<WebKitURIRequest> request(webkit_uri_request_new(kServer->getURIForPath("/normal").data()));
@@ -116,14 +97,6 @@ static void testLoadRequest(LoadTrackingTest* test, gconstpointer)
assertNormalLoadHappened(test->m_loadEvents);
}
-static void testLoadFromGResource(LoadTrackingTest* test, gconstpointer)
-{
- GRefPtr<WebKitURIRequest> request(webkit_uri_request_new("resource:///org/webkit/webkit2gtk/tests/boring.html"));
- test->loadRequest(request.get());
- test->waitUntilLoadFinished();
- assertNormalLoadHappened(test->m_loadEvents);
-}
-
class LoadStopTrackingTest : public LoadTrackingTest {
public:
MAKE_GLIB_TEST_FIXTURE(LoadStopTrackingTest);
@@ -330,8 +303,7 @@ public:
WebPageURITest()
{
- GUniquePtr<char> extensionBusName(g_strdup_printf("org.webkit.gtk.WebExtensionTest%u", Test::s_webExtensionID));
- GRefPtr<GDBusProxy> proxy = adoptGRef(bus->createProxy(extensionBusName.get(),
+ GRefPtr<GDBusProxy> proxy = adoptGRef(bus->createProxy("org.webkit.gtk.WebExtensionTest",
"/org/webkit/gtk/WebExtensionTest", "org.webkit.gtk.WebExtensionTest", m_mainLoop));
m_uriChangedSignalID = g_dbus_connection_signal_subscribe(
g_dbus_proxy_get_connection(proxy.get()),
@@ -412,53 +384,6 @@ static void testURIRequestHTTPHeaders(WebViewTest* test, gconstpointer)
g_assert(!strncmp(mainResourceData, "1", mainResourceDataSize));
}
-static void testURIRequestHTTPMethod(WebViewTest* test, gconstpointer)
-{
- GRefPtr<WebKitURIRequest> uriRequest = adoptGRef(webkit_uri_request_new("file:///foo/bar"));
- g_assert(uriRequest.get());
- g_assert_cmpstr(webkit_uri_request_get_uri(uriRequest.get()), ==, "file:///foo/bar");
- g_assert(!webkit_uri_request_get_http_method(uriRequest.get()));
-
- webkit_uri_request_set_uri(uriRequest.get(), kServer->getURIForPath("/http-get-method").data());
- test->loadRequest(uriRequest.get());
- test->waitUntilLoadFinished();
-
- test->runJavaScriptAndWaitUntilFinished("xhr = new XMLHttpRequest; xhr.open('POST', '/http-post-method', false); xhr.send();", nullptr);
-}
-
-static void testURIResponseHTTPHeaders(WebViewTest* test, gconstpointer)
-{
- test->loadHtml("<html><body>No HTTP headers</body></html>", "file:///");
- test->waitUntilLoadFinished();
- WebKitWebResource* resource = webkit_web_view_get_main_resource(test->m_webView);
- g_assert(WEBKIT_IS_WEB_RESOURCE(resource));
- WebKitURIResponse* response = webkit_web_resource_get_response(resource);
- g_assert(WEBKIT_IS_URI_RESPONSE(response));
- g_assert(!webkit_uri_response_get_http_headers(response));
-
- test->loadURI(kServer->getURIForPath("/headers").data());
- test->waitUntilLoadFinished();
- resource = webkit_web_view_get_main_resource(test->m_webView);
- g_assert(WEBKIT_IS_WEB_RESOURCE(resource));
- response = webkit_web_resource_get_response(resource);
- g_assert(WEBKIT_IS_URI_RESPONSE(response));
- SoupMessageHeaders* headers = webkit_uri_response_get_http_headers(response);
- g_assert(headers);
- g_assert_cmpstr(soup_message_headers_get_one(headers, "Foo"), ==, "bar");
-}
-
-static void testRedirectToDataURI(WebViewTest* test, gconstpointer)
-{
- test->loadURI(kServer->getURIForPath("/redirect-to-data").data());
- test->waitUntilLoadFinished();
-
- static const char* expectedData = "data-uri";
- size_t mainResourceDataSize = 0;
- const char* mainResourceData = test->mainResourceData(mainResourceDataSize);
- g_assert_cmpint(mainResourceDataSize, ==, strlen(expectedData));
- g_assert(!strncmp(mainResourceData, expectedData, mainResourceDataSize));
-}
-
static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
{
static const char* responseString = "<html><body>Testing!Testing!Testing!Testing!Testing!Testing!Testing!"
@@ -477,7 +402,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char*
soup_message_set_status(message, SOUP_STATUS_OK);
- if (g_str_has_prefix(path, "/normal") || g_str_has_prefix(path, "/http-get-method"))
+ if (g_str_has_prefix(path, "/normal"))
soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString));
else if (g_str_equal(path, "/error"))
soup_message_set_status(message, SOUP_STATUS_CANT_CONNECT);
@@ -496,12 +421,6 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char*
else
soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, kDNTHeaderNotPresent, strlen(kDNTHeaderNotPresent));
soup_message_set_status(message, SOUP_STATUS_OK);
- } else if (g_str_equal(path, "/headers")) {
- soup_message_headers_append(message->response_headers, "Foo", "bar");
- soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString));
- } else if (g_str_equal(path, "/redirect-to-data")) {
- soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY);
- soup_message_headers_append(message->response_headers, "Location", "data:text/plain;charset=utf-8,data-uri");
} else
soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
@@ -510,6 +429,7 @@ static void serverCallback(SoupServer* server, SoupMessage* message, const char*
void beforeAll()
{
+ webkit_web_context_set_web_extensions_directory(webkit_web_context_get_default(), WEBKIT_TEST_WEB_EXTENSIONS_DIR);
bus = new WebKitTestBus();
if (!bus->run())
return;
@@ -521,11 +441,8 @@ void beforeAll()
LoadTrackingTest::add("WebKitWebView", "loading-error", testLoadingError);
LoadTrackingTest::add("WebKitWebView", "load-html", testLoadHtml);
LoadTrackingTest::add("WebKitWebView", "load-alternate-html", testLoadAlternateHTML);
- LoadTrackingTest::add("WebKitWebView", "load-alternate-html-for-local-page", testLoadAlternateHTMLForLocalPage);
LoadTrackingTest::add("WebKitWebView", "load-plain-text", testLoadPlainText);
- LoadTrackingTest::add("WebKitWebView", "load-bytes", testLoadBytes);
LoadTrackingTest::add("WebKitWebView", "load-request", testLoadRequest);
- LoadTrackingTest::add("WebKitWebView", "load-gresource", testLoadFromGResource);
LoadStopTrackingTest::add("WebKitWebView", "stop-loading", testLoadCancelled);
LoadTrackingTest::add("WebKitWebView", "title", testWebViewTitle);
LoadTrackingTest::add("WebKitWebView", "progress", testLoadProgress);
@@ -539,9 +456,6 @@ void beforeAll()
ViewIsLoadingTest::add("WebKitWebView", "is-loading", testWebViewIsLoading);
WebPageURITest::add("WebKitWebPage", "get-uri", testWebPageURI);
WebViewTest::add("WebKitURIRequest", "http-headers", testURIRequestHTTPHeaders);
- WebViewTest::add("WebKitURIRequest", "http-method", testURIRequestHTTPMethod);
- WebViewTest::add("WebKitURIResponse", "http-headers", testURIResponseHTTPHeaders);
- WebViewTest::add("WebKitWebPage", "redirect-to-data-uri", testRedirectToDataURI);
}
void afterAll()