summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/chromium
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree/chromium')
-rw-r--r--WebKitTools/DumpRenderTree/chromium/EventSender.cpp153
-rw-r--r--WebKitTools/DumpRenderTree/chromium/EventSender.h28
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp102
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.h21
-rw-r--r--WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp119
-rw-r--r--WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h70
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.h6
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestWebWorker.h1
-rw-r--r--WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp36
-rw-r--r--WebKitTools/DumpRenderTree/chromium/WebViewHost.h22
11 files changed, 517 insertions, 45 deletions
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
index c48aaf4..381112e 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
@@ -50,6 +50,7 @@
#include "public/WebDragOperation.h"
#include "public/WebPoint.h"
#include "public/WebString.h"
+#include "public/WebTouchPoint.h"
#include "public/WebView.h"
#include "webkit/support/webkit_support.h"
#include <wtf/Deque.h>
@@ -65,7 +66,6 @@ using namespace base;
using namespace std;
using namespace WebKit;
-TestShell* EventSender::testShell = 0;
WebPoint EventSender::lastMousePos;
WebMouseEvent::Button EventSender::pressedButton = WebMouseEvent::ButtonNone;
WebMouseEvent::Button EventSender::lastButtonType = WebMouseEvent::ButtonNone;
@@ -94,6 +94,8 @@ static WebDragOperation currentDragEffect;
static WebDragOperationsMask currentDragEffectsAllowed;
static bool replayingSavedEvents = false;
static Deque<SavedEvent> mouseEventQueue;
+static int touchModifiers;
+static Vector<WebTouchPoint> touchPoints;
// Time and place of the last mouse up event.
static double lastClickTimeSec = 0;
@@ -161,7 +163,7 @@ static bool applyKeyModifier(const string& modifierName, WebInputEvent* event)
event->modifiers |= WebInputEvent::AltKey;
#if !OS(MAC_OS_X)
// On Windows all keys with Alt modifier will be marked as system key.
- // We keep the same behavior on Linux, see:
+ // We keep the same behavior on Linux and everywhere non-Mac, see:
// WebKit/chromium/src/gtk/WebInputEventFactory.cpp
// If we want to change this behavior on Linux, this piece of code must be
// kept in sync with the related code in above file.
@@ -246,13 +248,8 @@ enum KeyLocationCode {
EventSender::EventSender(TestShell* shell)
: m_methodFactory(this)
+ , m_shell(shell)
{
- // Set static testShell variable since we can't do it in an initializer list.
- // We also need to be careful not to assign testShell to new windows which are
- // temporary.
- if (!testShell)
- testShell = shell;
-
// Initialize the map that associates methods of this class with the names
// they will use when called by JavaScript. The actual binding of those
// names to their methods will be done by calling bindToJavaScript() (defined
@@ -274,6 +271,16 @@ EventSender::EventSender(TestShell* shell)
bindMethod("zoomPageOut", &EventSender::zoomPageOut);
bindMethod("scheduleAsynchronousClick", &EventSender::scheduleAsynchronousClick);
bindMethod("beginDragWithFiles", &EventSender::beginDragWithFiles);
+ bindMethod("addTouchPoint", &EventSender::addTouchPoint);
+ bindMethod("cancelTouchPoint", &EventSender::cancelTouchPoint);
+ bindMethod("clearTouchPoints", &EventSender::clearTouchPoints);
+ bindMethod("releaseTouchPoint", &EventSender::releaseTouchPoint);
+ bindMethod("updateTouchPoint", &EventSender::updateTouchPoint);
+ bindMethod("setTouchModifier", &EventSender::setTouchModifier);
+ bindMethod("touchCancel", &EventSender::touchCancel);
+ bindMethod("touchEnd", &EventSender::touchEnd);
+ bindMethod("touchMove", &EventSender::touchMove);
+ bindMethod("touchStart", &EventSender::touchStart);
// When set to true (the default value), we batch mouse move and mouse up
// events so we can simulate drag & drop.
@@ -315,16 +322,16 @@ void EventSender::reset()
clickCount = 0;
lastButtonType = WebMouseEvent::ButtonNone;
timeOffsetMs = 0;
+ touchModifiers = 0;
+ touchPoints.clear();
}
WebView* EventSender::webview()
{
- return testShell->webView();
+ return m_shell->webView();
}
-void EventSender::doDragDrop(const WebKit::WebPoint& eventPos,
- const WebDragData& dragData,
- WebDragOperationsMask mask)
+void EventSender::doDragDrop(const WebDragData& dragData, WebDragOperationsMask mask)
{
WebMouseEvent event;
initMouseEvent(WebInputEvent::MouseDown, pressedButton, lastMousePos, &event);
@@ -610,11 +617,11 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result)
// We just simulate the same behavior here.
string editCommand;
if (getEditCommand(eventDown, &editCommand))
- testShell->webViewHost()->setEditCommand(editCommand, "");
+ m_shell->webViewHost()->setEditCommand(editCommand, "");
webview()->handleInputEvent(eventDown);
- testShell->webViewHost()->clearEditCommand();
+ m_shell->webViewHost()->clearEditCommand();
if (generateChar) {
eventChar.type = WebInputEvent::Char;
@@ -787,6 +794,124 @@ void EventSender::beginDragWithFiles(const CppArgumentList& arguments, CppVarian
result->setNull();
}
+void EventSender::addTouchPoint(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ WebTouchPoint touchPoint;
+ touchPoint.state = WebTouchPoint::StatePressed;
+ touchPoint.position = WebPoint(arguments[0].toInt32(), arguments[1].toInt32());
+ touchPoint.id = touchPoints.size();
+ touchPoints.append(touchPoint);
+}
+
+void EventSender::clearTouchPoints(const CppArgumentList&, CppVariant* result)
+{
+ result->setNull();
+ touchPoints.clear();
+}
+
+void EventSender::releaseTouchPoint(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ const unsigned index = arguments[0].toInt32();
+ ASSERT(index < touchPoints.size());
+
+ WebTouchPoint* touchPoint = &touchPoints[index];
+ touchPoint->state = WebTouchPoint::StateReleased;
+}
+
+void EventSender::setTouchModifier(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ int mask = 0;
+ const string keyName = arguments[0].toString();
+ if (keyName == "shift")
+ mask = WebInputEvent::ShiftKey;
+ else if (keyName == "alt")
+ mask = WebInputEvent::AltKey;
+ else if (keyName == "ctrl")
+ mask = WebInputEvent::ControlKey;
+ else if (keyName == "meta")
+ mask = WebInputEvent::MetaKey;
+
+ if (arguments[1].toBoolean())
+ touchModifiers |= mask;
+ else
+ touchModifiers &= ~mask;
+}
+
+void EventSender::updateTouchPoint(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ const unsigned index = arguments[0].toInt32();
+ ASSERT(index < touchPoints.size());
+
+ WebPoint position(arguments[1].toInt32(), arguments[2].toInt32());
+ WebTouchPoint* touchPoint = &touchPoints[index];
+ touchPoint->state = WebTouchPoint::StateMoved;
+ touchPoint->position = position;
+}
+
+void EventSender::cancelTouchPoint(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ const unsigned index = arguments[0].toInt32();
+ ASSERT(index < touchPoints.size());
+
+ WebTouchPoint* touchPoint = &touchPoints[index];
+ touchPoint->state = WebTouchPoint::StateCancelled;
+}
+
+void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type)
+{
+ ASSERT(static_cast<unsigned>(WebTouchEvent::touchPointsLengthCap) > touchPoints.size());
+ WebTouchEvent touchEvent;
+ touchEvent.type = type;
+ touchEvent.modifiers = touchModifiers;
+ touchEvent.touchPointsLength = touchPoints.size();
+ for (unsigned i = 0; i < touchPoints.size(); ++i)
+ touchEvent.touchPoints[i] = touchPoints[i];
+ webview()->handleInputEvent(touchEvent);
+
+ for (unsigned i = 0; i < touchPoints.size(); ++i) {
+ WebTouchPoint* touchPoint = &touchPoints[i];
+ if (touchPoint->state == WebTouchPoint::StateReleased) {
+ touchPoints.remove(i);
+ --i;
+ } else
+ touchPoint->state = WebTouchPoint::StateStationary;
+ }
+}
+
+void EventSender::touchEnd(const CppArgumentList&, CppVariant* result)
+{
+ result->setNull();
+ sendCurrentTouchEvent(WebInputEvent::TouchEnd);
+}
+
+void EventSender::touchMove(const CppArgumentList&, CppVariant* result)
+{
+ result->setNull();
+ sendCurrentTouchEvent(WebInputEvent::TouchMove);
+}
+
+void EventSender::touchStart(const CppArgumentList&, CppVariant* result)
+{
+ result->setNull();
+ sendCurrentTouchEvent(WebInputEvent::TouchStart);
+}
+
+void EventSender::touchCancel(const CppArgumentList&, CppVariant* result)
+{
+ result->setNull();
+ sendCurrentTouchEvent(WebInputEvent::TouchCancel);
+}
+
//
// Unimplemented stubs
//
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.h b/WebKitTools/DumpRenderTree/chromium/EventSender.h
index 756b008..ac475a3 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.h
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.h
@@ -60,9 +60,7 @@ public:
void reset();
// Simulate drag&drop system call.
- static void doDragDrop(const WebKit::WebPoint&,
- const WebKit::WebDragData&,
- WebKit::WebDragOperationsMask);
+ void doDragDrop(const WebKit::WebDragData&, WebKit::WebDragOperationsMask);
// JS callback methods.
void mouseDown(const CppArgumentList&, CppVariant*);
@@ -80,6 +78,17 @@ public:
void beginDragWithFiles(const CppArgumentList&, CppVariant*);
CppVariant dragMode;
+ void addTouchPoint(const CppArgumentList&, CppVariant*);
+ void cancelTouchPoint(const CppArgumentList&, CppVariant*);
+ void clearTouchPoints(const CppArgumentList&, CppVariant*);
+ void releaseTouchPoint(const CppArgumentList&, CppVariant*);
+ void setTouchModifier(const CppArgumentList&, CppVariant*);
+ void touchCancel(const CppArgumentList&, CppVariant*);
+ void touchEnd(const CppArgumentList&, CppVariant*);
+ void touchMove(const CppArgumentList&, CppVariant*);
+ void touchStart(const CppArgumentList&, CppVariant*);
+ void updateTouchPoint(const CppArgumentList&, CppVariant*);
+
// Unimplemented stubs
void contextClick(const CppArgumentList&, CppVariant*);
void enableDOMUIEventLogging(const CppArgumentList&, CppVariant*);
@@ -100,17 +109,17 @@ public:
private:
// Returns the test shell's webview.
- static WebKit::WebView* webview();
+ WebKit::WebView* webview();
// Returns true if dragMode is true.
bool isDragMode() { return dragMode.isBool() && dragMode.toBoolean(); }
// Sometimes we queue up mouse move and mouse up events for drag drop
// handling purposes. These methods dispatch the event.
- static void doMouseMove(const WebKit::WebMouseEvent&);
- static void doMouseUp(const WebKit::WebMouseEvent&);
+ void doMouseMove(const WebKit::WebMouseEvent&);
+ void doMouseUp(const WebKit::WebMouseEvent&);
static void doLeapForward(int milliseconds);
- static void replaySavedEvents();
+ void replaySavedEvents();
// Helper to return the button type given a button code
static WebKit::WebMouseEvent::Button getButtonTypeFromButtonNumber(int);
@@ -125,10 +134,13 @@ private:
void updateClickCountForButton(WebKit::WebMouseEvent::Button);
+ // Compose a touch event from the current touch points and send it.
+ void sendCurrentTouchEvent(const WebKit::WebInputEvent::Type);
+
ScopedRunnableMethodFactory<EventSender> m_methodFactory;
// Non-owning pointer. The EventSender is owned by the TestShell.
- static TestShell* testShell;
+ TestShell* m_shell;
// Location of last mouseMoveTo event.
static WebKit::WebPoint lastMousePos;
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index 21b168c..4413ff2 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -41,6 +41,7 @@
#include "public/WebFrame.h"
#include "public/WebInputElement.h"
#include "public/WebKit.h"
+#include "public/WebNotificationPresenter.h"
#include "public/WebScriptSource.h"
#include "public/WebSecurityPolicy.h"
#include "public/WebSettings.h"
@@ -48,11 +49,13 @@
#include "public/WebURL.h"
#include "public/WebView.h"
#include "webkit/support/webkit_support.h"
+#include <wtf/text/WTFString.h>
#if OS(WINDOWS)
#include <wtf/OwnArrayPtr.h>
#endif
+using namespace WebCore;
using namespace WebKit;
using namespace std;
@@ -90,10 +93,12 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("setCloseRemainingWindowsWhenComplete", &LayoutTestController::setCloseRemainingWindowsWhenComplete);
bindMethod("objCIdentityIsEqual", &LayoutTestController::objCIdentityIsEqual);
bindMethod("setAlwaysAcceptCookies", &LayoutTestController::setAlwaysAcceptCookies);
+ bindMethod("showWebInspector", &LayoutTestController::showWebInspector);
bindMethod("setWindowIsKey", &LayoutTestController::setWindowIsKey);
bindMethod("setTabKeyCyclesThroughElements", &LayoutTestController::setTabKeyCyclesThroughElements);
bindMethod("setUserStyleSheetLocation", &LayoutTestController::setUserStyleSheetLocation);
bindMethod("setUserStyleSheetEnabled", &LayoutTestController::setUserStyleSheetEnabled);
+ bindMethod("setAuthorAndUserStylesEnabled", &LayoutTestController::setAuthorAndUserStylesEnabled);
bindMethod("pathToLocalResource", &LayoutTestController::pathToLocalResource);
bindMethod("addFileToPasteboardOnDrag", &LayoutTestController::addFileToPasteboardOnDrag);
bindMethod("execCommand", &LayoutTestController::execCommand);
@@ -109,18 +114,23 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("disableImageLoading", &LayoutTestController::disableImageLoading);
bindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEnabled);
bindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDelegate);
+ bindMethod("setScrollbarPolicy", &LayoutTestController::setScrollbarPolicy);
bindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelegate);
+ bindMethod("setWillSendRequestClearHeader", &LayoutTestController::setWillSendRequestClearHeader);
bindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::setWillSendRequestReturnsNullOnRedirect);
bindMethod("setWillSendRequestReturnsNull", &LayoutTestController::setWillSendRequestReturnsNull);
bindMethod("addOriginAccessWhitelistEntry", &LayoutTestController::addOriginAccessWhitelistEntry);
+ bindMethod("removeOriginAccessWhitelistEntry", &LayoutTestController::removeOriginAccessWhitelistEntry);
bindMethod("clearAllDatabases", &LayoutTestController::clearAllDatabases);
bindMethod("setDatabaseQuota", &LayoutTestController::setDatabaseQuota);
bindMethod("setPOSIXLocale", &LayoutTestController::setPOSIXLocale);
bindMethod("counterValueForElementById", &LayoutTestController::counterValueForElementById);
bindMethod("addUserScript", &LayoutTestController::addUserScript);
+ bindMethod("addUserStyleSheet", &LayoutTestController::addUserStyleSheet);
bindMethod("pageNumberForElementById", &LayoutTestController::pageNumberForElementById);
bindMethod("numberOfPages", &LayoutTestController::numberOfPages);
bindMethod("dumpSelectionRect", &LayoutTestController::dumpSelectionRect);
+ bindMethod("grantDesktopNotificationPermission", &LayoutTestController::grantDesktopNotificationPermission);
// The following are stubs.
bindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive);
@@ -135,6 +145,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("accessStoredWebScriptObject", &LayoutTestController::accessStoredWebScriptObject);
bindMethod("objCClassNameOf", &LayoutTestController::objCClassNameOf);
bindMethod("addDisallowedURL", &LayoutTestController::addDisallowedURL);
+ bindMethod("callShouldCloseOnWebView", &LayoutTestController::callShouldCloseOnWebView);
bindMethod("setCallCloseOnWebViews", &LayoutTestController::setCallCloseOnWebViews);
bindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrowsingEnabled);
bindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDashboardCompatibilityMode);
@@ -440,11 +451,11 @@ void LayoutTestController::reset()
if (m_shell) {
m_shell->webView()->setZoomLevel(false, 0);
m_shell->webView()->setTabKeyCyclesThroughElements(true);
-#if defined(OS_LINUX)
+#if !OS(DARWIN) && !OS(WINDOWS) // Actually, TOOLKIT_GTK
// (Constants copied because we can't depend on the header that defined
// them from this file.)
m_shell->webView()->setSelectionColors(0xff1e90ff, 0xff000000, 0xffc8c8c8, 0xff323232);
-#endif // defined(OS_LINUX)
+#endif
m_shell->webView()->removeAllUserContent();
}
m_dumpAsText = false;
@@ -468,7 +479,7 @@ void LayoutTestController::reset()
m_webHistoryItemCount.set(0);
webkit_support::SetAcceptAllCookies(false);
- WebSecurityPolicy::resetOriginAccessWhiteLists();
+ WebSecurityPolicy::resetOriginAccessWhitelists();
// Reset the default quota for each origin to 5MB
webkit_support::SetDatabaseQuota(5 * 1024 * 1024);
@@ -532,6 +543,12 @@ void LayoutTestController::setAlwaysAcceptCookies(const CppArgumentList& argumen
result->setNull();
}
+void LayoutTestController::showWebInspector(const CppArgumentList&, CppVariant* result)
+{
+ m_shell->showDevTools();
+ result->setNull();
+}
+
void LayoutTestController::setWindowIsKey(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool())
@@ -555,6 +572,13 @@ void LayoutTestController::setUserStyleSheetLocation(const CppArgumentList& argu
result->setNull();
}
+void LayoutTestController::setAuthorAndUserStylesEnabled(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() > 0 && arguments[0].isBool())
+ m_shell->webView()->settings()->setAuthorAndUserStylesEnabled(arguments[0].value.boolValue);
+ result->setNull();
+}
+
void LayoutTestController::execCommand(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -599,6 +623,13 @@ void LayoutTestController::setUseDashboardCompatibilityMode(const CppArgumentLis
result->setNull();
}
+void LayoutTestController::setScrollbarPolicy(const CppArgumentList&, CppVariant* result)
+{
+ // FIXME: implement.
+ // Currently only has a non-null implementation on QT.
+ result->setNull();
+}
+
void LayoutTestController::setCustomPolicyDelegate(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool()) {
@@ -618,6 +649,16 @@ void LayoutTestController::waitForPolicyDelegate(const CppArgumentList&, CppVari
result->setNull();
}
+void LayoutTestController::setWillSendRequestClearHeader(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() > 0 && arguments[0].isString()) {
+ string header = arguments[0].toString();
+ if (!header.empty())
+ m_shell->webViewHost()->addClearHeader(String::fromUTF8(header.c_str()));
+ }
+ result->setNull();
+}
+
void LayoutTestController::setWillSendRequestReturnsNullOnRedirect(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool())
@@ -734,7 +775,7 @@ bool LayoutTestController::elementDoesAutoCompleteForElementWithId(const WebStri
if (element.isNull() || !element.hasTagName("input"))
return false;
- WebInputElement inputElement = element.toElement<WebInputElement>();
+ WebInputElement inputElement = element.to<WebInputElement>();
return inputElement.autoComplete();
}
@@ -800,6 +841,21 @@ void LayoutTestController::setIconDatabaseEnabled(const CppArgumentList&, CppVar
result->setNull();
}
+void LayoutTestController::callShouldCloseOnWebView(const CppArgumentList&, CppVariant* result)
+{
+ result->set(m_shell->webView()->dispatchBeforeUnloadEvent());
+}
+
+void LayoutTestController::grantDesktopNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() != 1 || !arguments[0].isString()) {
+ result->set(false);
+ return;
+ }
+ m_shell->notificationPresenter()->grantPermission(WebString::fromUTF8(arguments[0].toString()));
+ result->set(true);
+}
+
//
// Unimplemented stubs
//
@@ -1052,10 +1108,30 @@ void LayoutTestController::addOriginAccessWhitelistEntry(const CppArgumentList&
if (!url.isValid())
return;
- WebSecurityPolicy::whiteListAccessFromOrigin(url,
- WebString::fromUTF8(arguments[1].toString()),
- WebString::fromUTF8(arguments[2].toString()),
- arguments[3].toBoolean());
+ WebSecurityPolicy::addOriginAccessWhitelistEntry(
+ url,
+ WebString::fromUTF8(arguments[1].toString()),
+ WebString::fromUTF8(arguments[2].toString()),
+ arguments[3].toBoolean());
+}
+
+void LayoutTestController::removeOriginAccessWhitelistEntry(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ if (arguments.size() != 4 || !arguments[0].isString() || !arguments[1].isString()
+ || !arguments[2].isString() || !arguments[3].isBool())
+ return;
+
+ WebKit::WebURL url(GURL(arguments[0].toString()));
+ if (!url.isValid())
+ return;
+
+ WebSecurityPolicy::removeOriginAccessWhitelistEntry(
+ url,
+ WebString::fromUTF8(arguments[1].toString()),
+ WebString::fromUTF8(arguments[2].toString()),
+ arguments[3].toBoolean());
}
void LayoutTestController::clearAllDatabases(const CppArgumentList& arguments, CppVariant* result)
@@ -1183,7 +1259,15 @@ void LayoutTestController::forceRedSelectionColors(const CppArgumentList& argume
void LayoutTestController::addUserScript(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
- if (arguments.size() < 1 || !arguments[0].isString() || !arguments[1].isBool())
+ if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isBool())
return;
m_shell->webView()->addUserScript(WebString::fromUTF8(arguments[0].toString()), arguments[1].toBoolean());
}
+
+void LayoutTestController::addUserStyleSheet(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 1 || !arguments[0].isString())
+ return;
+ m_shell->webView()->addUserStyleSheet(WebString::fromUTF8(arguments[0].toString()));
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index ca8b014..e7a48e2 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -127,6 +127,9 @@ public:
// Changes the cookie policy from the default to allow all cookies.
void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*);
+ // Shows DevTools window.
+ void showWebInspector(const CppArgumentList&, CppVariant*);
+
// Gives focus to the window.
void setWindowIsKey(const CppArgumentList&, CppVariant*);
@@ -139,11 +142,16 @@ public:
void setUserStyleSheetEnabled(const CppArgumentList&, CppVariant*);
void setUserStyleSheetLocation(const CppArgumentList&, CppVariant*);
+ // Passes this preference through to WebSettings.
+ void setAuthorAndUserStylesEnabled(const CppArgumentList&, CppVariant*);
+
// Puts Webkit in "dashboard compatibility mode", which is used in obscure
// Mac-only circumstances. It's not really necessary, and will most likely
// never be used by Chrome, but some layout tests depend on its presence.
void setUseDashboardCompatibilityMode(const CppArgumentList&, CppVariant*);
+ void setScrollbarPolicy(const CppArgumentList&, CppVariant*);
+
// Causes navigation actions just printout the intended navigation instead
// of taking you to the page. This is used for cases like mailto, where you
// don't actually want to open the mail program.
@@ -152,6 +160,9 @@ public:
// Delays completion of the test until the policy delegate runs.
void waitForPolicyDelegate(const CppArgumentList&, CppVariant*);
+ // Causes WillSendRequest to clear certain headers.
+ void setWillSendRequestClearHeader(const CppArgumentList&, CppVariant*);
+
// Causes WillSendRequest to block redirects.
void setWillSendRequestReturnsNullOnRedirect(const CppArgumentList&, CppVariant*);
@@ -195,6 +206,9 @@ public:
void dumpSelectionRect(const CppArgumentList&, CppVariant*);
+ // Grants permission for desktop notifications to an origin
+ void grantDesktopNotificationPermission(const CppArgumentList&, CppVariant*);
+
// The following are only stubs. TODO(pamg): Implement any of these that
// are needed to pass the layout tests.
void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
@@ -210,6 +224,7 @@ public:
void accessStoredWebScriptObject(const CppArgumentList&, CppVariant*);
void objCClassNameOf(const CppArgumentList&, CppVariant*);
void addDisallowedURL(const CppArgumentList&, CppVariant*);
+ void callShouldCloseOnWebView(const CppArgumentList&, CppVariant*);
void setCallCloseOnWebViews(const CppArgumentList&, CppVariant*);
void setPrivateBrowsingEnabled(const CppArgumentList&, CppVariant*);
@@ -228,8 +243,9 @@ public:
// that case (as the Mac does).
void fallbackMethod(const CppArgumentList&, CppVariant*);
- // Allows layout tests to call SecurityOrigin::addOriginAccessWhitelistEntry().
+ // Allows layout tests to manage origins' whitelisting.
void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
+ void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
// Clears all databases.
void clearAllDatabases(const CppArgumentList&, CppVariant*);
@@ -259,8 +275,9 @@ public:
// Forces the selection colors for testing under Linux.
void forceRedSelectionColors(const CppArgumentList&, CppVariant*);
- // Adds a user script to be injected into new documents.
+ // Adds a user script or user style sheet to be injected into new documents.
void addUserScript(const CppArgumentList&, CppVariant*);
+ void addUserStyleSheet(const CppArgumentList&, CppVariant*);
public:
// The following methods are not exposed to JavaScript.
diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
new file mode 100644
index 0000000..86903be
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NotificationPresenter.h"
+
+#include "googleurl/src/gurl.h"
+#include "public/WebNotification.h"
+#include "public/WebNotificationPermissionCallback.h"
+#include "public/WebSecurityOrigin.h"
+#include "public/WebString.h"
+#include "public/WebURL.h"
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+void NotificationPresenter::grantPermission(const WebString& origin)
+{
+ // Make sure it's in the form of an origin.
+ GURL url(origin);
+ m_allowedOrigins.add(String(url.GetOrigin().spec().c_str()));
+}
+
+// The output from all these methods matches what DumpRenderTree produces.
+bool NotificationPresenter::show(const WebNotification& notification)
+{
+ if (!notification.replaceId().isEmpty()) {
+ String replaceId(notification.replaceId().data(), notification.replaceId().length());
+ if (m_replacements.find(replaceId) != m_replacements.end())
+ printf("REPLACING NOTIFICATION %s\n",
+ m_replacements.find(replaceId)->second.utf8().data());
+
+ WebString identifier = notification.isHTML() ?
+ notification.url().spec().utf16() : notification.title();
+ m_replacements.set(replaceId, String(identifier.data(), identifier.length()));
+ }
+
+ if (notification.isHTML()) {
+ printf("DESKTOP NOTIFICATION: contents at %s\n",
+ notification.url().spec().data());
+ } else {
+ printf("DESKTOP NOTIFICATION:%s icon %s, title %s, text %s\n",
+ notification.dir() == "rtl" ? "(RTL)" : "",
+ notification.iconURL().isEmpty() ? "" :
+ notification.iconURL().spec().data(),
+ notification.title().isEmpty() ? "" :
+ notification.title().utf8().data(),
+ notification.body().isEmpty() ? "" :
+ notification.body().utf8().data());
+ }
+
+ WebNotification eventTarget(notification);
+ eventTarget.dispatchDisplayEvent();
+ return true;
+}
+
+void NotificationPresenter::cancel(const WebNotification& notification)
+{
+ WebString identifier;
+ if (notification.isHTML())
+ identifier = notification.url().spec().utf16();
+ else
+ identifier = notification.title();
+
+ printf("DESKTOP NOTIFICATION CLOSED: %s\n", identifier.utf8().data());
+ WebNotification eventTarget(notification);
+ eventTarget.dispatchCloseEvent(false);
+}
+
+void NotificationPresenter::objectDestroyed(const WebKit::WebNotification& notification)
+{
+ // Nothing to do. Not storing the objects.
+}
+
+WebNotificationPresenter::Permission NotificationPresenter::checkPermission(const WebURL& url)
+{
+ // Check with the layout test controller
+ String origin = String(static_cast<GURL>(url).GetOrigin().spec().c_str());
+ bool allowed = m_allowedOrigins.find(origin) != m_allowedOrigins.end();
+ return allowed ? WebNotificationPresenter::PermissionAllowed
+ : WebNotificationPresenter::PermissionDenied;
+}
+
+void NotificationPresenter::requestPermission(
+ const WebSecurityOrigin& origin,
+ WebNotificationPermissionCallback* callback)
+{
+ printf("DESKTOP NOTIFICATION PERMISSION REQUESTED: %s\n",
+ origin.toString().utf8().data());
+ callback->permissionRequestComplete();
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
new file mode 100644
index 0000000..f30862f
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NotificationPresenter_h
+#define NotificationPresenter_h
+
+#include "public/WebNotificationPresenter.h"
+#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
+
+class TestShell;
+
+// A class that implements WebNotificationPresenter for DRT.
+class NotificationPresenter : public WebKit::WebNotificationPresenter {
+public:
+ explicit NotificationPresenter(TestShell* shell) : m_shell(shell) {}
+
+ // Called by the LayoutTestController to simulate a user granting permission.
+ void grantPermission(const WebKit::WebString& origin);
+
+ // WebKit::WebNotificationPresenter interface
+ virtual bool show(const WebKit::WebNotification&);
+ virtual void cancel(const WebKit::WebNotification&);
+ virtual void objectDestroyed(const WebKit::WebNotification&);
+ virtual Permission checkPermission(const WebKit::WebURL&);
+ virtual void requestPermission(const WebKit::WebSecurityOrigin&, WebKit::WebNotificationPermissionCallback*);
+
+ void reset() { m_allowedOrigins.clear(); }
+
+private:
+ // Non-owned pointer. The NotificationPresenter is owned by the test shell.
+ TestShell* m_shell;
+
+ // Set of allowed origins.
+ HashSet<WebCore::String> m_allowedOrigins;
+
+ // Map of active replacement IDs to the titles of those notifications
+ HashMap<WebCore::String, WebCore::String> m_replacements;
+};
+
+#endif // NotificationPresenter_h
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
index e4229fe..24a895a 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
@@ -85,6 +85,7 @@ TestShell::TestShell()
m_eventSender.set(new EventSender(this));
m_plainTextController.set(new PlainTextController());
m_textInputController.set(new TextInputController(this));
+ m_notificationPresenter.set(new NotificationPresenter(this));
m_webViewHost = createWebView();
m_webView = m_webViewHost->webView();
@@ -131,6 +132,7 @@ void TestShell::resetWebSettings(WebView& webView)
settings->setSerifFontFamily(serif);
settings->setStandardFontFamily(serif);
settings->setFixedFontFamily(WebString::fromUTF8("Courier"));
+ settings->setSansSerifFontFamily(WebString::fromUTF8("Helvetica"));
settings->setDefaultTextEncodingName(WebString::fromUTF8("ISO-8859-1"));
settings->setDefaultFontSize(16);
@@ -175,6 +177,7 @@ void TestShell::resetWebSettings(WebView& webView)
void TestShell::runFileTest(const TestParams& params)
{
+ ASSERT(params.testUrl.isValid());
m_testIsPreparing = true;
m_params = params;
string testUrl = m_params.testUrl.spec();
@@ -212,6 +215,7 @@ void TestShell::resetTestController()
m_layoutTestController->reset();
m_eventSender->reset();
m_webViewHost->reset();
+ m_notificationPresenter->reset();
}
void TestShell::loadURL(const WebURL& url)
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h
index c6a5b2e..283cbd4 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h
@@ -31,6 +31,7 @@
#include "AccessibilityController.h"
#include "EventSender.h"
#include "LayoutTestController.h"
+#include "NotificationPresenter.h"
#include "PlainTextController.h"
#include "TextInputController.h"
#include "WebViewHost.h"
@@ -43,6 +44,7 @@
namespace WebKit {
class WebFrame;
+class WebNotificationPresenter;
class WebPreferences;
class WebView;
class WebURL;
@@ -74,7 +76,9 @@ public:
// Returns the host for the main WebView.
WebViewHost* webViewHost() const { return m_webViewHost; }
LayoutTestController* layoutTestController() const { return m_layoutTestController.get(); }
+ EventSender* eventSender() const { return m_eventSender.get(); }
AccessibilityController* accessibilityController() const { return m_accessibilityController.get(); }
+ NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); }
void bindJSObjectsToWindow(WebKit::WebFrame*);
void runFileTest(const TestParams&);
@@ -115,6 +119,7 @@ public:
void closeRemainingWindows();
int windowCount();
static void resizeWindowForTest(WebViewHost*, const WebKit::WebURL&);
+ void showDevTools() {} // FIXME: imeplement this.
static const int virtualWindowBorder = 3;
@@ -135,6 +140,7 @@ private:
OwnPtr<LayoutTestController*> m_layoutTestController;
OwnPtr<PlainTextController*> m_plainTextController;
OwnPtr<TextInputController*> m_textInputController;
+ OwnPtr<NotificationPresenter*> m_notificationPresenter;
TestParams m_params;
// List of all windows in this process.
diff --git a/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h b/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h
index f28cc20..9470804 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestWebWorker.h
@@ -80,6 +80,7 @@ public:
virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient*) { return 0; }
virtual WebKit::WebNotificationPresenter* notificationPresenter() { return 0; }
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(WebKit::WebApplicationCacheHostClient*) { return 0; }
+ virtual bool allowDatabase(WebKit::WebFrame*, const WebKit::WebString&, const WebKit::WebString&, unsigned long) { return true; }
private:
~TestWebWorker() {}
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
index 6ea1de1..4761b1a 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -52,10 +52,12 @@
#include "public/WebURLRequest.h"
#include "public/WebURLResponse.h"
#include "public/WebView.h"
+#include "public/WebWindowFeatures.h"
#include "skia/ext/platform_canvas.h"
#include "webkit/support/webkit_support.h"
#include <wtf/Assertions.h>
+using namespace WebCore;
using namespace WebKit;
using namespace skia;
using namespace std;
@@ -250,14 +252,19 @@ static string textAffinityDescription(WebTextAffinity affinity)
// WebViewClient -------------------------------------------------------------
-WebView* WebViewHost::createView(WebFrame*)
+WebView* WebViewHost::createView(WebFrame* creator)
+{
+ return createView(creator, WebWindowFeatures());
+}
+
+WebView* WebViewHost::createView(WebFrame*, const WebWindowFeatures&)
{
if (!layoutTestController()->canOpenWindows())
return 0;
return m_shell->createWebView()->webView();
}
-WebWidget* WebViewHost::createPopupMenu(bool)
+WebWidget* WebViewHost::createPopupMenu(WebPopupType)
{
return 0;
}
@@ -267,9 +274,9 @@ WebWidget* WebViewHost::createPopupMenu(const WebPopupMenuInfo&)
return 0;
}
-WebStorageNamespace* WebViewHost::createSessionStorageNamespace()
+WebStorageNamespace* WebViewHost::createSessionStorageNamespace(unsigned quota)
{
- return WebKit::WebStorageNamespace::createSessionStorageNamespace();
+ return WebKit::WebStorageNamespace::createSessionStorageNamespace(quota);
}
void WebViewHost::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine)
@@ -481,7 +488,7 @@ void WebViewHost::setStatusText(const WebString& text)
printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text.utf8().data());
}
-void WebViewHost::startDragging(const WebPoint& mouseCoords, const WebDragData& data, WebDragOperationsMask mask)
+void WebViewHost::startDragging(const WebDragData& data, WebDragOperationsMask mask, const WebImage&, const WebPoint&)
{
WebDragData mutableDragData = data;
if (layoutTestController()->shouldAddFileToPasteboard()) {
@@ -491,7 +498,7 @@ void WebViewHost::startDragging(const WebPoint& mouseCoords, const WebDragData&
// When running a test, we need to fake a drag drop operation otherwise
// Windows waits for real mouse events to know when the drag is over.
- EventSender::doDragDrop(mouseCoords, mutableDragData, mask);
+ m_shell->eventSender()->doDragDrop(mutableDragData, mask);
}
void WebViewHost::navigateBackForwardSoon(int offset)
@@ -515,6 +522,11 @@ void WebViewHost::focusAccessibilityObject(const WebAccessibilityObject& object)
m_shell->accessibilityController()->setFocusedElement(object);
}
+WebNotificationPresenter* WebViewHost::notificationPresenter()
+{
+ return m_shell->notificationPresenter();
+}
+
// WebWidgetClient -----------------------------------------------------------
void WebViewHost::didInvalidateRect(const WebRect& rect)
@@ -629,6 +641,11 @@ WebMediaPlayer* WebViewHost::createMediaPlayer(WebFrame* frame, WebMediaPlayerCl
return webkit_support::CreateMediaPlayer(frame, client);
}
+WebApplicationCacheHost* WebViewHost::createApplicationCacheHost(WebFrame* frame, WebApplicationCacheHostClient* client)
+{
+ return webkit_support::CreateApplicationCacheHost(frame, client);
+}
+
bool WebViewHost::allowPlugins(WebFrame* frame, bool enabledPerSettings)
{
return enabledPerSettings;
@@ -906,6 +923,10 @@ void WebViewHost::willSendRequest(WebFrame*, unsigned identifier, WebURLRequest&
return;
}
+ HashSet<String>::const_iterator end = m_clearHeaders.end();
+ for (HashSet<String>::const_iterator header = m_clearHeaders.begin(); header != end; ++header)
+ request.clearHTTPHeaderField(WebString(header->characters(), header->length()));
+
// Set the new substituted URL.
request.setURL(webkit_support::RewriteLayoutTestsURL(request.url().spec()));
}
@@ -1115,7 +1136,7 @@ void WebViewHost::updateAddressBar(WebView* webView)
if (!dataSource)
return;
- setAddressBarURL(dataSource->request().firstPartyForCookies());
+ setAddressBarURL(dataSource->request().url());
}
void WebViewHost::locationChangeDone(WebFrame* frame)
@@ -1168,6 +1189,7 @@ void WebViewHost::updateURL(WebFrame* frame)
entry->setContentState(historyItem);
navigationController()->didNavigateToEntry(entry.release());
+ updateAddressBar(frame->view());
m_lastPageIdUpdated = max(m_lastPageIdUpdated, m_pageId);
}
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
index c5bed7a..5227b28 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
@@ -37,15 +37,18 @@
#include "public/WebFrameClient.h"
#include "public/WebViewClient.h"
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
class LayoutTestController;
class TestShell;
namespace WebKit {
class WebFrame;
class WebURL;
-struct WebURLError;
struct WebRect;
+struct WebURLError;
+struct WebWindowFeatures;
}
namespace skia {
class PlatformCanvas;
@@ -79,14 +82,18 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
void loadURLForFrame(const WebKit::WebURL&, const WebKit::WebString& frameName);
TestNavigationController* navigationController() { return m_navigationController.get(); }
+ void addClearHeader(const WebCore::String& header) { m_clearHeaders.add(header); }
+ const HashSet<WebCore::String>& clearHeaders() const { return m_clearHeaders; }
+
// NavigationHost
virtual bool navigate(const TestNavigationEntry&, bool reload);
// WebKit::WebViewClient
virtual WebKit::WebView* createView(WebKit::WebFrame*);
- virtual WebKit::WebWidget* createPopupMenu(bool activatable);
+ virtual WebKit::WebView* createView(WebKit::WebFrame*, const WebKit::WebWindowFeatures&);
+ virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType);
virtual WebKit::WebWidget* createPopupMenu(const WebKit::WebPopupMenuInfo&);
- virtual WebKit::WebStorageNamespace* createSessionStorageNamespace();
+ virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(unsigned quota);
virtual void didAddMessageToConsole(const WebKit::WebConsoleMessage&, const WebKit::WebString& sourceName, unsigned sourceLine);
virtual void didStartLoading();
virtual void didStopLoading();
@@ -112,11 +119,12 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual bool runModalBeforeUnloadDialog(WebKit::WebFrame*, const WebKit::WebString&);
virtual void showContextMenu(WebKit::WebFrame*, const WebKit::WebContextMenuData&);
virtual void setStatusText(const WebKit::WebString&);
- virtual void startDragging(const WebKit::WebPoint&, const WebKit::WebDragData&, WebKit::WebDragOperationsMask);
+ virtual void startDragging(const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebImage&, const WebKit::WebPoint&);
virtual void navigateBackForwardSoon(int offset);
virtual int historyBackListCount();
virtual int historyForwardListCount();
virtual void focusAccessibilityObject(const WebKit::WebAccessibilityObject&);
+ virtual WebKit::WebNotificationPresenter* notificationPresenter();
// WebKit::WebWidgetClient
virtual void didInvalidateRect(const WebKit::WebRect&);
@@ -137,7 +145,8 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual WebKit::WebPlugin* createPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&);
virtual WebKit::WebWorker* createWorker(WebKit::WebFrame*, WebKit::WebWorkerClient*);
virtual WebKit::WebMediaPlayer* createMediaPlayer(WebKit::WebFrame*, WebKit::WebMediaPlayerClient*);
- virtual bool allowPlugins(WebKit::WebFrame*, bool enabledPerSettings);
+ virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(WebKit::WebFrame*, WebKit::WebApplicationCacheHostClient*);
+ virtual bool allowPlugins(WebKit::WebFrame*, bool enabledPerSettings);
virtual bool allowImages(WebKit::WebFrame*, bool enabledPerSettings);
virtual void loadURLExternally(WebKit::WebFrame*, const WebKit::WebURLRequest&, WebKit::WebNavigationPolicy);
virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
@@ -248,6 +257,9 @@ private:
// true if we want to enable selection of trailing whitespaces
bool m_selectTrailingWhitespaceEnabled;
+ // Set of headers to clear in willSendRequest.
+ HashSet<WebCore::String> m_clearHeaders;
+
// true if we should block any redirects
bool m_blocksRedirects;