summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2009-08-11 17:01:47 +0100
committerBen Murdoch <benm@google.com>2009-08-11 18:21:02 +0100
commit0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5 (patch)
tree2943df35f62d885c89d01063cc528dd73b480fea /WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
parent7e7a70bfa49a1122b2597a1e6367d89eb4035eca (diff)
downloadexternal_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.zip
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.gz
external_webkit-0bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5.tar.bz2
Merge in WebKit r47029.
Diffstat (limited to 'WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp')
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp84
1 files changed, 60 insertions, 24 deletions
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 5c2bae7..009cb97 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -2,6 +2,7 @@
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007 Eric Seidel <eric@webkit.org>
* Copyright (C) 2008 Nuanti Ltd.
+ * Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,12 +40,14 @@
#include <stdio.h>
#include <glib.h>
+#include <libsoup/soup.h>
#include <webkit/webkit.h>
extern "C" {
bool webkit_web_frame_pause_animation(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
+void webkit_application_cache_set_maximum_size(unsigned long long size);
}
LayoutTestController::~LayoutTestController()
@@ -86,6 +89,11 @@ JSStringRef LayoutTestController::copyEncodedHostName(JSStringRef name)
return 0;
}
+void LayoutTestController::dispatchPendingLoadRequests()
+{
+ // FIXME: Implement for testing fix for 6727495
+}
+
void LayoutTestController::display()
{
displayWebView();
@@ -107,6 +115,7 @@ void LayoutTestController::notifyDone()
if (m_waitToDump && !topLoadingFrame && !WorkQueue::shared()->count())
dump();
m_waitToDump = false;
+ waitForPolicy = false;
}
JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
@@ -115,30 +124,26 @@ JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSSt
return JSStringRetain(url); // Do nothing on Unix.
}
-void LayoutTestController::queueBackNavigation(int howFarBack)
+void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
{
- WorkQueue::shared()->queue(new BackItem(howFarBack));
-}
+ gchar* relativeURL = JSStringCopyUTF8CString(url);
+ SoupURI* baseURI = soup_uri_new(webkit_web_frame_get_uri(mainFrame));
-void LayoutTestController::queueForwardNavigation(int howFarForward)
-{
- WorkQueue::shared()->queue(new ForwardItem(howFarForward));
-}
+ SoupURI* absoluteURI = soup_uri_new_with_base(baseURI, relativeURL);
+ soup_uri_free(baseURI);
+ g_free(relativeURL);
-void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)
-{
- // FIXME: We need to resolve relative URLs here
- WorkQueue::shared()->queue(new LoadItem(url, target));
-}
+ gchar* absoluteCString;
+ if (absoluteURI) {
+ absoluteCString = soup_uri_to_string(absoluteURI, FALSE);
+ soup_uri_free(absoluteURI);
+ } else
+ absoluteCString = JSStringCopyUTF8CString(url);
-void LayoutTestController::queueReload()
-{
- WorkQueue::shared()->queue(new ReloadItem);
-}
+ JSRetainPtr<JSStringRef> absoluteURL(Adopt, JSStringCreateWithUTF8CString(absoluteCString));
+ g_free(absoluteCString);
-void LayoutTestController::queueScript(JSStringRef script)
-{
- WorkQueue::shared()->queue(new ScriptItem(script));
+ WorkQueue::shared()->queue(new LoadItem(absoluteURL.get(), target));
}
void LayoutTestController::setAcceptsEditing(bool acceptsEditing)
@@ -152,6 +157,12 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permis
// FIXME: implement
}
+void LayoutTestController::waitForPolicyDelegate()
+{
+ waitForPolicy = true;
+ setWaitToDump(true);
+}
+
void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
{
// FIXME: implement
@@ -221,8 +232,8 @@ void LayoutTestController::setWaitToDump(bool waitUntilDone)
int LayoutTestController::windowCount()
{
- // FIXME: implement
- return 1;
+ // +1 -> including the main view
+ return g_slist_length(webViewList) + 1;
}
void LayoutTestController::setPrivateBrowsingEnabled(bool flag)
@@ -234,11 +245,26 @@ void LayoutTestController::setPrivateBrowsingEnabled(bool flag)
g_object_set(G_OBJECT(settings), "enable-private-browsing", flag, NULL);
}
+void LayoutTestController::setXSSAuditorEnabled(bool flag)
+{
+ WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+ ASSERT(view);
+
+ WebKitWebSettings* settings = webkit_web_view_get_settings(view);
+ g_object_set(G_OBJECT(settings), "enable-xss-auditor", flag, NULL);
+}
+
void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
{
// FIXME: implement
}
+void LayoutTestController::disableImageLoading()
+{
+ // FIXME: Implement for testing fix for https://bugs.webkit.org/show_bug.cgi?id=27896
+ // Also need to make sure image loading is re-enabled for each new test.
+}
+
void LayoutTestController::setIconDatabaseEnabled(bool flag)
{
// FIXME: implement
@@ -261,9 +287,14 @@ void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag)
// FIXME: implement
}
-void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled)
+void LayoutTestController::setPopupBlockingEnabled(bool flag)
{
- // FIXME: implement
+ WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+ ASSERT(view);
+
+ WebKitWebSettings* settings = webkit_web_view_get_settings(view);
+ g_object_set(G_OBJECT(settings), "javascript-can-open-windows-automatically", !flag, NULL);
+
}
bool LayoutTestController::elementDoesAutoCompleteForElementWithId(JSStringRef id)
@@ -277,6 +308,11 @@ void LayoutTestController::execCommand(JSStringRef name, JSStringRef value)
// FIXME: implement
}
+void LayoutTestController::setCacheModel(int)
+{
+ // FIXME: implement
+}
+
bool LayoutTestController::isCommandEnabled(JSStringRef /*name*/)
{
// FIXME: implement
@@ -305,7 +341,7 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota)
void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
{
- // FIXME: implement
+ webkit_application_cache_set_maximum_size(size);
}
bool LayoutTestController::pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId)