summaryrefslogtreecommitdiff
path: root/Tools/DumpRenderTree
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:09:45 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:10:13 +0100
commit470286ecfe79d59df14944e5b5d34630fc739391 (patch)
tree43983212872e06cebefd2ae474418fa2908ca54c /Tools/DumpRenderTree
parent23037105e948c2065da5a937d3a2396b0ff45c1e (diff)
downloadqtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Tools/DumpRenderTree')
-rw-r--r--Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp7
-rw-r--r--Tools/DumpRenderTree/DumpRenderTree.gypi2
-rw-r--r--Tools/DumpRenderTree/blackberry/EventSender.cpp20
-rw-r--r--Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp25
-rw-r--r--Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp21
-rw-r--r--Tools/DumpRenderTree/chromium/DRTTestRunner.cpp913
-rw-r--r--Tools/DumpRenderTree/chromium/DRTTestRunner.h198
-rw-r--r--Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp22
-rw-r--r--Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h2
-rw-r--r--Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp9
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h143
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp10
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp8
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp7
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h6
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h8
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h8
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp6
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h13
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp708
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h145
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h4
-rw-r--r--Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp223
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.cpp29
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.h8
-rw-r--r--Tools/DumpRenderTree/chromium/TestWebPlugin.cpp1
-rw-r--r--Tools/DumpRenderTree/chromium/WebPreferences.cpp6
-rw-r--r--Tools/DumpRenderTree/chromium/WebPreferences.h2
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp226
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.h15
-rw-r--r--Tools/DumpRenderTree/efl/DumpRenderTree.cpp1
-rw-r--r--Tools/DumpRenderTree/efl/EventSender.cpp1
-rw-r--r--Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp2
-rw-r--r--Tools/DumpRenderTree/mac/DumpRenderTree.mm5
-rw-r--r--Tools/DumpRenderTree/win/EventSender.cpp45
42 files changed, 1472 insertions, 1405 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
index 56aeab732..cc8333209 100644
--- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
+++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
@@ -83,6 +83,7 @@
'dependencies': [
'TestRunner_resources',
'<(source_dir)/WebKit/chromium/WebKit.gyp:webkit',
+ '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_wtf_support',
'<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_test_support',
'<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',
'<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',
@@ -116,12 +117,6 @@
'<(source_dir)/WebKit/chromium/public/gtk',
],
}],
- ['inside_chromium_build==1 and component=="shared_library"', {
- 'sources': [
- '<(source_dir)/WebKit/chromium/src/ChromiumCurrentTime.cpp',
- '<(source_dir)/WebKit/chromium/src/ChromiumThreading.cpp',
- ],
- }],
],
},
{
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi
index dd768d049..ac4d2a622 100644
--- a/Tools/DumpRenderTree/DumpRenderTree.gypi
+++ b/Tools/DumpRenderTree/DumpRenderTree.gypi
@@ -71,6 +71,7 @@
'chromium/TestRunner/public/WebEventSender.h',
'chromium/TestRunner/public/WebTask.h',
'chromium/TestRunner/public/WebTestInterfaces.h',
+ 'chromium/TestRunner/public/WebTestProxy.h',
'chromium/TestRunner/src/AccessibilityControllerChromium.cpp',
'chromium/TestRunner/src/AccessibilityControllerChromium.h',
'chromium/TestRunner/src/AccessibilityUIElementChromium.cpp',
@@ -95,6 +96,7 @@
'chromium/TestRunner/src/WebEventSender.cpp',
'chromium/TestRunner/src/WebTask.cpp',
'chromium/TestRunner/src/WebTestInterfaces.cpp',
+ 'chromium/TestRunner/src/WebTestProxy.cpp',
],
'test_plugin_files': [
'TestNetscapePlugIn/PluginObject.cpp',
diff --git a/Tools/DumpRenderTree/blackberry/EventSender.cpp b/Tools/DumpRenderTree/blackberry/EventSender.cpp
index ab7f808f8..0f76914a2 100644
--- a/Tools/DumpRenderTree/blackberry/EventSender.cpp
+++ b/Tools/DumpRenderTree/blackberry/EventSender.cpp
@@ -131,11 +131,14 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
charCode = KEYCODE_UP;
else if (JSStringIsEqualToUTF8CString(character, "downArrow"))
charCode = KEYCODE_DOWN;
- else if (JSStringIsEqualToUTF8CString(character, "pageUp")
- || JSStringIsEqualToUTF8CString(character, "pageDown")
- || JSStringIsEqualToUTF8CString(character, "home")
- || JSStringIsEqualToUTF8CString(character, "end"))
- return JSValueMakeUndefined(context);
+ else if (JSStringIsEqualToUTF8CString(character, "pageUp"))
+ charCode = KEYCODE_PG_UP;
+ else if (JSStringIsEqualToUTF8CString(character, "pageDown"))
+ charCode = KEYCODE_PG_DOWN;
+ else if (JSStringIsEqualToUTF8CString(character, "home"))
+ charCode = KEYCODE_HOME;
+ else if (JSStringIsEqualToUTF8CString(character, "end"))
+ charCode = KEYCODE_END;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
charCode = KEYCODE_BACKSPACE;
else {
@@ -178,7 +181,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
if (needsCtrlKeyModifier)
modifiers |= KEYMOD_CTRL;
- page->keyEvent(BlackBerry::Platform::KeyboardEvent(charCode, BlackBerry::Platform::KeyboardEvent::KeyChar, modifiers));
+ page->keyEvent(BlackBerry::Platform::KeyboardEvent(charCode, BlackBerry::Platform::KeyboardEvent::KeyDown, modifiers));
+ page->keyEvent(BlackBerry::Platform::KeyboardEvent(charCode, BlackBerry::Platform::KeyboardEvent::KeyUp, modifiers));
return JSValueMakeUndefined(context);
}
@@ -394,8 +398,8 @@ static JSClassRef getClass(JSContextRef context)
if (!eventSenderClass) {
JSClassDefinition classDefinition = {
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
classDefinition.staticFunctions = staticFunctions;
classDefinition.staticValues = staticValues;
diff --git a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp
index 420cdfbb8..5a1b89a4c 100644
--- a/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp
+++ b/Tools/DumpRenderTree/blackberry/PixelDumpSupportBlackBerry.cpp
@@ -20,6 +20,11 @@
#include "PixelDumpSupportBlackBerry.h"
#include "BackingStore.h"
+#include "BlackBerryPlatformExecutableMessage.h"
+#include "BlackBerryPlatformGraphics.h"
+#include "BlackBerryPlatformGraphicsContext.h"
+#include "BlackBerryPlatformGraphicsImpl.h"
+#include "BlackBerryPlatformMessageClient.h"
#include "DumpRenderTreeBlackBerry.h"
#include "PNGImageEncoder.h"
#include "PixelDumpSupport.h"
@@ -37,6 +42,11 @@ using namespace BlackBerry::WebKit;
using namespace BlackBerry;
using namespace WTF;
+void readPixelsUserInterfaceThread(BlackBerry::Platform::Graphics::PlatformGraphicsContext* context, const BlackBerry::Platform::IntRect& srcRect, unsigned char* pixels)
+{
+ context->readPixels(srcRect, pixels, false, false);
+}
+
PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool /*incrementalRepaint*/, bool /*sweepHorizontally*/, bool /*drawSelectionRect*/)
{
Platform::Graphics::Window* window = DumpRenderTree::currentInstance()->page()->client()->window();
@@ -71,14 +81,21 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool /*onscreen*/, bool
const unsigned char* windowPixels = 0;
if (!contentsBitmap.empty()) {
- SkAutoLockPixels lock(contentsBitmap);
windowPixels = static_cast<const unsigned char*>(contentsBitmap.getPixels());
+ if (windowPixels)
+ memcpy(data, windowPixels, windowSize.width() * windowSize.height() * 4);
}
#else
- const unsigned char* windowPixels = lockBufferBackingImage(window->buffer(), Platform::Graphics::ReadAccess);
+ BlackBerry::Platform::Graphics::Buffer* buffer = BlackBerry::Platform::Graphics::createBuffer(windowSize, BlackBerry::Platform::Graphics::TemporaryBuffer);
+ BlackBerry::Platform::Graphics::Drawable* drawable = BlackBerry::Platform::Graphics::lockBufferDrawable(buffer);
+ if (drawable) {
+ backingStore->drawContents(drawable, windowRect, windowSize);
+ BlackBerry::Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage(
+ BlackBerry::Platform::createFunctionCallMessage(&readPixelsUserInterfaceThread, drawable, windowRect, data));
+ BlackBerry::Platform::Graphics::releaseBufferDrawable(buffer);
+ }
+ BlackBerry::Platform::Graphics::destroyBuffer(buffer);
#endif
- memcpy(data, windowPixels, windowSize.width() * windowSize.height() * 4);
- Platform::Graphics::releaseBufferBackingImage(window->buffer());
return BitmapContext::createByAdoptingData(data, windowSize.width(), windowSize.height());
}
diff --git a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp
index c80a96ddb..f06f4a84c 100644
--- a/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp
+++ b/Tools/DumpRenderTree/blackberry/TestRunnerBlackBerry.cpp
@@ -402,7 +402,7 @@ unsigned TestRunner::numberOfActiveAnimations() const
return animationController->numberOfActiveAnimations(mainFrame->document());
}
-unsigned int TestRunner::workerThreadCount() const
+unsigned TestRunner::workerThreadCount() const
{
#if ENABLE_WORKERS
return WebCore::WorkerThread::workerThreadCount();
@@ -538,17 +538,17 @@ void TestRunner::setSpatialNavigationEnabled(bool enable)
void TestRunner::addOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
{
WebCore::SecurityPolicy::addOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)),
- jsStringRefToWebCoreString(destinationProtocol),
- jsStringRefToWebCoreString(destinationHost),
- allowDestinationSubdomains);
+ jsStringRefToWebCoreString(destinationProtocol),
+ jsStringRefToWebCoreString(destinationHost),
+ allowDestinationSubdomains);
}
void TestRunner::removeOriginAccessWhitelistEntry(JSStringRef sourceOrigin, JSStringRef destinationProtocol, JSStringRef destinationHost, bool allowDestinationSubdomains)
{
WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry(*WebCore::SecurityOrigin::createFromString(jsStringRefToWebCoreString(sourceOrigin)),
- jsStringRefToWebCoreString(destinationProtocol),
- jsStringRefToWebCoreString(destinationHost),
- allowDestinationSubdomains);
+ jsStringRefToWebCoreString(destinationProtocol),
+ jsStringRefToWebCoreString(destinationHost),
+ allowDestinationSubdomains);
}
void TestRunner::setAllowFileAccessFromFileURLs(bool enabled)
@@ -752,6 +752,13 @@ bool TestRunner::findString(JSContextRef context, JSStringRef target, JSObjectRe
options |= WebCore::StartInSelection;
}
+ // FIXME: we don't need to call WebPage::findNextString(), this is a workaround
+ // so that test platform/blackberry/editing/text-iterator/findString-markers.html can pass.
+
+ // Our layout tests assume find will wrap and highlight all matches.
+ BlackBerry::WebKit::DumpRenderTree::currentInstance()->page()->findNextString(nameStr.utf8().data(),
+ !(options & WebCore::Backwards), !(options & WebCore::CaseInsensitive), true /* wrap */, true /* highlightAllMatches */);
+
return mainFrame->page()->findString(nameStr, options);
}
diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
index dafafa181..2f8397bee 100644
--- a/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
+++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
@@ -111,7 +111,6 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
// they will use when called by JavaScript. The actual binding of those
// names to their methods will be done by calling bindToJavaScript() (defined
// by CppBoundClass, the parent to DRTTestRunner).
- bindMethod("addFileToPasteboardOnDrag", &DRTTestRunner::addFileToPasteboardOnDrag);
#if ENABLE(INPUT_SPEECH)
bindMethod("addMockSpeechInputResult", &DRTTestRunner::addMockSpeechInputResult);
bindMethod("setMockSpeechInputDumpRect", &DRTTestRunner::setMockSpeechInputDumpRect);
@@ -121,9 +120,6 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
bindMethod("setMockSpeechRecognitionError", &DRTTestRunner::setMockSpeechRecognitionError);
bindMethod("wasMockSpeechRecognitionAborted", &DRTTestRunner::wasMockSpeechRecognitionAborted);
#endif
- bindMethod("addOriginAccessWhitelistEntry", &DRTTestRunner::addOriginAccessWhitelistEntry);
- bindMethod("addUserScript", &DRTTestRunner::addUserScript);
- bindMethod("addUserStyleSheet", &DRTTestRunner::addUserStyleSheet);
bindMethod("clearAllDatabases", &DRTTestRunner::clearAllDatabases);
bindMethod("closeWebInspector", &DRTTestRunner::closeWebInspector);
#if ENABLE(POINTER_LOCK)
@@ -132,14 +128,12 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
bindMethod("didNotAcquirePointerLock", &DRTTestRunner::didNotAcquirePointerLock);
#endif
bindMethod("disableAutoResizeMode", &DRTTestRunner::disableAutoResizeMode);
- bindMethod("disableImageLoading", &DRTTestRunner::disableImageLoading);
bindMethod("display", &DRTTestRunner::display);
bindMethod("displayInvalidatedRegion", &DRTTestRunner::displayInvalidatedRegion);
bindMethod("dumpAsText", &DRTTestRunner::dumpAsText);
bindMethod("dumpBackForwardList", &DRTTestRunner::dumpBackForwardList);
bindMethod("dumpChildFramesAsText", &DRTTestRunner::dumpChildFramesAsText);
bindMethod("dumpChildFrameScrollPositions", &DRTTestRunner::dumpChildFrameScrollPositions);
- bindMethod("dumpDatabaseCallbacks", &DRTTestRunner::dumpDatabaseCallbacks);
bindMethod("dumpEditingCallbacks", &DRTTestRunner::dumpEditingCallbacks);
bindMethod("dumpFrameLoadCallbacks", &DRTTestRunner::dumpFrameLoadCallbacks);
bindMethod("dumpProgressFinishedCallback", &DRTTestRunner::dumpProgressFinishedCallback);
@@ -151,34 +145,15 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
bindMethod("dumpTitleChanges", &DRTTestRunner::dumpTitleChanges);
bindMethod("dumpPermissionClientCallbacks", &DRTTestRunner::dumpPermissionClientCallbacks);
bindMethod("dumpCreateView", &DRTTestRunner::dumpCreateView);
- bindMethod("elementDoesAutoCompleteForElementWithId", &DRTTestRunner::elementDoesAutoCompleteForElementWithId);
bindMethod("enableAutoResizeMode", &DRTTestRunner::enableAutoResizeMode);
bindMethod("evaluateInWebInspector", &DRTTestRunner::evaluateInWebInspector);
- bindMethod("evaluateScriptInIsolatedWorld", &DRTTestRunner::evaluateScriptInIsolatedWorld);
- bindMethod("evaluateScriptInIsolatedWorldAndReturnValue", &DRTTestRunner::evaluateScriptInIsolatedWorldAndReturnValue);
- bindMethod("setIsolatedWorldSecurityOrigin", &DRTTestRunner::setIsolatedWorldSecurityOrigin);
- bindMethod("setIsolatedWorldContentSecurityPolicy", &DRTTestRunner::setIsolatedWorldContentSecurityPolicy);
- bindMethod("execCommand", &DRTTestRunner::execCommand);
- bindMethod("forceRedSelectionColors", &DRTTestRunner::forceRedSelectionColors);
#if ENABLE(NOTIFICATIONS)
bindMethod("grantWebNotificationPermission", &DRTTestRunner::grantWebNotificationPermission);
- bindMethod("denyWebNotificationPermission", &DRTTestRunner::denyWebNotificationPermission);
- bindMethod("removeAllWebNotificationPermissions", &DRTTestRunner::removeAllWebNotificationPermissions);
- bindMethod("simulateWebNotificationClick", &DRTTestRunner::simulateWebNotificationClick);
#endif
- bindMethod("findString", &DRTTestRunner::findString);
- bindMethod("isCommandEnabled", &DRTTestRunner::isCommandEnabled);
- bindMethod("hasCustomPageSizeStyle", &DRTTestRunner::hasCustomPageSizeStyle);
- bindMethod("loseCompositorContext", &DRTTestRunner::loseCompositorContext);
- bindMethod("markerTextForListItem", &DRTTestRunner::markerTextForListItem);
bindMethod("notifyDone", &DRTTestRunner::notifyDone);
- bindMethod("numberOfActiveAnimations", &DRTTestRunner::numberOfActiveAnimations);
bindMethod("numberOfPendingGeolocationPermissionRequests", &DRTTestRunner:: numberOfPendingGeolocationPermissionRequests);
- bindMethod("objCIdentityIsEqual", &DRTTestRunner::objCIdentityIsEqual);
bindMethod("overridePreference", &DRTTestRunner::overridePreference);
bindMethod("pathToLocalResource", &DRTTestRunner::pathToLocalResource);
- bindMethod("pauseAnimationAtTimeOnElementWithId", &DRTTestRunner::pauseAnimationAtTimeOnElementWithId);
- bindMethod("pauseTransitionAtTimeOnElementWithId", &DRTTestRunner::pauseTransitionAtTimeOnElementWithId);
bindMethod("queueBackNavigation", &DRTTestRunner::queueBackNavigation);
bindMethod("queueForwardNavigation", &DRTTestRunner::queueForwardNavigation);
bindMethod("queueLoadingScript", &DRTTestRunner::queueLoadingScript);
@@ -186,32 +161,24 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
bindMethod("queueLoadHTMLString", &DRTTestRunner::queueLoadHTMLString);
bindMethod("queueNonLoadingScript", &DRTTestRunner::queueNonLoadingScript);
bindMethod("queueReload", &DRTTestRunner::queueReload);
- bindMethod("removeOriginAccessWhitelistEntry", &DRTTestRunner::removeOriginAccessWhitelistEntry);
bindMethod("repaintSweepHorizontally", &DRTTestRunner::repaintSweepHorizontally);
- bindMethod("resetPageVisibility", &DRTTestRunner::resetPageVisibility);
- bindMethod("setAcceptsEditing", &DRTTestRunner::setAcceptsEditing);
bindMethod("setAllowDisplayOfInsecureContent", &DRTTestRunner::setAllowDisplayOfInsecureContent);
bindMethod("setAllowFileAccessFromFileURLs", &DRTTestRunner::setAllowFileAccessFromFileURLs);
bindMethod("setAllowRunningOfInsecureContent", &DRTTestRunner::setAllowRunningOfInsecureContent);
bindMethod("setAllowUniversalAccessFromFileURLs", &DRTTestRunner::setAllowUniversalAccessFromFileURLs);
bindMethod("setAlwaysAcceptCookies", &DRTTestRunner::setAlwaysAcceptCookies);
bindMethod("setAuthorAndUserStylesEnabled", &DRTTestRunner::setAuthorAndUserStylesEnabled);
- bindMethod("setAutofilled", &DRTTestRunner::setAutofilled);
bindMethod("setCanOpenWindows", &DRTTestRunner::setCanOpenWindows);
bindMethod("setCloseRemainingWindowsWhenComplete", &DRTTestRunner::setCloseRemainingWindowsWhenComplete);
bindMethod("setCustomPolicyDelegate", &DRTTestRunner::setCustomPolicyDelegate);
bindMethod("setDatabaseQuota", &DRTTestRunner::setDatabaseQuota);
bindMethod("setDeferMainResourceDataLoad", &DRTTestRunner::setDeferMainResourceDataLoad);
- bindMethod("setDomainRelaxationForbiddenForURLScheme", &DRTTestRunner::setDomainRelaxationForbiddenForURLScheme);
bindMethod("setAudioData", &DRTTestRunner::setAudioData);
bindMethod("setGeolocationPermission", &DRTTestRunner::setGeolocationPermission);
- bindMethod("setIconDatabaseEnabled", &DRTTestRunner::setIconDatabaseEnabled);
bindMethod("setJavaScriptCanAccessClipboard", &DRTTestRunner::setJavaScriptCanAccessClipboard);
- bindMethod("setMinimumTimerInterval", &DRTTestRunner::setMinimumTimerInterval);
bindMethod("setMockDeviceOrientation", &DRTTestRunner::setMockDeviceOrientation);
bindMethod("setMockGeolocationPositionUnavailableError", &DRTTestRunner::setMockGeolocationPositionUnavailableError);
bindMethod("setMockGeolocationPosition", &DRTTestRunner::setMockGeolocationPosition);
- bindMethod("setPageVisibility", &DRTTestRunner::setPageVisibility);
bindMethod("setPluginsEnabled", &DRTTestRunner::setPluginsEnabled);
#if ENABLE(POINTER_LOCK)
bindMethod("setPointerLockWillRespondAsynchronously", &DRTTestRunner::setPointerLockWillRespondAsynchronously);
@@ -220,81 +187,37 @@ DRTTestRunner::DRTTestRunner(TestShell* shell)
bindMethod("setPopupBlockingEnabled", &DRTTestRunner::setPopupBlockingEnabled);
bindMethod("setPOSIXLocale", &DRTTestRunner::setPOSIXLocale);
bindMethod("setPrinting", &DRTTestRunner::setPrinting);
- bindMethod("setScrollbarPolicy", &DRTTestRunner::setScrollbarPolicy);
bindMethod("setSelectTrailingWhitespaceEnabled", &DRTTestRunner::setSelectTrailingWhitespaceEnabled);
- bindMethod("setTextSubpixelPositioning", &DRTTestRunner::setTextSubpixelPositioning);
bindMethod("setBackingScaleFactor", &DRTTestRunner::setBackingScaleFactor);
bindMethod("setSmartInsertDeleteEnabled", &DRTTestRunner::setSmartInsertDeleteEnabled);
bindMethod("setStopProvisionalFrameLoads", &DRTTestRunner::setStopProvisionalFrameLoads);
- bindMethod("setTabKeyCyclesThroughElements", &DRTTestRunner::setTabKeyCyclesThroughElements);
bindMethod("setUserStyleSheetEnabled", &DRTTestRunner::setUserStyleSheetEnabled);
bindMethod("setUserStyleSheetLocation", &DRTTestRunner::setUserStyleSheetLocation);
- bindMethod("setValueForUser", &DRTTestRunner::setValueForUser);
bindMethod("setWillSendRequestClearHeader", &DRTTestRunner::setWillSendRequestClearHeader);
bindMethod("setWillSendRequestReturnsNull", &DRTTestRunner::setWillSendRequestReturnsNull);
bindMethod("setWillSendRequestReturnsNullOnRedirect", &DRTTestRunner::setWillSendRequestReturnsNullOnRedirect);
bindMethod("setWindowIsKey", &DRTTestRunner::setWindowIsKey);
bindMethod("setXSSAuditorEnabled", &DRTTestRunner::setXSSAuditorEnabled);
- bindMethod("setAsynchronousSpellCheckingEnabled", &DRTTestRunner::setAsynchronousSpellCheckingEnabled);
bindMethod("showWebInspector", &DRTTestRunner::showWebInspector);
#if ENABLE(NOTIFICATIONS)
bindMethod("simulateLegacyWebNotificationClick", &DRTTestRunner::simulateLegacyWebNotificationClick);
#endif
- bindMethod("startSpeechInput", &DRTTestRunner::startSpeechInput);
bindMethod("testRepaint", &DRTTestRunner::testRepaint);
bindMethod("waitForPolicyDelegate", &DRTTestRunner::waitForPolicyDelegate);
bindMethod("waitUntilDone", &DRTTestRunner::waitUntilDone);
bindMethod("windowCount", &DRTTestRunner::windowCount);
- bindMethod("setTextDirection", &DRTTestRunner::setTextDirection);
bindMethod("setImagesAllowed", &DRTTestRunner::setImagesAllowed);
bindMethod("setScriptsAllowed", &DRTTestRunner::setScriptsAllowed);
bindMethod("setStorageAllowed", &DRTTestRunner::setStorageAllowed);
bindMethod("setPluginsAllowed", &DRTTestRunner::setPluginsAllowed);
- // The following are stubs.
- bindMethod("abortModal", &DRTTestRunner::abortModal);
- bindMethod("accessStoredWebScriptObject", &DRTTestRunner::accessStoredWebScriptObject);
- bindMethod("addDisallowedURL", &DRTTestRunner::addDisallowedURL);
- bindMethod("applicationCacheDiskUsageForOrigin", &DRTTestRunner::applicationCacheDiskUsageForOrigin);
- bindMethod("callShouldCloseOnWebView", &DRTTestRunner::callShouldCloseOnWebView);
- bindMethod("clearAllApplicationCaches", &DRTTestRunner::clearAllApplicationCaches);
- bindMethod("clearApplicationCacheForOrigin", &DRTTestRunner::clearApplicationCacheForOrigin);
- bindMethod("clearBackForwardList", &DRTTestRunner::clearBackForwardList);
- bindMethod("dumpAsWebArchive", &DRTTestRunner::dumpAsWebArchive);
- bindMethod("keepWebHistory", &DRTTestRunner::keepWebHistory);
- bindMethod("objCClassNameOf", &DRTTestRunner::objCClassNameOf);
- bindMethod("setApplicationCacheOriginQuota", &DRTTestRunner::setApplicationCacheOriginQuota);
- bindMethod("setCallCloseOnWebViews", &DRTTestRunner::setCallCloseOnWebViews);
- bindMethod("setMainFrameIsFirstResponder", &DRTTestRunner::setMainFrameIsFirstResponder);
- bindMethod("setPrivateBrowsingEnabled", &DRTTestRunner::setPrivateBrowsingEnabled);
- bindMethod("setUseDashboardCompatibilityMode", &DRTTestRunner::setUseDashboardCompatibilityMode);
- bindMethod("storeWebScriptObject", &DRTTestRunner::storeWebScriptObject);
- bindMethod("deleteAllLocalStorage", &DRTTestRunner::deleteAllLocalStorage);
- bindMethod("localStorageDiskUsageForOrigin", &DRTTestRunner::localStorageDiskUsageForOrigin);
- bindMethod("originsWithLocalStorage", &DRTTestRunner::originsWithLocalStorage);
- bindMethod("deleteLocalStorageForOrigin", &DRTTestRunner::deleteLocalStorageForOrigin);
- bindMethod("observeStorageTrackerNotifications", &DRTTestRunner::observeStorageTrackerNotifications);
- bindMethod("syncLocalStorage", &DRTTestRunner::syncLocalStorage);
bindMethod("setShouldStayOnPageAfterHandlingBeforeUnload", &DRTTestRunner::setShouldStayOnPageAfterHandlingBeforeUnload);
- bindMethod("enableFixedLayoutMode", &DRTTestRunner::enableFixedLayoutMode);
- bindMethod("setFixedLayoutSize", &DRTTestRunner::setFixedLayoutSize);
- bindMethod("selectionAsMarkup", &DRTTestRunner::selectionAsMarkup);
- bindMethod("setHasCustomFullScreenBehavior", &DRTTestRunner::setHasCustomFullScreenBehavior);
- bindMethod("textSurroundingNode", &DRTTestRunner::textSurroundingNode);
-
- // The fallback method is called when an unknown method is invoked.
- bindFallbackMethod(&DRTTestRunner::fallbackMethod);
// Shared properties.
- // globalFlag is used by a number of layout tests in
- // LayoutTests\http\tests\security\dataURL.
- bindProperty("globalFlag", &m_globalFlag);
// webHistoryItemCount is used by tests in LayoutTests\http\tests\history
bindProperty("webHistoryItemCount", &m_webHistoryItemCount);
bindProperty("titleTextDirection", &m_titleTextDirection);
- bindProperty("platformName", &m_platformName);
bindProperty("interceptPostMessage", &m_interceptPostMessage);
- bindProperty("workerThreadCount", &DRTTestRunner::workerThreadCount);
bindMethod("sendWebIntentResponse", &DRTTestRunner::sendWebIntentResponse);
bindMethod("deliverWebIntent", &DRTTestRunner::deliverWebIntent);
}
@@ -363,12 +286,6 @@ void DRTTestRunner::dumpAsText(const CppArgumentList& arguments, CppVariant* res
result->setNull();
}
-void DRTTestRunner::dumpDatabaseCallbacks(const CppArgumentList&, CppVariant* result)
-{
- // Do nothing; we don't use this flag anywhere for now
- result->setNull();
-}
-
void DRTTestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result)
{
m_dumpEditingCallbacks = true;
@@ -447,13 +364,6 @@ void DRTTestRunner::dumpCreateView(const CppArgumentList&, CppVariant* result)
result->setNull();
}
-void DRTTestRunner::setAcceptsEditing(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() > 0 && arguments[0].isBool())
- m_acceptsEditing = arguments[0].value.boolValue;
- result->setNull();
-}
-
void DRTTestRunner::waitUntilDone(const CppArgumentList&, CppVariant* result)
{
if (!webkit_support::BeingDebugged())
@@ -633,31 +543,11 @@ void DRTTestRunner::queueLoadHTMLString(const CppArgumentList& arguments, CppVar
result->setNull();
}
-void DRTTestRunner::objCIdentityIsEqual(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() < 2) {
- // This is the best we can do to return an error.
- result->setNull();
- return;
- }
- result->set(arguments[0].isEqual(arguments[1]));
-}
-
void DRTTestRunner::reset()
{
- if (m_shell) {
- m_shell->webView()->setZoomLevel(false, 0);
- m_shell->webView()->setTabKeyCyclesThroughElements(true);
-#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
- m_shell->webView()->removeAllUserContent();
- WebKit::WebSize empty;
- m_shell->webView()->disableAutoResizeMode();
+ TestRunner::reset();
+ if (m_shell)
m_shell->webViewHost()->setDeviceScaleFactor(1);
- }
m_dumpAsText = false;
m_dumpAsAudio = false;
m_dumpCreateView = false;
@@ -675,24 +565,19 @@ void DRTTestRunner::reset()
m_dumpTitleChanges = false;
m_dumpPermissionClientCallbacks = false;
m_generatePixelResults = true;
- m_acceptsEditing = true;
m_waitUntilDone = false;
m_canOpenWindows = false;
m_testRepaint = false;
m_sweepHorizontally = false;
- m_shouldAddFileToPasteboard = false;
m_stopProvisionalFrameLoads = false;
m_deferMainResourceDataLoad = true;
- m_globalFlag.set(false);
m_webHistoryItemCount.set(0);
m_titleTextDirection.set("ltr");
- m_platformName.set("chromium");
m_interceptPostMessage.set(false);
m_userStyleSheetLocation = WebURL();
m_isPrinting = false;
webkit_support::SetAcceptAllCookies(false);
- WebSecurityPolicy::resetOriginAccessWhitelists();
// Reset the default quota for each origin to 5MB
webkit_support::SetDatabaseQuota(5 * 1024 * 1024);
@@ -706,10 +591,6 @@ void DRTTestRunner::reset()
m_workQueue.reset();
m_taskList.revokeAll();
m_shouldStayOnPageAfterHandlingBeforeUnload = false;
- m_hasCustomFullScreenBehavior = false;
-#if OS(LINUX) || OS(ANDROID)
- WebFontRendering::setSubpixelPositioning(false);
-#endif
}
void DRTTestRunner::locationChangeDone()
@@ -736,13 +617,6 @@ void DRTTestRunner::setCanOpenWindows(const CppArgumentList&, CppVariant* result
result->setNull();
}
-void DRTTestRunner::setTabKeyCyclesThroughElements(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() > 0 && arguments[0].isBool())
- m_shell->webView()->setTabKeyCyclesThroughElements(arguments[0].toBoolean());
- result->setNull();
-}
-
void DRTTestRunner::windowCount(const CppArgumentList&, CppVariant* result)
{
result->set(static_cast<int>(m_shell->windowCount()));
@@ -762,13 +636,6 @@ void DRTTestRunner::setAlwaysAcceptCookies(const CppArgumentList& arguments, Cpp
result->setNull();
}
-void DRTTestRunner::setAsynchronousSpellCheckingEnabled(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() > 0 && arguments[0].isBool())
- m_shell->webView()->settings()->setAsynchronousSpellCheckingEnabled(cppVariantToBool(arguments[0]));
- result->setNull();
-}
-
void DRTTestRunner::showWebInspector(const CppArgumentList&, CppVariant* result)
{
m_shell->showDevTools();
@@ -817,35 +684,6 @@ void DRTTestRunner::setAuthorAndUserStylesEnabled(const CppArgumentList& argumen
result->setNull();
}
-void DRTTestRunner::execCommand(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() <= 0 || !arguments[0].isString())
- return;
-
- std::string command = arguments[0].toString();
- std::string value("");
- // Ignore the second parameter (which is userInterface)
- // since this command emulates a manual action.
- if (arguments.size() >= 3 && arguments[2].isString())
- value = arguments[2].toString();
-
- // Note: webkit's version does not return the boolean, so neither do we.
- m_shell->webView()->focusedFrame()->executeCommand(WebString::fromUTF8(command), WebString::fromUTF8(value));
-}
-
-void DRTTestRunner::isCommandEnabled(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() <= 0 || !arguments[0].isString()) {
- result->setNull();
- return;
- }
-
- std::string command = arguments[0].toString();
- bool rv = m_shell->webView()->focusedFrame()->isCommandEnabled(WebString::fromUTF8(command));
- result->set(rv);
-}
-
void DRTTestRunner::setPopupBlockingEnabled(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool()) {
@@ -884,49 +722,6 @@ void DRTTestRunner::setPluginsAllowed(const CppArgumentList& arguments, CppVaria
result->setNull();
}
-void DRTTestRunner::setUseDashboardCompatibilityMode(const CppArgumentList&, CppVariant* result)
-{
- // We have no need to support Dashboard Compatibility Mode (mac-only)
- result->setNull();
-}
-
-void DRTTestRunner::clearAllApplicationCaches(const CppArgumentList&, CppVariant* result)
-{
- // FIXME: Implement to support application cache quotas.
- result->setNull();
-}
-
-void DRTTestRunner::clearApplicationCacheForOrigin(const CppArgumentList&, CppVariant* result)
-{
- // FIXME: Implement to support deleting all application cache for an origin.
- result->setNull();
-}
-
-void DRTTestRunner::setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant* result)
-{
- // FIXME: Implement to support application cache quotas.
- result->setNull();
-}
-
-void DRTTestRunner::originsWithApplicationCache(const CppArgumentList&, CppVariant* result)
-{
- // FIXME: Implement to support getting origins that have application caches.
- result->setNull();
-}
-
-void DRTTestRunner::applicationCacheDiskUsageForOrigin(const CppArgumentList&, CppVariant* result)
-{
- // FIXME: Implement to support getting disk usage by all application cache for an origin.
- result->setNull();
-}
-
-void DRTTestRunner::setScrollbarPolicy(const CppArgumentList&, CppVariant* result)
-{
- // FIXME: implement.
- // Currently only has a non-null implementation on QT.
- result->setNull();
-}
-
void DRTTestRunner::setCustomPolicyDelegate(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool()) {
@@ -1008,12 +803,6 @@ void DRTTestRunner::pathToLocalResource(const CppArgumentList& arguments, CppVar
result->set(webkit_support::RewriteLayoutTestsURL(url).spec());
}
-void DRTTestRunner::addFileToPasteboardOnDrag(const CppArgumentList&, CppVariant* result)
-{
- result->setNull();
- m_shouldAddFileToPasteboard = true;
-}
-
void DRTTestRunner::setStopProvisionalFrameLoads(const CppArgumentList&, CppVariant* result)
{
result->setNull();
@@ -1034,97 +823,6 @@ void DRTTestRunner::setSelectTrailingWhitespaceEnabled(const CppArgumentList& ar
result->setNull();
}
-bool DRTTestRunner::pauseAnimationAtTimeOnElementWithId(const WebString& animationName, double time, const WebString& elementId)
-{
- WebFrame* webFrame = m_shell->webView()->mainFrame();
- if (!webFrame)
- return false;
-
- WebAnimationController* controller = webFrame->animationController();
- if (!controller)
- return false;
-
- WebElement element = webFrame->document().getElementById(elementId);
- if (element.isNull())
- return false;
- return controller->pauseAnimationAtTime(element, animationName, time);
-}
-
-bool DRTTestRunner::pauseTransitionAtTimeOnElementWithId(const WebString& propertyName, double time, const WebString& elementId)
-{
- WebFrame* webFrame = m_shell->webView()->mainFrame();
- if (!webFrame)
- return false;
-
- WebAnimationController* controller = webFrame->animationController();
- if (!controller)
- return false;
-
- WebElement element = webFrame->document().getElementById(elementId);
- if (element.isNull())
- return false;
- return controller->pauseTransitionAtTime(element, propertyName, time);
-}
-
-bool DRTTestRunner::elementDoesAutoCompleteForElementWithId(const WebString& elementId)
-{
- WebFrame* webFrame = m_shell->webView()->mainFrame();
- if (!webFrame)
- return false;
-
- WebElement element = webFrame->document().getElementById(elementId);
- if (element.isNull() || !element.hasTagName("input"))
- return false;
-
- WebInputElement inputElement = element.to<WebInputElement>();
- return inputElement.autoComplete();
-}
-
-int DRTTestRunner::numberOfActiveAnimations()
-{
- WebFrame* webFrame = m_shell->webView()->mainFrame();
- if (!webFrame)
- return -1;
-
- WebAnimationController* controller = webFrame->animationController();
- if (!controller)
- return -1;
-
- return controller->numberOfActiveAnimations();
-}
-
-void DRTTestRunner::pauseAnimationAtTimeOnElementWithId(const CppArgumentList& arguments, CppVariant* result)
-{
- result->set(false);
- if (arguments.size() > 2 && arguments[0].isString() && arguments[1].isNumber() && arguments[2].isString()) {
- WebString animationName = cppVariantToWebString(arguments[0]);
- double time = arguments[1].toDouble();
- WebString elementId = cppVariantToWebString(arguments[2]);
- result->set(pauseAnimationAtTimeOnElementWithId(animationName, time, elementId));
- }
-}
-
-void DRTTestRunner::pauseTransitionAtTimeOnElementWithId(const CppArgumentList& arguments, CppVariant* result)
-{
- result->set(false);
- if (arguments.size() > 2 && arguments[0].isString() && arguments[1].isNumber() && arguments[2].isString()) {
- WebString propertyName = cppVariantToWebString(arguments[0]);
- double time = arguments[1].toDouble();
- WebString elementId = cppVariantToWebString(arguments[2]);
- result->set(pauseTransitionAtTimeOnElementWithId(propertyName, time, elementId));
- }
-}
-
-void DRTTestRunner::elementDoesAutoCompleteForElementWithId(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() != 1 || !arguments[0].isString()) {
- result->set(false);
- return;
- }
- WebString elementId = cppVariantToWebString(arguments[0]);
- result->set(elementDoesAutoCompleteForElementWithId(elementId));
-}
-
void DRTTestRunner::enableAutoResizeMode(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() != 4) {
@@ -1159,29 +857,6 @@ void DRTTestRunner::disableAutoResizeMode(const CppArgumentList& arguments, CppV
result->set(true);
}
-void DRTTestRunner::numberOfActiveAnimations(const CppArgumentList&, CppVariant* result)
-{
- result->set(numberOfActiveAnimations());
-}
-
-void DRTTestRunner::disableImageLoading(const CppArgumentList&, CppVariant* result)
-{
- m_shell->preferences()->loadsImagesAutomatically = false;
- m_shell->applyPreferences();
- result->setNull();
-}
-
-void DRTTestRunner::setIconDatabaseEnabled(const CppArgumentList&, CppVariant* result)
-{
- // We don't use the WebKit icon database.
- result->setNull();
-}
-
-void DRTTestRunner::callShouldCloseOnWebView(const CppArgumentList&, CppVariant* result)
-{
- result->set(m_shell->webView()->dispatchBeforeUnloadEvent());
-}
-
#if ENABLE(NOTIFICATIONS)
void DRTTestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
{
@@ -1195,24 +870,6 @@ void DRTTestRunner::grantWebNotificationPermission(const CppArgumentList& argume
result->set(true);
}
-void DRTTestRunner::denyWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
-{
- // FIXME: Implement.
- result->setNull();
-}
-
-void DRTTestRunner::removeAllWebNotificationPermissions(const CppArgumentList& arguments, CppVariant* result)
-{
- // FIXME: Implement.
- result->setNull();
-}
-
-void DRTTestRunner::simulateWebNotificationClick(const CppArgumentList& arguments, CppVariant* result)
-{
- // FIXME: Implement.
- result->setNull();
-}
-
void DRTTestRunner::simulateLegacyWebNotificationClick(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() != 1 || !arguments[0].isString()) {
@@ -1228,33 +885,12 @@ void DRTTestRunner::simulateLegacyWebNotificationClick(const CppArgumentList& ar
}
#endif
-void DRTTestRunner::setDomainRelaxationForbiddenForURLScheme(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() != 2 || !arguments[0].isBool() || !arguments[1].isString())
- return;
- m_shell->webView()->setDomainRelaxationForbidden(cppVariantToBool(arguments[0]), cppVariantToWebString(arguments[1]));
-}
-
void DRTTestRunner::setDeferMainResourceDataLoad(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() == 1)
m_deferMainResourceDataLoad = cppVariantToBool(arguments[0]);
}
-//
-// Unimplemented stubs
-//
-
-void DRTTestRunner::dumpAsWebArchive(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::setMainFrameIsFirstResponder(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
void DRTTestRunner::dumpSelectionRect(const CppArgumentList& arguments, CppVariant* result)
{
m_dumpSelectionRect = true;
@@ -1266,7 +902,7 @@ void DRTTestRunner::display(const CppArgumentList& arguments, CppVariant* result
WebViewHost* host = m_shell->webViewHost();
const WebKit::WebSize& size = m_shell->webView()->size();
WebRect rect(0, 0, size.width, size.height);
- host->updatePaintRect(rect);
+ host->proxy()->setPaintRect(rect);
host->paintInvalidatedRegion();
host->displayRepaintMask();
result->setNull();
@@ -1292,46 +928,6 @@ void DRTTestRunner::repaintSweepHorizontally(const CppArgumentList&, CppVariant*
result->setNull();
}
-void DRTTestRunner::clearBackForwardList(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::keepWebHistory(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::storeWebScriptObject(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::accessStoredWebScriptObject(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::objCClassNameOf(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::addDisallowedURL(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::setCallCloseOnWebViews(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
-void DRTTestRunner::setPrivateBrowsingEnabled(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
void DRTTestRunner::setJavaScriptCanAccessClipboard(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool()) {
@@ -1350,70 +946,6 @@ void DRTTestRunner::setXSSAuditorEnabled(const CppArgumentList& arguments, CppVa
result->setNull();
}
-void DRTTestRunner::evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList& arguments, CppVariant* result)
-{
- v8::HandleScope scope;
- WebVector<v8::Local<v8::Value> > values;
- if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) {
- WebScriptSource source(cppVariantToWebString(arguments[1]));
- // This relies on the iframe focusing itself when it loads. This is a bit
- // sketchy, but it seems to be what other tests do.
- m_shell->webView()->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1, &values);
- }
- result->setNull();
- // Since only one script was added, only one result is expected
- if (values.size() == 1 && !values[0].IsEmpty()) {
- v8::Local<v8::Value> scriptValue = values[0];
- // FIXME: There are many more types that can be handled.
- if (scriptValue->IsString()) {
- v8::String::AsciiValue asciiV8(scriptValue);
- result->set(std::string(*asciiV8));
- } else if (scriptValue->IsBoolean())
- result->set(scriptValue->ToBoolean()->Value());
- else if (scriptValue->IsNumber()) {
- if (scriptValue->IsInt32())
- result->set(scriptValue->ToInt32()->Value());
- else
- result->set(scriptValue->ToNumber()->Value());
- } else if (scriptValue->IsNull())
- result->setNull();
- }
-}
-
-void DRTTestRunner::evaluateScriptInIsolatedWorld(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) {
- WebScriptSource source(cppVariantToWebString(arguments[1]));
- // This relies on the iframe focusing itself when it loads. This is a bit
- // sketchy, but it seems to be what other tests do.
- m_shell->webView()->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1);
- }
- result->setNull();
-}
-
-void DRTTestRunner::setIsolatedWorldSecurityOrigin(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-
- if (arguments.size() != 2 || !arguments[0].isNumber() || !(arguments[1].isString() || arguments[1].isNull()))
- return;
-
- WebSecurityOrigin origin;
- if (arguments[1].isString())
- origin = WebSecurityOrigin::createFromString(cppVariantToWebString(arguments[1]));
- m_shell->webView()->focusedFrame()->setIsolatedWorldSecurityOrigin(arguments[0].toInt32(), origin);
-}
-
-void DRTTestRunner::setIsolatedWorldContentSecurityPolicy(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-
- if (arguments.size() != 2 || !arguments[0].isNumber() || !arguments[1].isString())
- return;
-
- m_shell->webView()->focusedFrame()->setIsolatedWorldContentSecurityPolicy(arguments[0].toInt32(), cppVariantToWebString(arguments[1]));
-}
-
void DRTTestRunner::setAllowUniversalAccessFromFileURLs(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() > 0 && arguments[0].isBool()) {
@@ -1448,63 +980,6 @@ void DRTTestRunner::setAllowRunningOfInsecureContent(const CppArgumentList& argu
result->setNull();
}
-// Need these conversions because the format of the value for booleans
-// may vary - for example, on mac "1" and "0" are used for boolean.
-bool DRTTestRunner::cppVariantToBool(const CppVariant& value)
-{
- if (value.isBool())
- return value.toBoolean();
- if (value.isNumber())
- return value.toInt32();
- if (value.isString()) {
- string valueString = value.toString();
- if (valueString == "true" || valueString == "1")
- return true;
- if (valueString == "false" || valueString == "0")
- return false;
- }
- logErrorToConsole("Invalid value. Expected boolean value.");
- return false;
-}
-
-int32_t DRTTestRunner::cppVariantToInt32(const CppVariant& value)
-{
- if (value.isNumber())
- return value.toInt32();
- if (value.isString()) {
- string stringSource = value.toString();
- const char* source = stringSource.data();
- char* end;
- long number = strtol(source, &end, 10);
- if (end == source + stringSource.length() && number >= numeric_limits<int32_t>::min() && number <= numeric_limits<int32_t>::max())
- return static_cast<int32_t>(number);
- }
- logErrorToConsole("Invalid value for preference. Expected integer value.");
- return 0;
-}
-
-WebString DRTTestRunner::cppVariantToWebString(const CppVariant& value)
-{
- if (!value.isString()) {
- logErrorToConsole("Invalid value for preference. Expected string value.");
- return WebString();
- }
- return WebString::fromUTF8(value.toString());
-}
-
-Vector<WebString> DRTTestRunner::cppVariantToWebStringArray(const CppVariant& value)
-{
- if (!value.isObject()) {
- logErrorToConsole("Invalid value for preference. Expected object value.");
- return Vector<WebString>();
- }
- Vector<WebString> resultVector;
- Vector<string> stringVector = value.toStringVector();
- for (size_t i = 0; i < stringVector.size(); ++i)
- resultVector.append(WebString::fromUTF8(stringVector[i].c_str()));
- return resultVector;
-}
-
// Sets map based on scriptFontPairs, a collapsed vector of pairs of ISO 15924
// four-letter script code and font such as:
// { "Arab", "My Arabic Font", "Grek", "My Greek Font" }
@@ -1624,55 +1099,11 @@ void DRTTestRunner::overridePreference(const CppArgumentList& arguments, CppVari
} else {
string message("Invalid name for preference: ");
message.append(key);
- logErrorToConsole(message);
+ printErrorMessage(message);
}
m_shell->applyPreferences();
}
-void DRTTestRunner::fallbackMethod(const CppArgumentList&, CppVariant* result)
-{
- printf("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on DRTTestRunner\n");
- result->setNull();
-}
-
-void DRTTestRunner::addOriginAccessWhitelistEntry(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::addOriginAccessWhitelistEntry(
- url,
- cppVariantToWebString(arguments[1]),
- cppVariantToWebString(arguments[2]),
- arguments[3].toBoolean());
-}
-
-void DRTTestRunner::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,
- cppVariantToWebString(arguments[1]),
- cppVariantToWebString(arguments[2]),
- arguments[3].toBoolean());
-}
-
void DRTTestRunner::clearAllDatabases(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -1693,49 +1124,12 @@ void DRTTestRunner::setPOSIXLocale(const CppArgumentList& arguments, CppVariant*
setlocale(LC_ALL, arguments[0].toString().c_str());
}
-// Parse a single argument. The method returns true if there is an argument that
-// is a number or if there is no argument at all. It returns false only if there
-// is some argument that is not a number. The value parameter is filled with the
-// parsed number, or given the default if there is no argument.
-static bool parseCppArgumentInt32(const CppArgumentList& arguments, int argIndex, int* value, int defaultValue)
-{
- if (static_cast<int>(arguments.size()) > argIndex) {
- if (!arguments[argIndex].isNumber())
- return false;
- *value = arguments[argIndex].toInt32();
- return true;
- }
- *value = defaultValue;
- return true;
-}
-
-static bool parsePageNumber(const CppArgumentList& arguments, int argOffset, int* pageNumber)
-{
- if (static_cast<int>(arguments.size()) > argOffset + 1)
- return false;
- if (!parseCppArgumentInt32(arguments, argOffset, pageNumber, 0))
- return false;
- return true;
-}
-
void DRTTestRunner::setPrinting(const CppArgumentList& arguments, CppVariant* result)
{
setIsPrinting(true);
result->setNull();
}
-void DRTTestRunner::hasCustomPageSizeStyle(const CppArgumentList& arguments, CppVariant* result)
-{
- result->set(false);
- int pageIndex = 0;
- if (!parsePageNumber(arguments, 0, &pageIndex))
- return;
- WebFrame* frame = m_shell->webView()->mainFrame();
- if (!frame)
- return;
- result->set(frame->hasCustomPageSizeStyle(pageIndex));
-}
-
void DRTTestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -1746,13 +1140,6 @@ void DRTTestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgume
result->set(numberOfRequests);
}
-void DRTTestRunner::logErrorToConsole(const std::string& text)
-{
- m_shell->webViewHost()->didAddMessageToConsole(
- WebConsoleMessage(WebConsoleMessage::LevelError, WebString::fromUTF8(text)),
- WebString(), 0);
-}
-
void DRTTestRunner::evaluateInWebInspector(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -1761,36 +1148,6 @@ void DRTTestRunner::evaluateInWebInspector(const CppArgumentList& arguments, Cpp
m_shell->drtDevToolsAgent()->evaluateInWebInspector(arguments[0].toInt32(), arguments[1].toString());
}
-void DRTTestRunner::forceRedSelectionColors(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- m_shell->webView()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0);
-}
-
-void DRTTestRunner::addUserScript(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isBool() || !arguments[2].isBool())
- return;
- WebView::addUserScript(
- cppVariantToWebString(arguments[0]), WebVector<WebString>(),
- arguments[1].toBoolean() ? WebView::UserScriptInjectAtDocumentStart : WebView::UserScriptInjectAtDocumentEnd,
- arguments[2].toBoolean() ? WebView::UserContentInjectInAllFrames : WebView::UserContentInjectInTopFrameOnly);
-}
-
-void DRTTestRunner::addUserStyleSheet(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isBool())
- return;
- WebView::addUserStyleSheet(
- cppVariantToWebString(arguments[0]), WebVector<WebString>(),
- arguments[1].toBoolean() ? WebView::UserContentInjectInAllFrames : WebView::UserContentInjectInTopFrameOnly,
- // Chromium defaults to InjectInSubsequentDocuments, but for compatibility
- // with the other ports' DRTs, we use UserStyleInjectInExistingDocuments.
- WebView::UserStyleInjectInExistingDocuments);
-}
-
void DRTTestRunner::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -1845,11 +1202,6 @@ void DRTTestRunner::setMockGeolocationPositionUnavailableError(const CppArgument
windowList[i]->geolocationClientMock()->setPositionUnavailableError(cppVariantToWebString(arguments[0]));
}
-void DRTTestRunner::abortModal(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
-}
-
#if ENABLE(INPUT_SPEECH)
void DRTTestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result)
{
@@ -1901,145 +1253,6 @@ void DRTTestRunner::wasMockSpeechRecognitionAborted(const CppArgumentList&, CppV
}
#endif
-void DRTTestRunner::startSpeechInput(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() != 1)
- return;
-
- WebElement element;
- if (!WebBindings::getElement(arguments[0].value.objectValue, &element))
- return;
-
- WebInputElement* input = toWebInputElement(&element);
- if (!input)
- return;
-
- if (!input->isSpeechInputEnabled())
- return;
-
- input->startSpeechInput();
-}
-
-void DRTTestRunner::loseCompositorContext(const CppArgumentList& args, CppVariant*)
-{
- int numTimes;
- if (args.size() == 1 || !args[0].isNumber())
- numTimes = 1;
- else
- numTimes = args[0].toInt32();
- m_shell->webView()->loseCompositorContext(numTimes);
-}
-
-void DRTTestRunner::markerTextForListItem(const CppArgumentList& args, CppVariant* result)
-{
- WebElement element;
- if (!WebBindings::getElement(args[0].value.objectValue, &element))
- result->setNull();
- else
- result->set(element.document().frame()->markerTextForListItem(element).utf8());
-}
-
-void DRTTestRunner::findString(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() < 1 || !arguments[0].isString())
- return;
-
- WebFindOptions findOptions;
- bool wrapAround = false;
- if (arguments.size() >= 2) {
- Vector<std::string> optionsArray = arguments[1].toStringVector();
- findOptions.matchCase = true;
-
- for (size_t i = 0; i < optionsArray.size(); ++i) {
- const std::string& option = optionsArray[i];
- // FIXME: Support all the options, so we can run findString.html too.
- if (option == "CaseInsensitive")
- findOptions.matchCase = false;
- else if (option == "Backwards")
- findOptions.forward = false;
- else if (option == "WrapAround")
- wrapAround = true;
- }
- }
-
- WebFrame* frame = m_shell->webView()->mainFrame();
- const bool findResult = frame->find(0, cppVariantToWebString(arguments[0]), findOptions, wrapAround, 0);
- result->set(findResult);
-}
-
-void DRTTestRunner::setMinimumTimerInterval(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 1 || !arguments[0].isNumber())
- return;
- m_shell->webView()->settings()->setMinimumTimerInterval(arguments[0].toDouble());
-}
-
-void DRTTestRunner::setAutofilled(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() != 2 || !arguments[1].isBool())
- return;
-
- WebElement element;
- if (!WebBindings::getElement(arguments[0].value.objectValue, &element))
- return;
-
- WebInputElement* input = toWebInputElement(&element);
- if (!input)
- return;
-
- input->setAutofilled(arguments[1].value.boolValue);
-}
-
-void DRTTestRunner::setValueForUser(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() != 2)
- return;
-
- WebElement element;
- if (!WebBindings::getElement(arguments[0].value.objectValue, &element))
- return;
-
- WebInputElement* input = toWebInputElement(&element);
- if (!input)
- return;
-
- input->setValue(cppVariantToWebString(arguments[1]), true);
-}
-
-void DRTTestRunner::deleteAllLocalStorage(const CppArgumentList& arguments, CppVariant*)
-{
- // Not Implemented
-}
-
-void DRTTestRunner::localStorageDiskUsageForOrigin(const CppArgumentList& arguments, CppVariant*)
-{
- // Not Implemented
-}
-
-void DRTTestRunner::originsWithLocalStorage(const CppArgumentList& arguments, CppVariant*)
-{
- // Not Implemented
-}
-
-void DRTTestRunner::deleteLocalStorageForOrigin(const CppArgumentList& arguments, CppVariant*)
-{
- // Not Implemented
-}
-
-void DRTTestRunner::observeStorageTrackerNotifications(const CppArgumentList&, CppVariant*)
-{
- // Not Implemented
-}
-
-void DRTTestRunner::syncLocalStorage(const CppArgumentList&, CppVariant*)
-{
- // Not Implemented
-}
-
void DRTTestRunner::setShouldStayOnPageAfterHandlingBeforeUnload(const CppArgumentList& arguments, CppVariant* result)
{
if (arguments.size() == 1 && arguments[0].isBool())
@@ -2048,35 +1261,6 @@ void DRTTestRunner::setShouldStayOnPageAfterHandlingBeforeUnload(const CppArgume
result->setNull();
}
-void DRTTestRunner::enableFixedLayoutMode(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 1 || !arguments[0].isBool())
- return;
- bool enableFixedLayout = arguments[0].toBoolean();
- m_shell->webView()->enableFixedLayoutMode(enableFixedLayout);
-}
-
-void DRTTestRunner::setFixedLayoutSize(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber())
- return;
- int width = arguments[0].toInt32();
- int height = arguments[1].toInt32();
- m_shell->webView()->setFixedLayoutSize(WebSize(width, height));
-}
-
-void DRTTestRunner::selectionAsMarkup(const CppArgumentList& arguments, CppVariant* result)
-{
- result->set(m_shell->webView()->mainFrame()->selectionAsMarkup().utf8());
-}
-
-void DRTTestRunner::workerThreadCount(CppVariant* result)
-{
- result->set(static_cast<int>(WebWorkerInfo::dedicatedWorkerCount()));
-}
-
void DRTTestRunner::sendWebIntentResponse(const CppArgumentList& arguments, CppVariant* result)
{
v8::HandleScope scope;
@@ -2120,17 +1304,6 @@ void DRTTestRunner::deliverWebIntent(const CppArgumentList& arguments, CppVarian
m_shell->webView()->mainFrame()->deliverIntent(intent, 0, m_intentClient.get());
}
-void DRTTestRunner::setTextSubpixelPositioning(const CppArgumentList& arguments, CppVariant* result)
-{
-#if OS(LINUX) || OS(ANDROID)
- // Since FontConfig doesn't provide a variable to control subpixel positioning, we'll fall back
- // to setting it globally for all fonts.
- if (arguments.size() > 0 && arguments[0].isBool())
- WebFontRendering::setSubpixelPositioning(arguments[0].value.boolValue);
-#endif
- result->setNull();
-}
-
class InvokeCallbackTask : public WebMethodTask<DRTTestRunner> {
public:
InvokeCallbackTask(DRTTestRunner* object, PassOwnArrayPtr<CppVariant> callbackArguments, uint32_t numberOfArguments)
@@ -2174,52 +1347,6 @@ void DRTTestRunner::setPluginsEnabled(const CppArgumentList& arguments, CppVaria
result->setNull();
}
-void DRTTestRunner::resetPageVisibility(const CppArgumentList& arguments, CppVariant* result)
-{
- m_shell->webView()->setVisibilityState(WebPageVisibilityStateVisible, true);
-}
-
-void DRTTestRunner::setPageVisibility(const CppArgumentList& arguments, CppVariant* result)
-{
- if (arguments.size() > 0 && arguments[0].isString()) {
- string newVisibility = arguments[0].toString();
- if (newVisibility == "visible")
- m_shell->webView()->setVisibilityState(WebPageVisibilityStateVisible, false);
- else if (newVisibility == "hidden")
- m_shell->webView()->setVisibilityState(WebPageVisibilityStateHidden, false);
- else if (newVisibility == "prerender")
- m_shell->webView()->setVisibilityState(WebPageVisibilityStatePrerender, false);
- else if (newVisibility == "preview")
- m_shell->webView()->setVisibilityState(WebPageVisibilityStatePreview, false);
- }
-}
-
-void DRTTestRunner::setAutomaticLinkDetectionEnabled(bool)
-{
- // Not Implemented
-}
-
-void DRTTestRunner::setTextDirection(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() != 1 || !arguments[0].isString())
- return;
-
- // Map a direction name to a WebTextDirection value.
- std::string directionName = arguments[0].toString();
- WebKit::WebTextDirection direction;
- if (directionName == "auto")
- direction = WebKit::WebTextDirectionDefault;
- else if (directionName == "rtl")
- direction = WebKit::WebTextDirectionRightToLeft;
- else if (directionName == "ltr")
- direction = WebKit::WebTextDirectionLeftToRight;
- else
- return;
-
- m_shell->webView()->setTextDirection(direction);
-}
-
void DRTTestRunner::setAudioData(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
@@ -2237,14 +1364,6 @@ void DRTTestRunner::setAudioData(const CppArgumentList& arguments, CppVariant* r
setShouldDumpAsAudio(true);
}
-void DRTTestRunner::setHasCustomFullScreenBehavior(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 1 || !arguments[0].isBool())
- return;
- m_hasCustomFullScreenBehavior = arguments[0].toBoolean();
-}
-
#if ENABLE(POINTER_LOCK)
void DRTTestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result)
{
@@ -2276,27 +1395,3 @@ void DRTTestRunner::setPointerLockWillFailSynchronously(const CppArgumentList&,
result->setNull();
}
#endif
-
-void DRTTestRunner::textSurroundingNode(const CppArgumentList& arguments, CppVariant* result)
-{
- result->setNull();
- if (arguments.size() < 4 || !arguments[0].isObject() || !arguments[1].isNumber() || !arguments[2].isNumber() || !arguments[3].isNumber())
- return;
-
- WebNode node;
- if (!WebBindings::getNode(arguments[0].value.objectValue, &node))
- return;
-
- if (node.isNull() || !node.isTextNode())
- return;
-
- WebPoint point(arguments[1].toInt32(), arguments[2].toInt32());
- unsigned maxLength = arguments[3].toInt32();
-
- WebSurroundingText surroundingText;
- surroundingText.initialize(node, point, maxLength);
- if (surroundingText.isNull())
- return;
-
- result->set(surroundingText.textContent().utf8());
-}
diff --git a/Tools/DumpRenderTree/chromium/DRTTestRunner.h b/Tools/DumpRenderTree/chromium/DRTTestRunner.h
index c4cb7ace8..9f02e1c53 100644
--- a/Tools/DumpRenderTree/chromium/DRTTestRunner.h
+++ b/Tools/DumpRenderTree/chromium/DRTTestRunner.h
@@ -63,7 +63,10 @@ class ScopedTempDirectory;
class TestShell;
-class DRTTestRunner : public TestRunner {
+using WebTestRunner::CppArgumentList;
+using WebTestRunner::CppVariant;
+
+class DRTTestRunner : public WebTestRunner::TestRunner {
public:
// Builds the property and method lists needed to bind this class to a JS
// object.
@@ -76,13 +79,6 @@ public:
// It takes an optional argument, whether to dump pixels results or not.
void dumpAsText(const CppArgumentList&, CppVariant*);
- // This function should set a flag that tells the test_shell to print a line
- // of descriptive text for each database command. It should take no
- // arguments, and ignore any that may be present. However, at the moment, we
- // don't have any DB function that prints messages, so for now this function
- // doesn't do anything.
- void dumpDatabaseCallbacks(const CppArgumentList&, CppVariant*);
-
// This function sets a flag that tells the test_shell to print a line of
// descriptive text for each editing command. It takes no arguments, and
// ignores any that may be present.
@@ -136,11 +132,6 @@ public:
// It takes no arguments, and ignores any that may be present.
void dumpCreateView(const CppArgumentList&, CppVariant*);
- // When called with a boolean argument, this sets a flag that controls
- // whether content-editable elements accept editing focus when an editing
- // attempt is made. It ignores any additional arguments.
- void setAcceptsEditing(const CppArgumentList&, CppVariant*);
-
// Functions for dealing with windows. By default we block all new windows.
void windowCount(const CppArgumentList&, CppVariant*);
void setCanOpenWindows(const CppArgumentList&, CppVariant*);
@@ -161,16 +152,9 @@ public:
void queueLoad(const CppArgumentList&, CppVariant*);
void queueLoadHTMLString(const CppArgumentList&, CppVariant*);
- // Although this is named "objC" to match the Mac version, it actually tests
- // the identity of its two arguments in C++.
- void objCIdentityIsEqual(const CppArgumentList&, CppVariant*);
-
// Changes the cookie policy from the default to allow all cookies.
void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*);
- // Changes asynchronous spellchecking flag on the settings.
- void setAsynchronousSpellCheckingEnabled(const CppArgumentList&, CppVariant*);
-
// Shows DevTools window.
void showWebInspector(const CppArgumentList&, CppVariant*);
void closeWebInspector(const CppArgumentList&, CppVariant*);
@@ -178,9 +162,6 @@ public:
// Gives focus to the window.
void setWindowIsKey(const CppArgumentList&, CppVariant*);
- // Method that controls whether pressing Tab key cycles through page elements
- // or inserts a '\t' char in text area
- void setTabKeyCyclesThroughElements(const CppArgumentList&, CppVariant*);
// Passes through to WebPreferences which allows the user to have a custom
// style sheet.
@@ -190,13 +171,6 @@ public:
// 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.
@@ -217,16 +191,6 @@ public:
// Converts a URL starting with file:///tmp/ to the local mapping.
void pathToLocalResource(const CppArgumentList&, CppVariant*);
- // Sets a bool such that when a drag is started, we fill the drag clipboard
- // with a fake file object.
- void addFileToPasteboardOnDrag(const CppArgumentList&, CppVariant*);
-
- // Executes an internal command (superset of document.execCommand() commands).
- void execCommand(const CppArgumentList&, CppVariant*);
-
- // Checks if an internal command is currently available.
- void isCommandEnabled(const CppArgumentList&, CppVariant*);
-
// Set the WebPreference that controls webkit's popup blocking.
void setPopupBlockingEnabled(const CppArgumentList&, CppVariant*);
@@ -239,52 +203,28 @@ public:
// Enable or disable trailing whitespace selection on double click.
void setSelectTrailingWhitespaceEnabled(const CppArgumentList&, CppVariant*);
-
- void pauseAnimationAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
- void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
- void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*);
void enableAutoResizeMode(const CppArgumentList&, CppVariant*);
void disableAutoResizeMode(const CppArgumentList&, CppVariant*);
- void numberOfActiveAnimations(const CppArgumentList&, CppVariant*);
- void disableImageLoading(const CppArgumentList&, CppVariant*);
- void setIconDatabaseEnabled(const CppArgumentList&, CppVariant*);
void dumpSelectionRect(const CppArgumentList&, CppVariant*);
#if ENABLE(NOTIFICATIONS)
// Grants permission for desktop notifications to an origin
void grantWebNotificationPermission(const CppArgumentList&, CppVariant*);
- void denyWebNotificationPermission(const CppArgumentList&, CppVariant*);
- void removeAllWebNotificationPermissions(const CppArgumentList&, CppVariant*);
- void simulateWebNotificationClick(const CppArgumentList&, CppVariant*);
// Simulates a click on a desktop notification.
void simulateLegacyWebNotificationClick(const CppArgumentList&, CppVariant*);
#endif
- void setDomainRelaxationForbiddenForURLScheme(const CppArgumentList&, CppVariant*);
void setDeferMainResourceDataLoad(const CppArgumentList&, CppVariant*);
// Deals with Web Audio WAV file data.
void setAudioData(const CppArgumentList&, CppVariant*);
const WebKit::WebArrayBufferView& audioData() const { return m_audioData; }
- // The following are only stubs.
- // FIXME: Implement any of these that are needed to pass the layout tests.
- void dumpAsWebArchive(const CppArgumentList&, CppVariant*);
void dumpTitleChanges(const CppArgumentList&, CppVariant*);
- void setMainFrameIsFirstResponder(const CppArgumentList&, CppVariant*);
void display(const CppArgumentList&, CppVariant*);
void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
void testRepaint(const CppArgumentList&, CppVariant*);
void repaintSweepHorizontally(const CppArgumentList&, CppVariant*);
- void clearBackForwardList(const CppArgumentList&, CppVariant*);
- void keepWebHistory(const CppArgumentList&, CppVariant*);
- void storeWebScriptObject(const CppArgumentList&, CppVariant*);
- 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*);
void setJavaScriptCanAccessClipboard(const CppArgumentList&, CppVariant*);
void setXSSAuditorEnabled(const CppArgumentList&, CppVariant*);
@@ -294,32 +234,6 @@ public:
void setAllowFileAccessFromFileURLs(const CppArgumentList&, CppVariant*);
void setAllowRunningOfInsecureContent(const CppArgumentList&, CppVariant*);
- void evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList&, CppVariant*);
- void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*);
- void setIsolatedWorldSecurityOrigin(const CppArgumentList&, CppVariant*);
- void setIsolatedWorldContentSecurityPolicy(const CppArgumentList&, CppVariant*);
-
- // The fallback method is called when a nonexistent method is called on
- // the layout test controller object.
- // It is usefull to catch typos in the JavaScript code (a few layout tests
- // do have typos in them) and it allows the script to continue running in
- // that case (as the Mac does).
- void fallbackMethod(const CppArgumentList&, CppVariant*);
-
- // Allows layout tests to manage origins' whitelisting.
- void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
- void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
-
- // Clears all application caches.
- void clearAllApplicationCaches(const CppArgumentList&, CppVariant*);
- // Clears an application cache for an origin.
- void clearApplicationCacheForOrigin(const CppArgumentList&, CppVariant*);
- // Returns origins that have application caches.
- void originsWithApplicationCache(const CppArgumentList&, CppVariant*);
- // Sets the application cache quota for the localhost origin.
- void setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant*);
- // Returns disk usage by all application caches for an origin.
- void applicationCacheDiskUsageForOrigin(const CppArgumentList&, CppVariant*);
// Clears all databases.
void clearAllDatabases(const CppArgumentList&, CppVariant*);
@@ -333,23 +247,12 @@ public:
// Causes layout to happen as if targetted to printed pages.
void setPrinting(const CppArgumentList&, CppVariant*);
- // Returns true if the current page box has custom page size style for
- // printing.
- void hasCustomPageSizeStyle(const CppArgumentList&, CppVariant*);
-
// Gets the number of geolocation permissions requests pending.
void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
// Allows layout tests to exec scripts at WebInspector side.
void evaluateInWebInspector(const CppArgumentList&, CppVariant*);
- // Forces the selection colors for testing under Linux.
- void forceRedSelectionColors(const CppArgumentList&, CppVariant*);
-
- // Adds a user script or user style sheet to be injected into new documents.
- void addUserScript(const CppArgumentList&, CppVariant*);
- void addUserStyleSheet(const CppArgumentList&, CppVariant*);
-
// DeviceOrientation related functions
void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
@@ -358,9 +261,6 @@ public:
void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
void setMockGeolocationPositionUnavailableError(const CppArgumentList&, CppVariant*);
- // Empty stub method to keep parity with object model exposed by global DRTTestRunner.
- void abortModal(const CppArgumentList&, CppVariant*);
-
// Speech input related functions.
#if ENABLE(INPUT_SPEECH)
void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);
@@ -371,30 +271,6 @@ public:
void setMockSpeechRecognitionError(const CppArgumentList&, CppVariant*);
void wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant*);
#endif
- void startSpeechInput(const CppArgumentList&, CppVariant*);
-
- void loseCompositorContext(const CppArgumentList& args, CppVariant* result);
-
- void markerTextForListItem(const CppArgumentList&, CppVariant*);
- void findString(const CppArgumentList&, CppVariant*);
-
- void setMinimumTimerInterval(const CppArgumentList&, CppVariant*);
-
- // Expects the first argument to be an input element and the second argument to be a boolean.
- // Forwards the setAutofilled() call to the element.
- void setAutofilled(const CppArgumentList&, CppVariant*);
-
- // Expects the first argument to be an input element and the second argument to be a string value.
- // Forwards the setValueForUser() call to the element.
- void setValueForUser(const CppArgumentList&, CppVariant*);
-
- // LocalStorage origin-related
- void deleteAllLocalStorage(const CppArgumentList&, CppVariant*);
- void originsWithLocalStorage(const CppArgumentList&, CppVariant*);
- void deleteLocalStorageForOrigin(const CppArgumentList&, CppVariant*);
- void localStorageDiskUsageForOrigin(const CppArgumentList&, CppVariant*);
- void observeStorageTrackerNotifications(const CppArgumentList&, CppVariant*);
- void syncLocalStorage(const CppArgumentList&, CppVariant*);
// WebPermissionClient related.
void setImagesAllowed(const CppArgumentList&, CppVariant*);
@@ -406,23 +282,8 @@ public:
// Enable or disable plugins.
void setPluginsEnabled(const CppArgumentList&, CppVariant*);
- // Switch the visibility of the page.
- void setPageVisibility(const CppArgumentList&, CppVariant*);
- void resetPageVisibility(const CppArgumentList&, CppVariant*);
-
- // Changes the direction of the focused element.
- void setTextDirection(const CppArgumentList&, CppVariant*);
-
void setShouldStayOnPageAfterHandlingBeforeUnload(const CppArgumentList&, CppVariant*);
- void enableFixedLayoutMode(const CppArgumentList&, CppVariant*);
- void setFixedLayoutSize(const CppArgumentList&, CppVariant*);
-
- void selectionAsMarkup(const CppArgumentList&, CppVariant*);
-
- // Switch the link detection.
- void setAutomaticLinkDetectionEnabled(bool);
-
#if ENABLE(POINTER_LOCK)
void didAcquirePointerLock(const CppArgumentList&, CppVariant*);
void didNotAcquirePointerLock(const CppArgumentList&, CppVariant*);
@@ -431,8 +292,6 @@ public:
void setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant*);
#endif
- void workerThreadCount(CppVariant*);
-
// Expects one string argument for sending successful result, zero
// arguments for sending a failure result.
void sendWebIntentResponse(const CppArgumentList&, CppVariant*);
@@ -440,22 +299,9 @@ public:
// Cause the web intent to be delivered to this context.
void deliverWebIntent(const CppArgumentList&, CppVariant*);
- // Enables or disables subpixel positioning (i.e. fractional X positions for
- // glyphs) in text rendering on Linux. Since this method changes global
- // settings, tests that call it must use their own custom font family for
- // all text that they render. If not, an already-cached style will be used,
- // resulting in the changed setting being ignored.
- void setTextSubpixelPositioning(const CppArgumentList&, CppVariant*);
-
// Used to set the device scale factor.
void setBackingScaleFactor(const CppArgumentList&, CppVariant*);
- // Retrieves the text surrounding a position in a text node.
- // Expects the first argument to be a text node, the second and third to be
- // point coordinates relative to the node and the fourth the maximum text
- // length to retrieve.
- void textSurroundingNode(const CppArgumentList&, CppVariant*);
-
public:
// The following methods are not exposed to JavaScript.
void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
@@ -484,9 +330,7 @@ public:
bool shouldGeneratePixelResults() { return m_generatePixelResults; }
void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; }
bool shouldDumpCreateView() { return m_dumpCreateView; }
- bool acceptsEditing() { return m_acceptsEditing; }
bool canOpenWindows() { return m_canOpenWindows; }
- bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
bool stopProvisionalFrameLoads() { return m_stopProvisionalFrameLoads; }
bool deferMainResourceDataLoad() { return m_deferMainResourceDataLoad; }
void setShowDebugLayerTree(bool value) { m_showDebugLayerTree = value; }
@@ -506,9 +350,6 @@ public:
bool testRepaint() const { return m_testRepaint; }
bool sweepHorizontally() const { return m_sweepHorizontally; }
- void setHasCustomFullScreenBehavior(const CppArgumentList&, CppVariant*);
- bool hasCustomFullScreenBehavior() const { return m_hasCustomFullScreenBehavior; }
-
// Called by the webview delegate when the toplevel frame load is done.
void locationChangeDone();
@@ -567,14 +408,6 @@ private:
bool m_frozen;
DRTTestRunner* m_controller;
};
-
- // Support for overridePreference.
- bool cppVariantToBool(const CppVariant&);
- int32_t cppVariantToInt32(const CppVariant&);
- WebKit::WebString cppVariantToWebString(const CppVariant&);
- Vector<WebKit::WebString> cppVariantToWebStringArray(const CppVariant&);
-
- void logErrorToConsole(const std::string&);
void completeNotifyDone(bool isTimeout);
class NotifyDoneTimedOutTask: public WebTestRunner::WebMethodTask<DRTTestRunner> {
public:
@@ -582,12 +415,6 @@ private:
virtual void runIfValid() { m_object->completeNotifyDone(true); }
};
-
- bool pauseAnimationAtTimeOnElementWithId(const WebKit::WebString& animationName, double time, const WebKit::WebString& elementId);
- bool pauseTransitionAtTimeOnElementWithId(const WebKit::WebString& propertyName, double time, const WebKit::WebString& elementId);
- bool elementDoesAutoCompleteForElementWithId(const WebKit::WebString&);
- int numberOfActiveAnimations();
-
// Used for test timeouts.
WebTestRunner::WebTaskList m_taskList;
@@ -658,11 +485,6 @@ private:
// is invoked.
bool m_dumpCreateView;
- // If true, the element will be treated as editable. This value is returned
- // from various editing callbacks that are called just before edit operations
- // are allowed.
- bool m_acceptsEditing;
-
// If true, new windows can be opened via javascript or by plugins. By
// default, set to false and can be toggled to true using
// setCanOpenWindows().
@@ -680,9 +502,6 @@ private:
// a series of 1px-wide, view-tall paints across the width of the view.
bool m_sweepHorizontally;
- // If true and a drag starts, adds a file to the drag&drop clipboard.
- bool m_shouldAddFileToPasteboard;
-
// If true, stops provisional frame loads during the
// DidStartProvisionalLoadForFrame callback.
bool m_stopProvisionalFrameLoads;
@@ -701,17 +520,12 @@ private:
WorkQueue m_workQueue;
- CppVariant m_globalFlag;
-
// Bound variable counting the number of top URLs visited.
CppVariant m_webHistoryItemCount;
// Bound variable tracking the directionality of the <title> tag.
CppVariant m_titleTextDirection;
- // Bound variable to return the name of this platform (chromium).
- CppVariant m_platformName;
-
// Bound variable to set whether postMessages should be intercepted or not
CppVariant m_interceptPostMessage;
@@ -724,10 +538,6 @@ private:
OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient;
bool m_shouldStayOnPageAfterHandlingBeforeUnload;
-
- // If true, calls to WebViewHost::enter/exitFullScreenNow will not result in
- // calls to Document::will/did/Enter/ExitFullScreen.
- bool m_hasCustomFullScreenBehavior;
};
#endif // DRTTestRunner_h
diff --git a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp
index 4410ef2f9..b7178f099 100644
--- a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp
+++ b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp
@@ -33,13 +33,11 @@
#include "MockWebMediaStreamCenter.h"
-#include <public/WebICECandidateDescriptor.h>
#include <public/WebMediaStreamCenterClient.h>
#include <public/WebMediaStreamComponent.h>
#include <public/WebMediaStreamDescriptor.h>
#include <public/WebMediaStreamSource.h>
#include <public/WebMediaStreamSourcesRequest.h>
-#include <public/WebSessionDescriptionDescriptor.h>
#include <public/WebVector.h>
using namespace WebKit;
@@ -91,24 +89,4 @@ void MockWebMediaStreamCenter::didCreateMediaStream(WebMediaStreamDescriptor&)
{
}
-WebString MockWebMediaStreamCenter::constructSDP(const WebICECandidateDescriptor& iceCandidate)
-{
- string16 result = iceCandidate.label();
- result += WebString(":");
- result += iceCandidate.candidateLine();
- result += WebString(";");
- return result;
-}
-
-WebString MockWebMediaStreamCenter::constructSDP(const WebSessionDescriptionDescriptor& sessionDescription)
-{
- string16 result = sessionDescription.initialSDP();
- result += WebString(";");
- for (size_t i = 0; i < sessionDescription.numberOfAddedCandidates(); ++i) {
- result += constructSDP(sessionDescription.candidate(i));
- result += WebString(";");
- }
- return result;
-}
-
#endif // ENABLE(MEDIA_STREAM)
diff --git a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h
index 286dc3f8d..7d532e743 100644
--- a/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h
+++ b/Tools/DumpRenderTree/chromium/MockWebMediaStreamCenter.h
@@ -49,8 +49,6 @@ public:
virtual bool didRemoveMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE;
virtual void didStopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE;
virtual void didCreateMediaStream(WebKit::WebMediaStreamDescriptor&) OVERRIDE;
- virtual WebKit::WebString constructSDP(const WebKit::WebICECandidateDescriptor&) OVERRIDE;
- virtual WebKit::WebString constructSDP(const WebKit::WebSessionDescriptionDescriptor&) OVERRIDE;
private:
MockWebMediaStreamCenter() { }
diff --git a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp
index ca1e6043f..cfd76de74 100644
--- a/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp
+++ b/Tools/DumpRenderTree/chromium/MockWebRTCPeerConnectionHandler.cpp
@@ -337,6 +337,11 @@ bool MockWebRTCPeerConnectionHandler::openDataChannel(const WebRTCDataChannel& d
if (m_stopped)
return false;
+ WebRTCDataChannel remoteDataChannel;
+ remoteDataChannel.initialize("MockRemoteDataChannel", dataChannel.reliable());
+ remoteDataChannel.readyStateChanged(WebRTCDataChannel::ReadyStateOpen);
+ m_client->didAddRemoteDataChannel(remoteDataChannel);
+
postTask(new DataChannelReadyStateTask(this, dataChannel, WebRTCDataChannel::ReadyStateOpen));
return true;
}
@@ -351,7 +356,7 @@ bool MockWebRTCPeerConnectionHandler::sendStringData(const WebRTCDataChannel& da
if (m_stopped)
return false;
- postTask(new StringDataTask(this, dataChannel, data));
+ dataChannel.dataArrived(data);
return true;
}
@@ -360,7 +365,7 @@ bool MockWebRTCPeerConnectionHandler::sendRawData(const WebRTCDataChannel& dataC
if (m_stopped)
return false;
- postTask(new CharPtrDataTask(this, dataChannel, data, length));
+ dataChannel.dataArrived(data, length);
return true;
}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h
new file mode 100644
index 000000000..b4a593cee
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2012 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 WebTestProxy_h
+#define WebTestProxy_h
+
+#include "Platform/chromium/public/WebRect.h"
+#include "WebKit/chromium/public/WebAccessibilityNotification.h"
+#include "WebKit/chromium/public/WebDragOperation.h"
+#include "WebKit/chromium/public/WebNavigationPolicy.h"
+
+namespace WebKit {
+class WebAccessibilityObject;
+class WebDragData;
+class WebFrame;
+class WebImage;
+struct WebPoint;
+struct WebSize;
+}
+
+namespace WebTestRunner {
+
+class WebTestDelegate;
+class WebTestInterfaces;
+
+class WebTestProxyBase {
+public:
+ void setInterfaces(WebTestInterfaces*);
+ void setDelegate(WebTestDelegate*);
+
+ void setPaintRect(const WebKit::WebRect&);
+ WebKit::WebRect paintRect() const;
+
+protected:
+ WebTestProxyBase();
+ ~WebTestProxyBase();
+
+ void didInvalidateRect(const WebKit::WebRect&);
+ void didScrollRect(int, int, const WebKit::WebRect&);
+ void scheduleComposite();
+ void scheduleAnimation();
+ void setWindowRect(const WebKit::WebRect&);
+ void show(WebKit::WebNavigationPolicy);
+ void didAutoResize(const WebKit::WebSize&);
+ void postAccessibilityNotification(const WebKit::WebAccessibilityObject&, WebKit::WebAccessibilityNotification);
+ void startDragging(WebKit::WebFrame*, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebImage&, const WebKit::WebPoint&);
+
+private:
+ WebTestInterfaces* m_testInterfaces;
+ WebTestDelegate* m_delegate;
+
+ WebKit::WebRect m_paintRect;
+};
+
+// Use this template to inject methods into your WebViewClient implementation
+// required for the running layout tests.
+template<class WebViewClientImpl, typename T>
+class WebTestProxy : public WebViewClientImpl, public WebTestProxyBase {
+public:
+ explicit WebTestProxy(T t)
+ : WebViewClientImpl(t)
+ {
+ }
+
+ virtual ~WebTestProxy() { }
+
+ virtual void didInvalidateRect(const WebKit::WebRect& rect)
+ {
+ WebTestProxyBase::didInvalidateRect(rect);
+ WebViewClientImpl::didInvalidateRect(rect);
+ }
+ virtual void didScrollRect(int dx, int dy, const WebKit::WebRect& clipRect)
+ {
+ WebTestProxyBase::didScrollRect(dx, dy, clipRect);
+ WebViewClientImpl::didScrollRect(dx, dy, clipRect);
+ }
+ virtual void scheduleComposite()
+ {
+ WebTestProxyBase::scheduleComposite();
+ WebViewClientImpl::scheduleComposite();
+ }
+ virtual void scheduleAnimation()
+ {
+ WebTestProxyBase::scheduleAnimation();
+ WebViewClientImpl::scheduleAnimation();
+ }
+ virtual void setWindowRect(const WebKit::WebRect& rect)
+ {
+ WebTestProxyBase::setWindowRect(rect);
+ WebViewClientImpl::setWindowRect(rect);
+ }
+ virtual void show(WebKit::WebNavigationPolicy policy)
+ {
+ WebTestProxyBase::show(policy);
+ WebViewClientImpl::show(policy);
+ }
+ virtual void didAutoResize(const WebKit::WebSize& newSize)
+ {
+ WebTestProxyBase::didAutoResize(newSize);
+ WebViewClientImpl::didAutoResize(newSize);
+ }
+ virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject& object, WebKit::WebAccessibilityNotification notification)
+ {
+ WebTestProxyBase::postAccessibilityNotification(object, notification);
+ WebViewClientImpl::postAccessibilityNotification(object, notification);
+ }
+ virtual void startDragging(WebKit::WebFrame* frame, const WebKit::WebDragData& data, WebKit::WebDragOperationsMask mask, const WebKit::WebImage& image, const WebKit::WebPoint& point)
+ {
+ WebTestProxyBase::startDragging(frame, data, mask, image, point);
+ WebViewClientImpl::startDragging(frame, data, mask, image, point);
+ }
+};
+
+}
+
+#endif // WebTestProxy_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h
index 35bf06c56..a9728c615 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityControllerChromium.h
@@ -40,10 +40,10 @@ class WebFrame;
class WebView;
}
-class TestDelegate;
-
namespace WebTestRunner {
+class TestDelegate;
+
class AccessibilityController : public CppBoundClass {
public:
AccessibilityController();
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp
index 2157ddb69..7b8f6fbd1 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp
@@ -42,9 +42,13 @@
using namespace WebKit;
using namespace std;
+namespace WebTestRunner {
+
+namespace {
+
// Map role value to string, matching Safari/Mac platform implementation to
// avoid rebaselining layout tests.
-static string roleToString(WebAccessibilityRole role)
+string roleToString(WebAccessibilityRole role)
{
string result = "AXRole: AX";
switch (role) {
@@ -347,6 +351,8 @@ private:
string m_attributes;
};
+}
+
AccessibilityUIElement::AccessibilityUIElement(const WebAccessibilityObject& object, Factory* factory)
: m_accessibilityObject(object)
, m_factory(factory)
@@ -972,3 +978,5 @@ AccessibilityUIElement* AccessibilityUIElementList::createRoot(const WebAccessib
m_elements.append(element);
return element;
}
+
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h
index d9e73e57e..4dc479e93 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h
@@ -36,6 +36,8 @@
#include <vector>
#include <wtf/Vector.h>
+namespace WebTestRunner {
+
class AccessibilityUIElement : public CppBoundClass {
public:
class Factory {
@@ -166,4 +168,6 @@ private:
ElementList m_elements;
};
+}
+
#endif // AccessibilityUIElementChromium_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp
index 1b29d2b0f..930de6113 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp
@@ -51,6 +51,10 @@
using namespace WebKit;
using namespace std;
+namespace WebTestRunner {
+
+namespace {
+
class CppVariantPropertyCallback : public CppBoundClass::PropertyCallback {
public:
CppVariantPropertyCallback(CppVariant* value) : m_value(value) { }
@@ -90,6 +94,8 @@ private:
OwnPtr<CppBoundClass::GetterCallback> m_callback;
};
+}
+
// Our special NPObject type. We extend an NPObject with a pointer to a
// CppBoundClass, which is just a C++ interface that we forward all NPObject
// callbacks to.
@@ -350,3 +356,5 @@ void CppBoundClass::bindToJavascript(WebFrame* frame, const WebString& classname
frame->bindToWindowObject(classname, NPVARIANT_TO_OBJECT(*getAsCppVariant()));
m_boundToFrame = true;
}
+
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h
index 4fb5361e1..54af6ddce 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h
@@ -55,6 +55,8 @@ class WebFrame;
class WebString;
}
+namespace WebTestRunner {
+
typedef Vector<CppVariant> CppArgumentList;
// CppBoundClass lets you map Javascript method calls and property accesses
@@ -242,4 +244,6 @@ private:
bool m_boundToFrame;
};
+}
+
#endif // CppBoundClass_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp
index b587d75aa..4d2856e74 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp
@@ -39,6 +39,8 @@
using namespace WebKit;
using namespace std;
+namespace WebTestRunner {
+
CppVariant::CppVariant()
{
type = NPVariantType_Null;
@@ -319,3 +321,5 @@ bool CppVariant::invokeDefault(const CppVariant* arguments, uint32_t argumentCou
result.set(r);
return status;
}
+
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h
index 47fd466af..e82a70b66 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h
@@ -46,6 +46,8 @@
#include <string>
#include <wtf/Vector.h>
+namespace WebTestRunner {
+
class CppVariant : public NPVariant {
public:
CppVariant();
@@ -137,4 +139,6 @@ public:
uint32_t argumentCount, CppVariant& result) const;
};
+}
+
#endif // CppVariant_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
index 77fcb76e8..171e25ddb 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
@@ -836,14 +836,19 @@ void EventSender::contextClick(const CppArgumentList& arguments, CppVariant* res
// Generate right mouse down and up.
WebMouseEvent event;
- pressedButton = WebMouseEvent::ButtonRight;
+ // This is a hack to work around only allowing a single pressed button since we want to
+ // test the case where both the left and right mouse buttons are pressed.
+ if (pressedButton == WebMouseEvent::ButtonNone)
+ pressedButton = WebMouseEvent::ButtonRight;
initMouseEvent(WebInputEvent::MouseDown, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate));
webview()->handleInputEvent(event);
+#if OS(WINDOWS)
initMouseEvent(WebInputEvent::MouseUp, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate));
webview()->handleInputEvent(event);
pressedButton = WebMouseEvent::ButtonNone;
+#endif
WebContextMenuData* lastContextMenu = m_delegate->lastContextMenuData();
result->set(WebBindings::makeStringArray(makeMenuItemStringsFor(lastContextMenu, m_delegate)));
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h
index d07e14cc6..c5d742b5f 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.h
@@ -48,10 +48,10 @@ class WebDragData;
class WebView;
}
-class TestDelegate;
-
namespace WebTestRunner {
+class TestDelegate;
+
class EventSender : public CppBoundClass {
public:
EventSender();
@@ -69,6 +69,7 @@ public:
void dumpFilenameBeingDragged(const CppArgumentList&, CppVariant*);
// JS callback methods.
+ void contextClick(const CppArgumentList&, CppVariant*);
void mouseDown(const CppArgumentList&, CppVariant*);
void mouseUp(const CppArgumentList&, CppVariant*);
void mouseMoveTo(const CppArgumentList&, CppVariant*);
@@ -114,7 +115,6 @@ public:
void gestureEvent(WebKit::WebInputEvent::Type, const CppArgumentList&);
// Unimplemented stubs
- void contextClick(const CppArgumentList&, CppVariant*);
void enableDOMUIEventLogging(const CppArgumentList&, CppVariant*);
void fireKeyboardEventsToElement(const CppArgumentList&, CppVariant*);
void clearKillRing(const CppArgumentList&, CppVariant*);
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp
index 282ce44de..e9c246af2 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.cpp
@@ -34,6 +34,8 @@
using namespace WebKit;
+namespace WebTestRunner {
+
GamepadController::GamepadController()
{
bindMethod("connect", &GamepadController::connect);
@@ -193,3 +195,5 @@ void GamepadController::fallbackCallback(const CppArgumentList&, CppVariant* res
m_delegate->printMessage("CONSOLE MESSAGE: JavaScript ERROR: unknown method called on GamepadController\n");
result->setNull();
}
+
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h
index 4e65e922f..9058c702d 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/GamepadController.h
@@ -34,13 +34,15 @@
#include "CppBoundClass.h"
#include "platform/WebGamepads.h"
-class TestDelegate;
-
namespace WebKit {
class WebGamepads;
class WebFrame;
}
+namespace WebTestRunner {
+
+class TestDelegate;
+
class GamepadController : public CppBoundClass {
public:
GamepadController();
@@ -65,4 +67,6 @@ private:
TestDelegate* m_delegate;
};
+}
+
#endif // GamepadController_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h
index 0498fcb3f..f8eceb6d0 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestDelegate.h
@@ -40,8 +40,8 @@ class WebGamepads;
}
namespace WebTestRunner {
+
class WebTask;
-}
class TestDelegate {
public:
@@ -52,11 +52,13 @@ public:
virtual WebKit::WebContextMenuData* lastContextMenuData() const = 0;
virtual void setGamepadData(const WebKit::WebGamepads&) = 0;
virtual void printMessage(const std::string& message) = 0;
- virtual void postTask(WebTestRunner::WebTask*) = 0;
- virtual void postDelayedTask(WebTestRunner::WebTask*, long long ms) = 0;
+ virtual void postTask(WebTask*) = 0;
+ virtual void postDelayedTask(WebTask*, long long ms) = 0;
virtual WebKit::WebString registerIsolatedFileSystem(const WebKit::WebVector<WebKit::WebString>& absoluteFilenames) = 0;
virtual long long getCurrentTimeInMillisecond() = 0;
virtual WebKit::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0;
};
+}
+
#endif // TestDelegate_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp
index 8959bb1ba..f08da5d40 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp
@@ -37,12 +37,12 @@
#include "TextInputController.h"
#include "platform/WebString.h"
-using WebTestRunner::AccessibilityController;
-using WebTestRunner::EventSender;
using WebKit::WebFrame;
using WebKit::WebString;
using WebKit::WebView;
+namespace WebTestRunner {
+
TestInterfaces::TestInterfaces()
{
m_accessibilityController = adoptPtr(new AccessibilityController());
@@ -105,3 +105,5 @@ EventSender* TestInterfaces::eventSender()
{
return m_eventSender.get();
}
+
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h
index 228658c22..a7da43283 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h
@@ -39,10 +39,9 @@ class WebView;
}
namespace WebTestRunner {
+
class AccessibilityController;
class EventSender;
-}
-
class GamepadController;
class TestDelegate;
class TextInputController;
@@ -57,14 +56,16 @@ public:
void bindTo(WebKit::WebFrame*);
void resetAll();
- WebTestRunner::AccessibilityController* accessibilityController();
- WebTestRunner::EventSender* eventSender();
+ AccessibilityController* accessibilityController();
+ EventSender* eventSender();
private:
- OwnPtr<WebTestRunner::AccessibilityController> m_accessibilityController;
- OwnPtr<WebTestRunner::EventSender> m_eventSender;
+ OwnPtr<AccessibilityController> m_accessibilityController;
+ OwnPtr<EventSender> m_eventSender;
OwnPtr<GamepadController> m_gamepadController;
OwnPtr<TextInputController> m_textInputController;
};
+}
+
#endif // TestInterfaces_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
index f0da79831..37078927d 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
@@ -32,6 +32,714 @@
#include "config.h"
#include "TestRunner.h"
+#include "WebAnimationController.h"
+#include "WebBindings.h"
+#include "WebDocument.h"
+#include "WebElement.h"
+#include "WebFindOptions.h"
+#include "WebFrame.h"
+#include "WebInputElement.h"
+#include "WebScriptSource.h"
+#include "WebSecurityPolicy.h"
+#include "WebSettings.h"
+#include "WebSurroundingText.h"
+#include "WebTestDelegate.h"
+#include "WebView.h"
+#include "WebWorkerInfo.h"
+#include "platform/WebPoint.h"
+#include "v8/include/v8.h"
+
+#if OS(LINUX) || OS(ANDROID)
+#include "linux/WebFontRendering.h"
+#endif
+
+using namespace WebKit;
+using namespace std;
+
+namespace WebTestRunner {
+
TestRunner::TestRunner()
+ : m_delegate(0)
+ , m_webView(0)
+{
+ // Methods implemented in terms of chromium's public WebKit API.
+ bindMethod("setTabKeyCyclesThroughElements", &TestRunner::setTabKeyCyclesThroughElements);
+ bindMethod("setAsynchronousSpellCheckingEnabled", &TestRunner::setAsynchronousSpellCheckingEnabled);
+ bindMethod("execCommand", &TestRunner::execCommand);
+ bindMethod("isCommandEnabled", &TestRunner::isCommandEnabled);
+ bindMethod("pauseAnimationAtTimeOnElementWithId", &TestRunner::pauseAnimationAtTimeOnElementWithId);
+ bindMethod("pauseTransitionAtTimeOnElementWithId", &TestRunner::pauseTransitionAtTimeOnElementWithId);
+ bindMethod("elementDoesAutoCompleteForElementWithId", &TestRunner::elementDoesAutoCompleteForElementWithId);
+ bindMethod("numberOfActiveAnimations", &TestRunner::numberOfActiveAnimations);
+ bindMethod("callShouldCloseOnWebView", &TestRunner::callShouldCloseOnWebView);
+ bindMethod("setDomainRelaxationForbiddenForURLScheme", &TestRunner::setDomainRelaxationForbiddenForURLScheme);
+ bindMethod("evaluateScriptInIsolatedWorldAndReturnValue", &TestRunner::evaluateScriptInIsolatedWorldAndReturnValue);
+ bindMethod("evaluateScriptInIsolatedWorld", &TestRunner::evaluateScriptInIsolatedWorld);
+ bindMethod("setIsolatedWorldSecurityOrigin", &TestRunner::setIsolatedWorldSecurityOrigin);
+ bindMethod("setIsolatedWorldContentSecurityPolicy", &TestRunner::setIsolatedWorldContentSecurityPolicy);
+ bindMethod("addOriginAccessWhitelistEntry", &TestRunner::addOriginAccessWhitelistEntry);
+ bindMethod("removeOriginAccessWhitelistEntry", &TestRunner::removeOriginAccessWhitelistEntry);
+ bindMethod("hasCustomPageSizeStyle", &TestRunner::hasCustomPageSizeStyle);
+ bindMethod("forceRedSelectionColors", &TestRunner::forceRedSelectionColors);
+ bindMethod("addUserScript", &TestRunner::addUserScript);
+ bindMethod("addUserStyleSheet", &TestRunner::addUserStyleSheet);
+ bindMethod("startSpeechInput", &TestRunner::startSpeechInput);
+ bindMethod("loseCompositorContext", &TestRunner::loseCompositorContext);
+ bindMethod("markerTextForListItem", &TestRunner::markerTextForListItem);
+ bindMethod("findString", &TestRunner::findString);
+ bindMethod("setMinimumTimerInterval", &TestRunner::setMinimumTimerInterval);
+ bindMethod("setAutofilled", &TestRunner::setAutofilled);
+ bindMethod("setValueForUser", &TestRunner::setValueForUser);
+ bindMethod("enableFixedLayoutMode", &TestRunner::enableFixedLayoutMode);
+ bindMethod("setFixedLayoutSize", &TestRunner::setFixedLayoutSize);
+ bindMethod("selectionAsMarkup", &TestRunner::selectionAsMarkup);
+ bindMethod("setTextSubpixelPositioning", &TestRunner::setTextSubpixelPositioning);
+ bindMethod("resetPageVisibility", &TestRunner::resetPageVisibility);
+ bindMethod("setPageVisibility", &TestRunner::setPageVisibility);
+ bindMethod("setTextDirection", &TestRunner::setTextDirection);
+ bindMethod("textSurroundingNode", &TestRunner::textSurroundingNode);
+
+ // Properties.
+ bindProperty("workerThreadCount", &TestRunner::workerThreadCount);
+ bindProperty("globalFlag", &m_globalFlag);
+ bindProperty("platformName", &m_platformName);
+
+ // The following are stubs.
+ bindMethod("dumpDatabaseCallbacks", &TestRunner::notImplemented);
+#if ENABLE(NOTIFICATIONS)
+ bindMethod("denyWebNotificationPermission", &TestRunner::notImplemented);
+ bindMethod("removeAllWebNotificationPermissions", &TestRunner::notImplemented);
+ bindMethod("simulateWebNotificationClick", &TestRunner::notImplemented);
+#endif
+ bindMethod("setIconDatabaseEnabled", &TestRunner::notImplemented);
+ bindMethod("setScrollbarPolicy", &TestRunner::notImplemented);
+ bindMethod("clearAllApplicationCaches", &TestRunner::notImplemented);
+ bindMethod("clearApplicationCacheForOrigin", &TestRunner::notImplemented);
+ bindMethod("clearBackForwardList", &TestRunner::notImplemented);
+ bindMethod("keepWebHistory", &TestRunner::notImplemented);
+ bindMethod("setApplicationCacheOriginQuota", &TestRunner::notImplemented);
+ bindMethod("setCallCloseOnWebViews", &TestRunner::notImplemented);
+ bindMethod("setMainFrameIsFirstResponder", &TestRunner::notImplemented);
+ bindMethod("setPrivateBrowsingEnabled", &TestRunner::notImplemented);
+ bindMethod("setUseDashboardCompatibilityMode", &TestRunner::notImplemented);
+ bindMethod("deleteAllLocalStorage", &TestRunner::notImplemented);
+ bindMethod("localStorageDiskUsageForOrigin", &TestRunner::notImplemented);
+ bindMethod("originsWithLocalStorage", &TestRunner::notImplemented);
+ bindMethod("deleteLocalStorageForOrigin", &TestRunner::notImplemented);
+ bindMethod("observeStorageTrackerNotifications", &TestRunner::notImplemented);
+ bindMethod("syncLocalStorage", &TestRunner::notImplemented);
+ bindMethod("addDisallowedURL", &TestRunner::notImplemented);
+ bindMethod("applicationCacheDiskUsageForOrigin", &TestRunner::notImplemented);
+ bindMethod("abortModal", &TestRunner::notImplemented);
+
+ // The fallback method is called when an unknown method is invoked.
+ bindFallbackMethod(&TestRunner::fallbackMethod);
+}
+
+void TestRunner::reset()
+{
+ if (m_webView) {
+ m_webView->setZoomLevel(false, 0);
+ m_webView->setTabKeyCyclesThroughElements(true);
+#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_webView->setSelectionColors(0xff1e90ff, 0xff000000, 0xffc8c8c8, 0xff323232);
+#endif
+ m_webView->removeAllUserContent();
+ m_webView->disableAutoResizeMode();
+ }
+ WebSecurityPolicy::resetOriginAccessWhitelists();
+#if OS(LINUX) || OS(ANDROID)
+ WebFontRendering::setSubpixelPositioning(false);
+#endif
+
+ m_globalFlag.set(false);
+ m_platformName.set("chromium");
+}
+
+void TestRunner::setTabKeyCyclesThroughElements(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() > 0 && arguments[0].isBool())
+ m_webView->setTabKeyCyclesThroughElements(arguments[0].toBoolean());
+ result->setNull();
+}
+
+void TestRunner::setAsynchronousSpellCheckingEnabled(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() > 0 && arguments[0].isBool())
+ m_webView->settings()->setAsynchronousSpellCheckingEnabled(cppVariantToBool(arguments[0]));
+ result->setNull();
+}
+
+void TestRunner::execCommand(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() <= 0 || !arguments[0].isString())
+ return;
+
+ std::string command = arguments[0].toString();
+ std::string value("");
+ // Ignore the second parameter (which is userInterface)
+ // since this command emulates a manual action.
+ if (arguments.size() >= 3 && arguments[2].isString())
+ value = arguments[2].toString();
+
+ // Note: webkit's version does not return the boolean, so neither do we.
+ m_webView->focusedFrame()->executeCommand(WebString::fromUTF8(command), WebString::fromUTF8(value));
+}
+
+void TestRunner::isCommandEnabled(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() <= 0 || !arguments[0].isString()) {
+ result->setNull();
+ return;
+ }
+
+ std::string command = arguments[0].toString();
+ bool rv = m_webView->focusedFrame()->isCommandEnabled(WebString::fromUTF8(command));
+ result->set(rv);
+}
+
+bool TestRunner::pauseAnimationAtTimeOnElementWithId(const WebString& animationName, double time, const WebString& elementId)
+{
+ WebFrame* webFrame = m_webView->mainFrame();
+ if (!webFrame)
+ return false;
+
+ WebAnimationController* controller = webFrame->animationController();
+ if (!controller)
+ return false;
+
+ WebElement element = webFrame->document().getElementById(elementId);
+ if (element.isNull())
+ return false;
+ return controller->pauseAnimationAtTime(element, animationName, time);
+}
+
+bool TestRunner::pauseTransitionAtTimeOnElementWithId(const WebString& propertyName, double time, const WebString& elementId)
+{
+ WebFrame* webFrame = m_webView->mainFrame();
+ if (!webFrame)
+ return false;
+
+ WebAnimationController* controller = webFrame->animationController();
+ if (!controller)
+ return false;
+
+ WebElement element = webFrame->document().getElementById(elementId);
+ if (element.isNull())
+ return false;
+ return controller->pauseTransitionAtTime(element, propertyName, time);
+}
+
+bool TestRunner::elementDoesAutoCompleteForElementWithId(const WebString& elementId)
+{
+ WebFrame* webFrame = m_webView->mainFrame();
+ if (!webFrame)
+ return false;
+
+ WebElement element = webFrame->document().getElementById(elementId);
+ if (element.isNull() || !element.hasTagName("input"))
+ return false;
+
+ WebInputElement inputElement = element.to<WebInputElement>();
+ return inputElement.autoComplete();
+}
+
+int TestRunner::numberOfActiveAnimations()
+{
+ WebFrame* webFrame = m_webView->mainFrame();
+ if (!webFrame)
+ return -1;
+
+ WebAnimationController* controller = webFrame->animationController();
+ if (!controller)
+ return -1;
+
+ return controller->numberOfActiveAnimations();
+}
+
+void TestRunner::pauseAnimationAtTimeOnElementWithId(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->set(false);
+ if (arguments.size() > 2 && arguments[0].isString() && arguments[1].isNumber() && arguments[2].isString()) {
+ WebString animationName = cppVariantToWebString(arguments[0]);
+ double time = arguments[1].toDouble();
+ WebString elementId = cppVariantToWebString(arguments[2]);
+ result->set(pauseAnimationAtTimeOnElementWithId(animationName, time, elementId));
+ }
+}
+
+void TestRunner::pauseTransitionAtTimeOnElementWithId(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->set(false);
+ if (arguments.size() > 2 && arguments[0].isString() && arguments[1].isNumber() && arguments[2].isString()) {
+ WebString propertyName = cppVariantToWebString(arguments[0]);
+ double time = arguments[1].toDouble();
+ WebString elementId = cppVariantToWebString(arguments[2]);
+ result->set(pauseTransitionAtTimeOnElementWithId(propertyName, time, elementId));
+ }
+}
+
+void TestRunner::elementDoesAutoCompleteForElementWithId(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() != 1 || !arguments[0].isString()) {
+ result->set(false);
+ return;
+ }
+ WebString elementId = cppVariantToWebString(arguments[0]);
+ result->set(elementDoesAutoCompleteForElementWithId(elementId));
+}
+
+void TestRunner::numberOfActiveAnimations(const CppArgumentList&, CppVariant* result)
+{
+ result->set(numberOfActiveAnimations());
+}
+
+void TestRunner::callShouldCloseOnWebView(const CppArgumentList&, CppVariant* result)
+{
+ result->set(m_webView->dispatchBeforeUnloadEvent());
+}
+
+void TestRunner::setDomainRelaxationForbiddenForURLScheme(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() != 2 || !arguments[0].isBool() || !arguments[1].isString())
+ return;
+ m_webView->setDomainRelaxationForbidden(cppVariantToBool(arguments[0]), cppVariantToWebString(arguments[1]));
+}
+
+void TestRunner::evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList& arguments, CppVariant* result)
+{
+ v8::HandleScope scope;
+ WebVector<v8::Local<v8::Value> > values;
+ if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) {
+ WebScriptSource source(cppVariantToWebString(arguments[1]));
+ // This relies on the iframe focusing itself when it loads. This is a bit
+ // sketchy, but it seems to be what other tests do.
+ m_webView->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1, &values);
+ }
+ result->setNull();
+ // Since only one script was added, only one result is expected
+ if (values.size() == 1 && !values[0].IsEmpty()) {
+ v8::Local<v8::Value> scriptValue = values[0];
+ // FIXME: There are many more types that can be handled.
+ if (scriptValue->IsString()) {
+ v8::String::AsciiValue asciiV8(scriptValue);
+ result->set(std::string(*asciiV8));
+ } else if (scriptValue->IsBoolean())
+ result->set(scriptValue->ToBoolean()->Value());
+ else if (scriptValue->IsNumber()) {
+ if (scriptValue->IsInt32())
+ result->set(scriptValue->ToInt32()->Value());
+ else
+ result->set(scriptValue->ToNumber()->Value());
+ } else if (scriptValue->IsNull())
+ result->setNull();
+ }
+}
+
+void TestRunner::evaluateScriptInIsolatedWorld(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() >= 2 && arguments[0].isNumber() && arguments[1].isString()) {
+ WebScriptSource source(cppVariantToWebString(arguments[1]));
+ // This relies on the iframe focusing itself when it loads. This is a bit
+ // sketchy, but it seems to be what other tests do.
+ m_webView->focusedFrame()->executeScriptInIsolatedWorld(arguments[0].toInt32(), &source, 1, 1);
+ }
+ result->setNull();
+}
+
+void TestRunner::setIsolatedWorldSecurityOrigin(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ if (arguments.size() != 2 || !arguments[0].isNumber() || !(arguments[1].isString() || arguments[1].isNull()))
+ return;
+
+ WebSecurityOrigin origin;
+ if (arguments[1].isString())
+ origin = WebSecurityOrigin::createFromString(cppVariantToWebString(arguments[1]));
+ m_webView->focusedFrame()->setIsolatedWorldSecurityOrigin(arguments[0].toInt32(), origin);
+}
+
+void TestRunner::setIsolatedWorldContentSecurityPolicy(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+
+ if (arguments.size() != 2 || !arguments[0].isNumber() || !arguments[1].isString())
+ return;
+
+ m_webView->focusedFrame()->setIsolatedWorldContentSecurityPolicy(arguments[0].toInt32(), cppVariantToWebString(arguments[1]));
+}
+
+void TestRunner::addOriginAccessWhitelistEntry(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::addOriginAccessWhitelistEntry(
+ url,
+ cppVariantToWebString(arguments[1]),
+ cppVariantToWebString(arguments[2]),
+ arguments[3].toBoolean());
+}
+
+void TestRunner::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,
+ cppVariantToWebString(arguments[1]),
+ cppVariantToWebString(arguments[2]),
+ arguments[3].toBoolean());
+}
+
+void TestRunner::hasCustomPageSizeStyle(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->set(false);
+ int pageIndex = 0;
+ if (arguments.size() > 1)
+ return;
+ if (arguments.size() == 1)
+ pageIndex = cppVariantToInt32(arguments[0]);
+ WebFrame* frame = m_webView->mainFrame();
+ if (!frame)
+ return;
+ result->set(frame->hasCustomPageSizeStyle(pageIndex));
+}
+
+void TestRunner::forceRedSelectionColors(const CppArgumentList& arguments, CppVariant* result)
{
+ result->setNull();
+ m_webView->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0);
+}
+
+void TestRunner::addUserScript(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isBool() || !arguments[2].isBool())
+ return;
+ WebView::addUserScript(
+ cppVariantToWebString(arguments[0]), WebVector<WebString>(),
+ arguments[1].toBoolean() ? WebView::UserScriptInjectAtDocumentStart : WebView::UserScriptInjectAtDocumentEnd,
+ arguments[2].toBoolean() ? WebView::UserContentInjectInAllFrames : WebView::UserContentInjectInTopFrameOnly);
+}
+
+void TestRunner::addUserStyleSheet(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isBool())
+ return;
+ WebView::addUserStyleSheet(
+ cppVariantToWebString(arguments[0]), WebVector<WebString>(),
+ arguments[1].toBoolean() ? WebView::UserContentInjectInAllFrames : WebView::UserContentInjectInTopFrameOnly,
+ // Chromium defaults to InjectInSubsequentDocuments, but for compatibility
+ // with the other ports' DRTs, we use UserStyleInjectInExistingDocuments.
+ WebView::UserStyleInjectInExistingDocuments);
+}
+
+void TestRunner::startSpeechInput(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() != 1)
+ return;
+
+ WebElement element;
+ if (!WebBindings::getElement(arguments[0].value.objectValue, &element))
+ return;
+
+ WebInputElement* input = toWebInputElement(&element);
+ if (!input)
+ return;
+
+ if (!input->isSpeechInputEnabled())
+ return;
+
+ input->startSpeechInput();
+}
+
+void TestRunner::loseCompositorContext(const CppArgumentList& args, CppVariant*)
+{
+ int numTimes;
+ if (args.size() == 1 || !args[0].isNumber())
+ numTimes = 1;
+ else
+ numTimes = args[0].toInt32();
+ m_webView->loseCompositorContext(numTimes);
+}
+
+void TestRunner::markerTextForListItem(const CppArgumentList& args, CppVariant* result)
+{
+ WebElement element;
+ if (!WebBindings::getElement(args[0].value.objectValue, &element))
+ result->setNull();
+ else
+ result->set(element.document().frame()->markerTextForListItem(element).utf8());
+}
+
+void TestRunner::findString(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() < 1 || !arguments[0].isString())
+ return;
+
+ WebFindOptions findOptions;
+ bool wrapAround = false;
+ if (arguments.size() >= 2) {
+ Vector<std::string> optionsArray = arguments[1].toStringVector();
+ findOptions.matchCase = true;
+
+ for (size_t i = 0; i < optionsArray.size(); ++i) {
+ const std::string& option = optionsArray[i];
+ // FIXME: Support all the options, so we can run findString.html too.
+ if (option == "CaseInsensitive")
+ findOptions.matchCase = false;
+ else if (option == "Backwards")
+ findOptions.forward = false;
+ else if (option == "WrapAround")
+ wrapAround = true;
+ }
+ }
+
+ WebFrame* frame = m_webView->mainFrame();
+ const bool findResult = frame->find(0, cppVariantToWebString(arguments[0]), findOptions, wrapAround, 0);
+ result->set(findResult);
+}
+
+void TestRunner::setMinimumTimerInterval(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 1 || !arguments[0].isNumber())
+ return;
+ m_webView->settings()->setMinimumTimerInterval(arguments[0].toDouble());
+}
+
+void TestRunner::setAutofilled(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() != 2 || !arguments[1].isBool())
+ return;
+
+ WebElement element;
+ if (!WebBindings::getElement(arguments[0].value.objectValue, &element))
+ return;
+
+ WebInputElement* input = toWebInputElement(&element);
+ if (!input)
+ return;
+
+ input->setAutofilled(arguments[1].value.boolValue);
+}
+
+void TestRunner::setValueForUser(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() != 2)
+ return;
+
+ WebElement element;
+ if (!WebBindings::getElement(arguments[0].value.objectValue, &element))
+ return;
+
+ WebInputElement* input = toWebInputElement(&element);
+ if (!input)
+ return;
+
+ input->setValue(cppVariantToWebString(arguments[1]), true);
+}
+
+void TestRunner::enableFixedLayoutMode(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 1 || !arguments[0].isBool())
+ return;
+ bool enableFixedLayout = arguments[0].toBoolean();
+ m_webView->enableFixedLayoutMode(enableFixedLayout);
+}
+
+void TestRunner::setFixedLayoutSize(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isNumber())
+ return;
+ int width = arguments[0].toInt32();
+ int height = arguments[1].toInt32();
+ m_webView->setFixedLayoutSize(WebSize(width, height));
+}
+
+void TestRunner::selectionAsMarkup(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->set(m_webView->mainFrame()->selectionAsMarkup().utf8());
+}
+
+void TestRunner::setTextSubpixelPositioning(const CppArgumentList& arguments, CppVariant* result)
+{
+#if OS(LINUX) || OS(ANDROID)
+ // Since FontConfig doesn't provide a variable to control subpixel positioning, we'll fall back
+ // to setting it globally for all fonts.
+ if (arguments.size() > 0 && arguments[0].isBool())
+ WebFontRendering::setSubpixelPositioning(arguments[0].value.boolValue);
+#endif
+ result->setNull();
+}
+
+void TestRunner::resetPageVisibility(const CppArgumentList& arguments, CppVariant* result)
+{
+ m_webView->setVisibilityState(WebPageVisibilityStateVisible, true);
+}
+
+void TestRunner::setPageVisibility(const CppArgumentList& arguments, CppVariant* result)
+{
+ if (arguments.size() > 0 && arguments[0].isString()) {
+ string newVisibility = arguments[0].toString();
+ if (newVisibility == "visible")
+ m_webView->setVisibilityState(WebPageVisibilityStateVisible, false);
+ else if (newVisibility == "hidden")
+ m_webView->setVisibilityState(WebPageVisibilityStateHidden, false);
+ else if (newVisibility == "prerender")
+ m_webView->setVisibilityState(WebPageVisibilityStatePrerender, false);
+ else if (newVisibility == "preview")
+ m_webView->setVisibilityState(WebPageVisibilityStatePreview, false);
+ }
+}
+
+void TestRunner::setTextDirection(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() != 1 || !arguments[0].isString())
+ return;
+
+ // Map a direction name to a WebTextDirection value.
+ std::string directionName = arguments[0].toString();
+ WebKit::WebTextDirection direction;
+ if (directionName == "auto")
+ direction = WebKit::WebTextDirectionDefault;
+ else if (directionName == "rtl")
+ direction = WebKit::WebTextDirectionRightToLeft;
+ else if (directionName == "ltr")
+ direction = WebKit::WebTextDirectionLeftToRight;
+ else
+ return;
+
+ m_webView->setTextDirection(direction);
+}
+
+void TestRunner::textSurroundingNode(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 4 || !arguments[0].isObject() || !arguments[1].isNumber() || !arguments[2].isNumber() || !arguments[3].isNumber())
+ return;
+
+ WebNode node;
+ if (!WebBindings::getNode(arguments[0].value.objectValue, &node))
+ return;
+
+ if (node.isNull() || !node.isTextNode())
+ return;
+
+ WebPoint point(arguments[1].toInt32(), arguments[2].toInt32());
+ unsigned maxLength = arguments[3].toInt32();
+
+ WebSurroundingText surroundingText;
+ surroundingText.initialize(node, point, maxLength);
+ if (surroundingText.isNull())
+ return;
+
+ result->set(surroundingText.textContent().utf8());
+}
+
+void TestRunner::workerThreadCount(CppVariant* result)
+{
+ result->set(static_cast<int>(WebWorkerInfo::dedicatedWorkerCount()));
+}
+
+// Need these conversions because the format of the value for booleans
+// may vary - for example, on mac "1" and "0" are used for boolean.
+bool TestRunner::cppVariantToBool(const CppVariant& value)
+{
+ if (value.isBool())
+ return value.toBoolean();
+ if (value.isNumber())
+ return value.toInt32();
+ if (value.isString()) {
+ string valueString = value.toString();
+ if (valueString == "true" || valueString == "1")
+ return true;
+ if (valueString == "false" || valueString == "0")
+ return false;
+ }
+ printErrorMessage("Invalid value. Expected boolean value.");
+ return false;
+}
+
+int32_t TestRunner::cppVariantToInt32(const CppVariant& value)
+{
+ if (value.isNumber())
+ return value.toInt32();
+ if (value.isString()) {
+ string stringSource = value.toString();
+ const char* source = stringSource.data();
+ char* end;
+ long number = strtol(source, &end, 10);
+ if (end == source + stringSource.length() && number >= numeric_limits<int32_t>::min() && number <= numeric_limits<int32_t>::max())
+ return static_cast<int32_t>(number);
+ }
+ printErrorMessage("Invalid value for preference. Expected integer value.");
+ return 0;
+}
+
+WebString TestRunner::cppVariantToWebString(const CppVariant& value)
+{
+ if (!value.isString()) {
+ printErrorMessage("Invalid value for preference. Expected string value.");
+ return WebString();
+ }
+ return WebString::fromUTF8(value.toString());
+}
+
+Vector<WebString> TestRunner::cppVariantToWebStringArray(const CppVariant& value)
+{
+ if (!value.isObject()) {
+ printErrorMessage("Invalid value for preference. Expected object value.");
+ return Vector<WebString>();
+ }
+ Vector<WebString> resultVector;
+ Vector<string> stringVector = value.toStringVector();
+ for (size_t i = 0; i < stringVector.size(); ++i)
+ resultVector.append(WebString::fromUTF8(stringVector[i].c_str()));
+ return resultVector;
+}
+
+void TestRunner::printErrorMessage(const string& text)
+{
+ m_delegate->printMessage(string("CONSOLE MESSAGE: ") + text + "\n");
+}
+
+void TestRunner::fallbackMethod(const CppArgumentList&, CppVariant* result)
+{
+ printErrorMessage("JavaScript ERROR: unknown method called on TestRunner");
+ result->setNull();
+}
+
+void TestRunner::notImplemented(const CppArgumentList&, CppVariant* result)
+{
+ result->setNull();
+}
+
}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
index 503271b5d..f9e9f7a24 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
@@ -34,9 +34,154 @@
#include "CppBoundClass.h"
+namespace WebKit {
+class WebView;
+}
+
+namespace WebTestRunner {
+
+class WebTestDelegate;
+
class TestRunner : public CppBoundClass {
public:
TestRunner();
+
+ // FIXME: once DRTTestRunner is moved entirely to this class, change this
+ // method to take a TestDelegate* instead.
+ void setDelegate(WebTestDelegate* delegate) { m_delegate = delegate; }
+ void setWebView(WebKit::WebView* webView) { m_webView = webView; }
+
+ void reset();
+
+protected:
+ // FIXME: make these private once the move from DRTTestRunner to TestRunner
+ // is complete.
+ bool cppVariantToBool(const CppVariant&);
+ int32_t cppVariantToInt32(const CppVariant&);
+ WebKit::WebString cppVariantToWebString(const CppVariant&);
+ Vector<WebKit::WebString> cppVariantToWebStringArray(const CppVariant&);
+
+ void printErrorMessage(const std::string&);
+
+private:
+ ///////////////////////////////////////////////////////////////////////////
+ // Methods implemented entirely in terms of chromium's public WebKit API
+
+ // Method that controls whether pressing Tab key cycles through page elements
+ // or inserts a '\t' char in text area
+ void setTabKeyCyclesThroughElements(const CppArgumentList&, CppVariant*);
+
+ // Changes asynchronous spellchecking flag on the settings.
+ void setAsynchronousSpellCheckingEnabled(const CppArgumentList&, CppVariant*);
+
+ // Executes an internal command (superset of document.execCommand() commands).
+ void execCommand(const CppArgumentList&, CppVariant*);
+
+ // Checks if an internal command is currently available.
+ void isCommandEnabled(const CppArgumentList&, CppVariant*);
+
+ void pauseAnimationAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
+ void pauseTransitionAtTimeOnElementWithId(const CppArgumentList&, CppVariant*);
+ void elementDoesAutoCompleteForElementWithId(const CppArgumentList&, CppVariant*);
+ void numberOfActiveAnimations(const CppArgumentList&, CppVariant*);
+ void callShouldCloseOnWebView(const CppArgumentList&, CppVariant*);
+ void setDomainRelaxationForbiddenForURLScheme(const CppArgumentList&, CppVariant*);
+ void evaluateScriptInIsolatedWorldAndReturnValue(const CppArgumentList&, CppVariant*);
+ void evaluateScriptInIsolatedWorld(const CppArgumentList&, CppVariant*);
+ void setIsolatedWorldSecurityOrigin(const CppArgumentList&, CppVariant*);
+ void setIsolatedWorldContentSecurityPolicy(const CppArgumentList&, CppVariant*);
+
+ // Allows layout tests to manage origins' whitelisting.
+ void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
+ void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
+
+ // Returns true if the current page box has custom page size style for
+ // printing.
+ void hasCustomPageSizeStyle(const CppArgumentList&, CppVariant*);
+
+ // Forces the selection colors for testing under Linux.
+ void forceRedSelectionColors(const CppArgumentList&, CppVariant*);
+
+ // Adds a user script or user style sheet to be injected into new documents.
+ void addUserScript(const CppArgumentList&, CppVariant*);
+ void addUserStyleSheet(const CppArgumentList&, CppVariant*);
+
+ void startSpeechInput(const CppArgumentList&, CppVariant*);
+
+ void loseCompositorContext(const CppArgumentList& args, CppVariant* result);
+
+ void markerTextForListItem(const CppArgumentList&, CppVariant*);
+ void findString(const CppArgumentList&, CppVariant*);
+
+ void setMinimumTimerInterval(const CppArgumentList&, CppVariant*);
+
+ // Expects the first argument to be an input element and the second argument to be a boolean.
+ // Forwards the setAutofilled() call to the element.
+ void setAutofilled(const CppArgumentList&, CppVariant*);
+
+ // Expects the first argument to be an input element and the second argument to be a string value.
+ // Forwards the setValueForUser() call to the element.
+ void setValueForUser(const CppArgumentList&, CppVariant*);
+
+ void enableFixedLayoutMode(const CppArgumentList&, CppVariant*);
+ void setFixedLayoutSize(const CppArgumentList&, CppVariant*);
+
+ void selectionAsMarkup(const CppArgumentList&, CppVariant*);
+
+ // Enables or disables subpixel positioning (i.e. fractional X positions for
+ // glyphs) in text rendering on Linux. Since this method changes global
+ // settings, tests that call it must use their own custom font family for
+ // all text that they render. If not, an already-cached style will be used,
+ // resulting in the changed setting being ignored.
+ void setTextSubpixelPositioning(const CppArgumentList&, CppVariant*);
+
+ // Switch the visibility of the page.
+ void setPageVisibility(const CppArgumentList&, CppVariant*);
+ void resetPageVisibility(const CppArgumentList&, CppVariant*);
+
+ // Changes the direction of the focused element.
+ void setTextDirection(const CppArgumentList&, CppVariant*);
+
+ // Retrieves the text surrounding a position in a text node.
+ // Expects the first argument to be a text node, the second and third to be
+ // point coordinates relative to the node and the fourth the maximum text
+ // length to retrieve.
+ void textSurroundingNode(const CppArgumentList&, CppVariant*);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Properties
+ void workerThreadCount(CppVariant*);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Fallback and stub methods
+
+ // The fallback method is called when a nonexistent method is called on
+ // the layout test controller object.
+ // It is usefull to catch typos in the JavaScript code (a few layout tests
+ // do have typos in them) and it allows the script to continue running in
+ // that case (as the Mac does).
+ void fallbackMethod(const CppArgumentList&, CppVariant*);
+
+ // Stub for not implemented methods.
+ void notImplemented(const CppArgumentList&, CppVariant*);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Internal helpers
+ bool pauseAnimationAtTimeOnElementWithId(const WebKit::WebString& animationName, double time, const WebKit::WebString& elementId);
+ bool pauseTransitionAtTimeOnElementWithId(const WebKit::WebString& propertyName, double time, const WebKit::WebString& elementId);
+ bool elementDoesAutoCompleteForElementWithId(const WebKit::WebString&);
+ int numberOfActiveAnimations();
+
+ // globalFlag is used by a number of layout tests in http/tests/security/dataURL.
+ CppVariant m_globalFlag;
+
+ // Bound variable to return the name of this platform (chromium).
+ CppVariant m_platformName;
+
+ WebTestDelegate* m_delegate;
+ WebKit::WebView* m_webView;
};
+}
+
#endif // TestRunner_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp
index b72a2080d..e929c71fb 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp
@@ -44,6 +44,8 @@
using namespace WebKit;
+namespace WebTestRunner {
+
TextInputController::TextInputController()
{
bindMethod("attributedSubstringFromRange", &TextInputController::attributedSubstringFromRange);
@@ -231,3 +233,5 @@ void TextInputController::setComposition(const CppArgumentList& arguments, CppVa
WebString text(WebString::fromUTF8(arguments[0].toString()));
m_webView->setComposition(text, underlines, 0, text.length());
}
+
+}
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h
index a959aa8b3..286d83356 100644
--- a/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.h
@@ -41,6 +41,8 @@ namespace WebKit {
class WebView;
}
+namespace WebTestRunner {
+
class TextInputController : public CppBoundClass {
public:
TextInputController();
@@ -67,4 +69,6 @@ private:
WebKit::WebView* m_webView;
};
+}
+
#endif // TextInputController_h
diff --git a/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp
new file mode 100644
index 000000000..942f0bb88
--- /dev/null
+++ b/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2012 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 "WebTestProxy.h"
+
+#include "WebAccessibilityController.h"
+#include "WebAccessibilityNotification.h"
+#include "WebAccessibilityObject.h"
+#include "WebElement.h"
+#include "WebEventSender.h"
+#include "WebNode.h"
+#include "WebTestDelegate.h"
+#include "WebTestInterfaces.h"
+#include "platform/WebCString.h"
+
+using namespace WebKit;
+using namespace std;
+
+namespace WebTestRunner {
+
+WebTestProxyBase::WebTestProxyBase()
+ : m_testInterfaces(0)
+ , m_delegate(0)
+{
+}
+
+WebTestProxyBase::~WebTestProxyBase()
+{
+}
+
+void WebTestProxyBase::setInterfaces(WebTestInterfaces* interfaces)
+{
+ m_testInterfaces = interfaces;
+}
+
+void WebTestProxyBase::setDelegate(WebTestDelegate* delegate)
+{
+ m_delegate = delegate;
+}
+
+void WebTestProxyBase::setPaintRect(const WebRect& rect)
+{
+ m_paintRect = rect;
+}
+
+WebRect WebTestProxyBase::paintRect() const
+{
+ return m_paintRect;
+}
+
+void WebTestProxyBase::didInvalidateRect(const WebRect& rect)
+{
+ // m_paintRect = m_paintRect U rect
+ if (rect.isEmpty())
+ return;
+ if (m_paintRect.isEmpty()) {
+ m_paintRect = rect;
+ return;
+ }
+ int left = min(m_paintRect.x, rect.x);
+ int top = min(m_paintRect.y, rect.y);
+ int right = max(m_paintRect.x + m_paintRect.width, rect.x + rect.width);
+ int bottom = max(m_paintRect.y + m_paintRect.height, rect.y + rect.height);
+ m_paintRect = WebRect(left, top, right - left, bottom - top);
+}
+
+void WebTestProxyBase::didScrollRect(int, int, const WebRect& clipRect)
+{
+ didInvalidateRect(clipRect);
+}
+
+void WebTestProxyBase::scheduleComposite()
+{
+ m_paintRect = WebRect(0, 0, INT_MAX, INT_MAX);
+}
+
+void WebTestProxyBase::scheduleAnimation()
+{
+ scheduleComposite();
+}
+
+void WebTestProxyBase::show(WebNavigationPolicy)
+{
+ scheduleComposite();
+}
+
+void WebTestProxyBase::setWindowRect(const WebRect& rect)
+{
+ scheduleComposite();
+}
+
+void WebTestProxyBase::didAutoResize(const WebSize&)
+{
+ scheduleComposite();
+}
+
+void WebTestProxyBase::postAccessibilityNotification(const WebKit::WebAccessibilityObject& obj, WebKit::WebAccessibilityNotification notification)
+{
+ if (notification == WebKit::WebAccessibilityNotificationFocusedUIElementChanged)
+ m_testInterfaces->accessibilityController()->setFocusedElement(obj);
+
+ const char* notificationName;
+ switch (notification) {
+ case WebKit::WebAccessibilityNotificationActiveDescendantChanged:
+ notificationName = "ActiveDescendantChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationAutocorrectionOccured:
+ notificationName = "AutocorrectionOccured";
+ break;
+ case WebKit::WebAccessibilityNotificationCheckedStateChanged:
+ notificationName = "CheckedStateChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationChildrenChanged:
+ notificationName = "ChildrenChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationFocusedUIElementChanged:
+ notificationName = "FocusedUIElementChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationLayoutComplete:
+ notificationName = "LayoutComplete";
+ break;
+ case WebKit::WebAccessibilityNotificationLoadComplete:
+ notificationName = "LoadComplete";
+ break;
+ case WebKit::WebAccessibilityNotificationSelectedChildrenChanged:
+ notificationName = "SelectedChildrenChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationSelectedTextChanged:
+ notificationName = "SelectedTextChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationValueChanged:
+ notificationName = "ValueChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationScrolledToAnchor:
+ notificationName = "ScrolledToAnchor";
+ break;
+ case WebKit::WebAccessibilityNotificationLiveRegionChanged:
+ notificationName = "LiveRegionChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationMenuListItemSelected:
+ notificationName = "MenuListItemSelected";
+ break;
+ case WebKit::WebAccessibilityNotificationMenuListValueChanged:
+ notificationName = "MenuListValueChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationRowCountChanged:
+ notificationName = "RowCountChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationRowCollapsed:
+ notificationName = "RowCollapsed";
+ break;
+ case WebKit::WebAccessibilityNotificationRowExpanded:
+ notificationName = "RowExpanded";
+ break;
+ case WebKit::WebAccessibilityNotificationInvalidStatusChanged:
+ notificationName = "InvalidStatusChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationTextChanged:
+ notificationName = "TextChanged";
+ break;
+ case WebKit::WebAccessibilityNotificationAriaAttributeChanged:
+ notificationName = "AriaAttributeChanged";
+ break;
+ default:
+ notificationName = "UnknownNotification";
+ break;
+ }
+
+ m_testInterfaces->accessibilityController()->notificationReceived(obj, notificationName);
+
+ if (m_testInterfaces->accessibilityController()->shouldLogAccessibilityEvents()) {
+ std::string message("AccessibilityNotification - ");
+ message += notificationName;
+
+ WebKit::WebNode node = obj.node();
+ if (!node.isNull() && node.isElementNode()) {
+ WebKit::WebElement element = node.to<WebKit::WebElement>();
+ if (element.hasAttribute("id")) {
+ message += " - id:";
+ message += element.getAttribute("id").utf8().data();
+ }
+ }
+
+ m_delegate->printMessage(message + "\n");
+ }
+}
+
+void WebTestProxyBase::startDragging(WebFrame*, const WebDragData& data, WebDragOperationsMask mask, const WebImage&, const WebPoint&)
+{
+ // 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.
+ m_testInterfaces->eventSender()->doDragDrop(data, mask);
+}
+
+}
diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp
index 2bccb6a32..75fec130a 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShell.cpp
@@ -47,6 +47,7 @@
#include "WebRuntimeFeatures.h"
#include "WebScriptController.h"
#include "WebSettings.h"
+#include "WebTestProxy.h"
#include "WebView.h"
#include "WebViewHost.h"
#include "platform/WebArrayBufferView.h"
@@ -117,6 +118,8 @@ TestShell::TestShell()
, m_accelerated2dCanvasEnabled(false)
, m_deferred2dCanvasEnabled(false)
, m_acceleratedPaintingEnabled(false)
+ , m_perTilePaintingEnabled(false)
+ , m_acceleratedAnimationEnabled(false)
, m_deferredImageDecodingEnabled(false)
, m_stressOpt(false)
, m_stressDeopt(false)
@@ -126,7 +129,6 @@ TestShell::TestShell()
WebRuntimeFeatures::enableDataTransferItems(true);
WebRuntimeFeatures::enableDeviceMotion(false);
WebRuntimeFeatures::enableGeolocation(true);
- WebRuntimeFeatures::enablePointerLock(true);
WebRuntimeFeatures::enableIndexedDatabase(true);
WebRuntimeFeatures::enableInputTypeDateTime(true);
WebRuntimeFeatures::enableInputTypeDateTimeLocal(true);
@@ -139,7 +141,6 @@ TestShell::TestShell()
WebRuntimeFeatures::enableEncryptedMedia(true);
WebRuntimeFeatures::enableMediaStream(true);
WebRuntimeFeatures::enablePeerConnection(true);
- WebRuntimeFeatures::enableDeprecatedPeerConnection(true);
WebRuntimeFeatures::enableWebAudio(true);
WebRuntimeFeatures::enableVideoTrack(true);
WebRuntimeFeatures::enableGamepad(true);
@@ -183,6 +184,8 @@ void TestShell::createMainWindow()
m_webView = m_webViewHost->webView();
m_testInterfaces->setDelegate(m_webViewHost.get());
m_testInterfaces->setWebView(m_webView);
+ m_testRunner->setDelegate(m_webViewHost.get());
+ m_testRunner->setWebView(m_webView);
m_drtDevToolsAgent->setWebView(m_webView);
}
@@ -190,6 +193,8 @@ TestShell::~TestShell()
{
m_testInterfaces->setDelegate(0);
m_testInterfaces->setWebView(0);
+ m_testRunner->setDelegate(0);
+ m_testRunner->setWebView(0);
m_drtDevToolsAgent->setWebView(0);
}
@@ -236,6 +241,8 @@ void TestShell::resetWebSettings(WebView& webView)
m_prefs.accelerated2dCanvasEnabled = m_accelerated2dCanvasEnabled;
m_prefs.deferred2dCanvasEnabled = m_deferred2dCanvasEnabled;
m_prefs.acceleratedPaintingEnabled = m_acceleratedPaintingEnabled;
+ m_prefs.perTilePaintingEnabled = m_perTilePaintingEnabled;
+ m_prefs.acceleratedAnimationEnabled = m_acceleratedAnimationEnabled;
m_prefs.deferredImageDecodingEnabled = m_deferredImageDecodingEnabled;
m_prefs.applyTo(&webView);
}
@@ -388,16 +395,6 @@ void TestShell::testTimedOut()
testFinished();
}
-void TestShell::setPerTilePaintingEnabled(bool enabled)
-{
- Platform::current()->compositorSupport()->setPerTilePaintingEnabled(enabled);
-}
-
-void TestShell::setAcceleratedAnimationEnabled(bool enabled)
-{
- Platform::current()->compositorSupport()->setAcceleratedAnimationEnabled(enabled);
-}
-
static string dumpDocumentText(WebFrame* frame)
{
// We use the document element's text instead of the body text here because
@@ -751,7 +748,13 @@ WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url)
WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url, DRTDevToolsAgent* devToolsAgent)
{
- WebViewHost* host = new WebViewHost(this);
+ WebTestRunner::WebTestProxy<WebViewHost, TestShell*>* host = new WebTestRunner::WebTestProxy<WebViewHost, TestShell*>(this);
+ host->setInterfaces(m_testInterfaces.get());
+ if (m_webViewHost)
+ host->setDelegate(m_webViewHost.get());
+ else
+ host->setDelegate(host);
+ host->setProxy(host);
WebView* view = WebView::create(host);
view->setPermissionClient(webPermissions());
view->setDevToolsAgentClient(devToolsAgent);
diff --git a/Tools/DumpRenderTree/chromium/TestShell.h b/Tools/DumpRenderTree/chromium/TestShell.h
index 12e1dbbef..9120121db 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.h
+++ b/Tools/DumpRenderTree/chromium/TestShell.h
@@ -136,8 +136,8 @@ public:
void setAccelerated2dCanvasEnabled(bool enabled) { m_accelerated2dCanvasEnabled = enabled; }
void setDeferred2dCanvasEnabled(bool enabled) { m_deferred2dCanvasEnabled = enabled; }
void setAcceleratedPaintingEnabled(bool enabled) { m_acceleratedPaintingEnabled = enabled; }
- void setPerTilePaintingEnabled(bool);
- void setAcceleratedAnimationEnabled(bool);
+ void setPerTilePaintingEnabled(bool enabled) { m_perTilePaintingEnabled = enabled; }
+ void setAcceleratedAnimationEnabled(bool enabled) { m_acceleratedAnimationEnabled = enabled; }
void setDeferredImageDecodingEnabled(bool enabled) { m_deferredImageDecodingEnabled = enabled; }
#if defined(OS_WIN)
// Access to the finished event. Used by the static WatchDog thread.
@@ -218,8 +218,9 @@ private:
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
OwnPtr<NotificationPresenter> m_notificationPresenter;
#endif
- OwnPtr<WebViewHost> m_webViewHost;
+ // It's important that this thread is destroyed after the WebViewHost.
OwnPtr<WebKit::WebThread> m_webCompositorThread;
+ OwnPtr<WebViewHost> m_webViewHost;
#if ENABLE(LINK_PRERENDER)
OwnPtr<MockWebPrerenderingSupport> m_prerenderingSupport;
#endif
@@ -237,6 +238,7 @@ private:
bool m_deferred2dCanvasEnabled;
bool m_acceleratedPaintingEnabled;
bool m_perTilePaintingEnabled;
+ bool m_acceleratedAnimationEnabled;
bool m_deferredImageDecodingEnabled;
WebPreferences m_prefs;
bool m_stressOpt;
diff --git a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp
index 146884613..2960dc0bd 100644
--- a/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp
+++ b/Tools/DumpRenderTree/chromium/TestWebPlugin.cpp
@@ -184,6 +184,7 @@ bool TestWebPlugin::initialize(WebPluginContainer* container)
m_container = container;
m_container->setBackingTextureId(m_colorTexture);
m_container->setIsAcceptingTouchEvents(m_acceptsTouchEvent);
+ m_container->setWantsWheelEvents(true);
return true;
}
diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp
index 46afbbdb2..e13939d32 100644
--- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp
+++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp
@@ -118,6 +118,8 @@ void WebPreferences::reset()
deferred2dCanvasEnabled = false;
acceleratedPaintingEnabled = false;
forceCompositingMode = false;
+ perTilePaintingEnabled = false;
+ acceleratedAnimationEnabled = false;
deferredImageDecodingEnabled = false;
mediaPlaybackRequiresUserGesture = false;
mockScrollbarsEnabled = false;
@@ -231,10 +233,11 @@ void WebPreferences::applyTo(WebView* webView)
settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled);
settings->setDeferred2dCanvasEnabled(deferred2dCanvasEnabled);
settings->setAcceleratedPaintingEnabled(acceleratedPaintingEnabled);
+ settings->setPerTilePaintingEnabled(perTilePaintingEnabled);
+ settings->setAcceleratedAnimationEnabled(acceleratedAnimationEnabled);
settings->setDeferredImageDecodingEnabled(deferredImageDecodingEnabled);
settings->setMediaPlaybackRequiresUserGesture(mediaPlaybackRequiresUserGesture);
settings->setMockScrollbarsEnabled(mockScrollbarsEnabled);
- settings->setApplyDefaultDeviceScaleFactorInCompositor(forceCompositingMode);
settings->setShouldRespectImageOrientation(shouldRespectImageOrientation);
// Fixed values.
@@ -254,4 +257,5 @@ void WebPreferences::applyTo(WebView* webView)
settings->setValidationMessageTimerMagnification(-1);
settings->setVisualWordMovementEnabled(false);
settings->setPasswordEchoEnabled(false);
+ settings->setApplyDeviceScaleFactorInCompositor(true);
}
diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.h b/Tools/DumpRenderTree/chromium/WebPreferences.h
index 36fcd196f..a17a3cbd2 100644
--- a/Tools/DumpRenderTree/chromium/WebPreferences.h
+++ b/Tools/DumpRenderTree/chromium/WebPreferences.h
@@ -111,6 +111,8 @@ struct WebPreferences {
bool accelerated2dCanvasEnabled;
bool deferred2dCanvasEnabled;
bool acceleratedPaintingEnabled;
+ bool perTilePaintingEnabled;
+ bool acceleratedAnimationEnabled;
bool deferredImageDecodingEnabled;
bool mediaPlaybackRequiresUserGesture;
bool mockScrollbarsEnabled;
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index 98b87bf8e..baf8d0d9e 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -39,8 +39,6 @@
#include "TestNavigationController.h"
#include "TestShell.h"
#include "TestWebPlugin.h"
-#include "WebAccessibilityController.h"
-#include "WebAccessibilityObject.h"
#include "WebConsoleMessage.h"
#include "WebContextMenuData.h"
#include "WebDOMMessageEvent.h"
@@ -148,16 +146,6 @@ static string descriptionSuitableForTestResult(const string& url)
return url.substr(pos + 1);
}
-// Adds a file called "DRTFakeFile" to dragData (CF_HDROP). Use to fake
-// dragging a file.
-static void addDRTFakeFileToDataObject(WebDragData* dragData)
-{
- WebDragData::Item item;
- item.storageType = WebDragData::Item::StorageTypeFilename;
- item.filenameData = WebString::fromUTF8("DRTFakeFile");
- dragData->addItem(item);
-}
-
// Get a debugging string from a WebNavigationType.
static const char* webNavigationTypeToString(WebNavigationType type)
{
@@ -345,7 +333,7 @@ bool WebViewHost::shouldBeginEditing(const WebRange& range)
printRangeDescription(range);
fputs("\n", stdout);
}
- return testRunner()->acceptsEditing();
+ return true;
}
bool WebViewHost::shouldEndEditing(const WebRange& range)
@@ -355,7 +343,7 @@ bool WebViewHost::shouldEndEditing(const WebRange& range)
printRangeDescription(range);
fputs("\n", stdout);
}
- return testRunner()->acceptsEditing();
+ return true;
}
bool WebViewHost::shouldInsertNode(const WebNode& node, const WebRange& range, WebEditingAction action)
@@ -367,7 +355,7 @@ bool WebViewHost::shouldInsertNode(const WebNode& node, const WebRange& range, W
printRangeDescription(range);
printf(" givenAction:%s\n", editingActionDescription(action).c_str());
}
- return testRunner()->acceptsEditing();
+ return true;
}
bool WebViewHost::shouldInsertText(const WebString& text, const WebRange& range, WebEditingAction action)
@@ -377,7 +365,7 @@ bool WebViewHost::shouldInsertText(const WebString& text, const WebRange& range,
printRangeDescription(range);
printf(" givenAction:%s\n", editingActionDescription(action).c_str());
}
- return testRunner()->acceptsEditing();
+ return true;
}
bool WebViewHost::shouldChangeSelectedRange(
@@ -392,7 +380,7 @@ bool WebViewHost::shouldChangeSelectedRange(
textAffinityDescription(affinity).c_str(),
(stillSelecting ? "TRUE" : "FALSE"));
}
- return testRunner()->acceptsEditing();
+ return true;
}
bool WebViewHost::shouldDeleteRange(const WebRange& range)
@@ -402,7 +390,7 @@ bool WebViewHost::shouldDeleteRange(const WebRange& range)
printRangeDescription(range);
fputs("\n", stdout);
}
- return testRunner()->acceptsEditing();
+ return true;
}
bool WebViewHost::shouldApplyStyle(const WebString& style, const WebRange& range)
@@ -412,7 +400,7 @@ bool WebViewHost::shouldApplyStyle(const WebString& style, const WebRange& range
printRangeDescription(range);
fputs("\n", stdout);
}
- return testRunner()->acceptsEditing();
+ return true;
}
bool WebViewHost::isSmartInsertDeleteEnabled()
@@ -589,19 +577,6 @@ void WebViewHost::setStatusText(const WebString& text)
printf("UI DELEGATE STATUS CALLBACK: setStatusText:%s\n", text.utf8().data());
}
-void WebViewHost::startDragging(WebFrame*, const WebDragData& data, WebDragOperationsMask mask, const WebImage&, const WebPoint&)
-{
- WebDragData mutableDragData = data;
- if (testRunner()->shouldAddFileToPasteboard()) {
- // Add a file called DRTFakeFile to the drag&drop clipboard.
- addDRTFakeFileToDataObject(&mutableDragData);
- }
-
- // 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.
- m_shell->eventSender()->doDragDrop(mutableDragData, mask);
-}
-
void WebViewHost::didUpdateLayout()
{
#if OS(MAC_OS_X)
@@ -635,94 +610,6 @@ int WebViewHost::historyForwardListCount()
return navigationController()->entryCount() - currentIndex - 1;
}
-void WebViewHost::postAccessibilityNotification(const WebAccessibilityObject& obj, WebAccessibilityNotification notification)
-{
- if (notification == WebAccessibilityNotificationFocusedUIElementChanged)
- m_shell->accessibilityController()->setFocusedElement(obj);
-
- const char* notificationName;
- switch (notification) {
- case WebAccessibilityNotificationActiveDescendantChanged:
- notificationName = "ActiveDescendantChanged";
- break;
- case WebAccessibilityNotificationAutocorrectionOccured:
- notificationName = "AutocorrectionOccured";
- break;
- case WebAccessibilityNotificationCheckedStateChanged:
- notificationName = "CheckedStateChanged";
- break;
- case WebAccessibilityNotificationChildrenChanged:
- notificationName = "ChildrenChanged";
- break;
- case WebAccessibilityNotificationFocusedUIElementChanged:
- notificationName = "FocusedUIElementChanged";
- break;
- case WebAccessibilityNotificationLayoutComplete:
- notificationName = "LayoutComplete";
- break;
- case WebAccessibilityNotificationLoadComplete:
- notificationName = "LoadComplete";
- break;
- case WebAccessibilityNotificationSelectedChildrenChanged:
- notificationName = "SelectedChildrenChanged";
- break;
- case WebAccessibilityNotificationSelectedTextChanged:
- notificationName = "SelectedTextChanged";
- break;
- case WebAccessibilityNotificationValueChanged:
- notificationName = "ValueChanged";
- break;
- case WebAccessibilityNotificationScrolledToAnchor:
- notificationName = "ScrolledToAnchor";
- break;
- case WebAccessibilityNotificationLiveRegionChanged:
- notificationName = "LiveRegionChanged";
- break;
- case WebAccessibilityNotificationMenuListItemSelected:
- notificationName = "MenuListItemSelected";
- break;
- case WebAccessibilityNotificationMenuListValueChanged:
- notificationName = "MenuListValueChanged";
- break;
- case WebAccessibilityNotificationRowCountChanged:
- notificationName = "RowCountChanged";
- break;
- case WebAccessibilityNotificationRowCollapsed:
- notificationName = "RowCollapsed";
- break;
- case WebAccessibilityNotificationRowExpanded:
- notificationName = "RowExpanded";
- break;
- case WebAccessibilityNotificationInvalidStatusChanged:
- notificationName = "InvalidStatusChanged";
- break;
- case WebAccessibilityNotificationTextChanged:
- notificationName = "TextChanged";
- break;
- case WebAccessibilityNotificationAriaAttributeChanged:
- notificationName = "AriaAttributeChanged";
- break;
- default:
- notificationName = "UnknownNotification";
- break;
- }
-
- m_shell->accessibilityController()->notificationReceived(obj, notificationName);
-
- if (m_shell->accessibilityController()->shouldLogAccessibilityEvents()) {
- printf("AccessibilityNotification - %s", notificationName);
-
- WebKit::WebNode node = obj.node();
- if (!node.isNull() && node.isElementNode()) {
- WebKit::WebElement element = node.to<WebKit::WebElement>();
- if (element.hasAttribute("id"))
- printf(" - id:%s", element.getAttribute("id").utf8().data());
- }
-
- printf("\n");
- }
-}
-
#if ENABLE(NOTIFICATIONS)
WebNotificationPresenter* WebViewHost::notificationPresenter()
{
@@ -793,18 +680,6 @@ WebUserMediaClientMock* WebViewHost::userMediaClientMock()
// WebWidgetClient -----------------------------------------------------------
-void WebViewHost::didInvalidateRect(const WebRect& rect)
-{
- updatePaintRect(rect);
-}
-
-void WebViewHost::didScrollRect(int, int, const WebRect& clipRect)
-{
- // This is used for optimizing painting when the renderer is scrolled. We're
- // currently not doing any optimizations so just invalidate the region.
- didInvalidateRect(clipRect);
-}
-
void WebViewHost::didAutoResize(const WebSize& newSize)
{
// Purposely don't include the virtualWindowBorder in this case so that
@@ -812,27 +687,12 @@ void WebViewHost::didAutoResize(const WebSize& newSize)
setWindowRect(WebRect(0, 0, newSize.width, newSize.height));
}
-void WebViewHost::scheduleComposite()
-{
- WebSize widgetSize = webWidget()->size();
- WebRect clientRect(0, 0, widgetSize.width, widgetSize.height);
- didInvalidateRect(clientRect);
-}
-
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-void WebViewHost::serviceAnimation()
+void WebViewHost::scheduleAnimation()
{
if (webView()->settings()->scrollAnimatorEnabled())
webView()->animate(0.0);
- scheduleComposite();
}
-void WebViewHost::scheduleAnimation()
-{
- postDelayedTask(new HostMethodTask(this, &WebViewHost::serviceAnimation), 0);
-}
-#endif
-
void WebViewHost::didFocus()
{
m_shell->setFocus(webWidget(), true);
@@ -918,8 +778,6 @@ void WebViewHost::didLosePointerLock()
void WebViewHost::show(WebNavigationPolicy)
{
m_hasWindow = true;
- WebSize size = webWidget()->size();
- updatePaintRect(WebRect(0, 0, size.width, size.height));
}
@@ -960,7 +818,6 @@ void WebViewHost::setWindowRect(const WebRect& rect)
int height = m_windowRect.height - border2;
discardBackingStore();
webWidget()->resize(WebSize(width, height));
- updatePaintRect(WebRect(0, 0, width, height));
}
WebRect WebViewHost::rootWindowRect()
@@ -1520,6 +1377,7 @@ WebKit::WebString WebViewHost::getAbsoluteWebStringFromUTF8Path(const std::strin
WebViewHost::WebViewHost(TestShell* shell)
: m_shell(shell)
+ , m_proxy(0)
, m_webWidget(0)
, m_lastRequestedTextCheckingCompletion(0)
{
@@ -1566,6 +1424,19 @@ WebWidget* WebViewHost::webWidget() const
return m_webWidget;
}
+WebTestProxyBase* WebViewHost::proxy() const
+{
+ ASSERT(m_proxy);
+ return m_proxy;
+}
+
+void WebViewHost::setProxy(WebTestProxyBase* proxy)
+{
+ ASSERT(!m_proxy);
+ ASSERT(proxy);
+ m_proxy = proxy;
+}
+
void WebViewHost::reset()
{
m_policyDelegateEnabled = false;
@@ -1610,7 +1481,9 @@ void WebViewHost::reset()
m_currentCursor = WebCursorInfo();
m_windowRect = WebRect();
- m_paintRect = WebRect();
+ // m_proxy is not set when reset() is invoked from the constructor.
+ if (m_proxy)
+ proxy()->setPaintRect(WebRect());
if (m_webWidget) {
webView()->mainFrame()->setName(WebString());
@@ -1847,18 +1720,12 @@ void WebViewHost::setAddressBarURL(const WebURL&)
void WebViewHost::enterFullScreenNow()
{
- if (testRunner()->hasCustomFullScreenBehavior())
- return;
-
webView()->willEnterFullScreen();
webView()->didEnterFullScreen();
}
void WebViewHost::exitFullScreenNow()
{
- if (testRunner()->hasCustomFullScreenBehavior())
- return;
-
webView()->willExitFullScreen();
webView()->didExitFullScreen();
}
@@ -1874,22 +1741,6 @@ webkit_support::TestMediaStreamClient* WebViewHost::testMediaStreamClient()
// Painting functions ---------------------------------------------------------
-void WebViewHost::updatePaintRect(const WebRect& rect)
-{
- // m_paintRect = m_paintRect U rect
- if (rect.isEmpty())
- return;
- if (m_paintRect.isEmpty()) {
- m_paintRect = rect;
- return;
- }
- int left = min(m_paintRect.x, rect.x);
- int top = min(m_paintRect.y, rect.y);
- int right = max(m_paintRect.x + m_paintRect.width, rect.x + rect.width);
- int bottom = max(m_paintRect.y + m_paintRect.height, rect.y + rect.height);
- m_paintRect = WebRect(left, top, right - left, bottom - top);
-}
-
void WebViewHost::paintRect(const WebRect& rect)
{
ASSERT(!m_isPainting);
@@ -1920,23 +1771,22 @@ void WebViewHost::paintInvalidatedRegion()
// Store the total area painted in total_paint. Then tell the gdk window
// to update that area after we're done painting it.
for (int i = 0; i < 3; ++i) {
- // m_paintRect = intersect(m_paintRect , clientRect)
- int left = max(m_paintRect.x, clientRect.x);
- int top = max(m_paintRect.y, clientRect.y);
- int right = min(m_paintRect.x + m_paintRect.width, clientRect.x + clientRect.width);
- int bottom = min(m_paintRect.y + m_paintRect.height, clientRect.y + clientRect.height);
- if (left >= right || top >= bottom)
- m_paintRect = WebRect();
- else
- m_paintRect = WebRect(left, top, right - left, bottom - top);
-
- if (m_paintRect.isEmpty())
+ // rect = intersect(proxy()->paintRect() , clientRect)
+ WebRect damageRect = proxy()->paintRect();
+ int left = max(damageRect.x, clientRect.x);
+ int top = max(damageRect.y, clientRect.y);
+ int right = min(damageRect.x + damageRect.width, clientRect.x + clientRect.width);
+ int bottom = min(damageRect.y + damageRect.height, clientRect.y + clientRect.height);
+ WebRect rect;
+ if (left < right && top < bottom)
+ rect = WebRect(left, top, right - left, bottom - top);
+
+ proxy()->setPaintRect(WebRect());
+ if (rect.isEmpty())
continue;
- WebRect rect(m_paintRect);
- m_paintRect = WebRect();
paintRect(rect);
}
- ASSERT(m_paintRect.isEmpty());
+ ASSERT(proxy()->paintRect().isEmpty());
}
void WebViewHost::paintPagesWithBoundaries()
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h
index 86007194b..eb41d54a4 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.h
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h
@@ -41,6 +41,7 @@
#include "WebSpellCheckClient.h"
#include "WebTask.h"
#include "WebTestDelegate.h"
+#include "WebTestProxy.h"
#include "WebViewClient.h"
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
@@ -86,6 +87,8 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
void setWebWidget(WebKit::WebWidget*);
WebKit::WebView* webView() const;
WebKit::WebWidget* webWidget() const;
+ WebTestRunner::WebTestProxyBase* proxy() const;
+ void setProxy(WebTestRunner::WebTestProxyBase*);
void reset();
void setSelectTrailingWhitespaceEnabled(bool);
void setSmartInsertDeleteEnabled(bool);
@@ -99,7 +102,6 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
void setDeviceScaleFactor(float);
void paintRect(const WebKit::WebRect&);
- void updatePaintRect(const WebKit::WebRect&);
void paintInvalidatedRegion();
void paintPagesWithBoundaries();
SkCanvas* canvas();
@@ -183,12 +185,10 @@ 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(WebKit::WebFrame*, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebImage&, const WebKit::WebPoint&);
virtual void didUpdateLayout();
virtual void navigateBackForwardSoon(int offset);
virtual int historyBackListCount();
virtual int historyForwardListCount();
- virtual void postAccessibilityNotification(const WebKit::WebAccessibilityObject&, WebKit::WebAccessibilityNotification);
#if ENABLE(NOTIFICATIONS)
virtual WebKit::WebNotificationPresenter* notificationPresenter();
#endif
@@ -206,14 +206,8 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual void printPage(WebKit::WebFrame*);
// WebKit::WebWidgetClient
- virtual void didInvalidateRect(const WebKit::WebRect&);
- virtual void didScrollRect(int dx, int dy, const WebKit::WebRect&);
virtual void didAutoResize(const WebKit::WebSize& newSize);
- virtual void scheduleComposite();
-#if ENABLE(REQUEST_ANIMATION_FRAME)
- virtual void serviceAnimation();
virtual void scheduleAnimation();
-#endif
virtual void didFocus();
virtual void didBlur();
virtual void didChangeCursor(const WebKit::WebCursorInfo&);
@@ -370,6 +364,9 @@ private:
// Non-owning pointer. The WebViewHost instance is owned by this TestShell instance.
TestShell* m_shell;
+ // Non-owning pointer. This class needs to be wrapped in a WebTestProxy. This is the pointer to the WebTestProxyBase.
+ WebTestRunner::WebTestProxyBase* m_proxy;
+
// This delegate works for the following widget.
WebKit::WebWidget* m_webWidget;
diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp
index 3d1c112e0..ef210e07e 100644
--- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp
@@ -384,6 +384,7 @@ static void shutdownEfl()
void displayWebView()
{
+ DumpRenderTreeSupportEfl::forceLayout(browser->mainFrame());
DumpRenderTreeSupportEfl::setTracksRepaints(browser->mainFrame(), true);
DumpRenderTreeSupportEfl::resetTrackedRepaints(browser->mainFrame());
}
diff --git a/Tools/DumpRenderTree/efl/EventSender.cpp b/Tools/DumpRenderTree/efl/EventSender.cpp
index e2ff5e1f6..92b788991 100644
--- a/Tools/DumpRenderTree/efl/EventSender.cpp
+++ b/Tools/DumpRenderTree/efl/EventSender.cpp
@@ -992,7 +992,6 @@ static void feedMouseEvent(MouseEventInfo* eventInfo)
unsigned timeStamp = 0;
Evas_Object* mainFrame = browser->mainFrame();
Evas* evas = evas_object_evas_get(mainFrame);
- DumpRenderTreeSupportEfl::layoutFrame(mainFrame);
EvasMouseEvent event = eventInfo->event;
setEvasModifiers(evas, eventInfo->modifiers);
diff --git a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp b/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp
index 446483652..241903988 100644
--- a/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp
+++ b/Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp
@@ -38,7 +38,7 @@
#include "PixelDumpSupportCairo.h"
#include "RefPtrCairo.h"
#include "WebCoreSupport/DumpRenderTreeSupportEfl.h"
-#include "ewk_view_private.h"
+#include "ewk_view.h"
PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool drawSelectionRect)
{
diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm
index 3cd121488..908a231b9 100644
--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -693,6 +693,9 @@ static void resetDefaultsToConsistentValues()
// Called once on DumpRenderTree startup.
static void setDefaultsToConsistentValuesForTesting()
{
+ // FIXME: We'd like to start with a clean state for every test, but this function can't be used more than once yet.
+ [WebPreferences _switchNetworkLoaderToNewTestingSession];
+
resetDefaultsToConsistentValues();
NSString *path = libraryPathForDumpRenderTree();
@@ -702,8 +705,6 @@ static void setDefaultsToConsistentValuesForTesting()
diskPath:[path stringByAppendingPathComponent:@"URLCache"]];
[NSURLCache setSharedURLCache:sharedCache];
[sharedCache release];
-
- [WebPreferences _switchNetworkLoaderToNewTestingSession];
}
static void runThread(void* arg)
diff --git a/Tools/DumpRenderTree/win/EventSender.cpp b/Tools/DumpRenderTree/win/EventSender.cpp
index 76dafd948..5cc73c0b8 100644
--- a/Tools/DumpRenderTree/win/EventSender.cpp
+++ b/Tools/DumpRenderTree/win/EventSender.cpp
@@ -45,6 +45,9 @@
#include <wtf/text/WTFString.h>
#define WM_DRT_SEND_QUEUED_EVENT (WM_APP+1)
+#ifndef MAPVK_VK_TO_VSC
+#define MAPVK_VK_TO_VSC 0
+#endif
static bool down;
static bool dragMode = true;
@@ -434,6 +437,16 @@ void replaySavedEvents(HRESULT* oleDragAndDropReturnValue)
replayingSavedEvents = false;
}
+static int makeKeyDataForScanCode(int virtualKeyCode)
+{
+ unsigned scancode = MapVirtualKey(virtualKeyCode, MAPVK_VK_TO_VSC);
+ int keyData = scancode & 0xFF;
+ scancode = scancode >> 8;
+ if (scancode == 0xe0 || scancode == 0xe1)
+ keyData += KF_EXTENDED;
+ return keyData << 16;
+}
+
static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 1)
@@ -479,19 +492,25 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
virtualKeyCode = VK_SNAPSHOT;
else if (JSStringIsEqualToUTF8CString(character, "menu"))
virtualKeyCode = VK_APPS;
- else if (JSStringIsEqualToUTF8CString(character, "leftControl"))
- virtualKeyCode = VK_LCONTROL;
- else if (JSStringIsEqualToUTF8CString(character, "leftShift"))
- virtualKeyCode = VK_LSHIFT;
- else if (JSStringIsEqualToUTF8CString(character, "leftAlt"))
- virtualKeyCode = VK_LMENU;
- else if (JSStringIsEqualToUTF8CString(character, "rightControl"))
- virtualKeyCode = VK_RCONTROL;
- else if (JSStringIsEqualToUTF8CString(character, "rightShift"))
- virtualKeyCode = VK_RSHIFT;
- else if (JSStringIsEqualToUTF8CString(character, "rightAlt"))
- virtualKeyCode = VK_RMENU;
- else {
+ else if (JSStringIsEqualToUTF8CString(character, "leftControl")) {
+ virtualKeyCode = VK_CONTROL;
+ keyData += makeKeyDataForScanCode(VK_LCONTROL);
+ } else if (JSStringIsEqualToUTF8CString(character, "leftShift")) {
+ virtualKeyCode = VK_SHIFT;
+ keyData += makeKeyDataForScanCode(VK_LSHIFT);
+ } else if (JSStringIsEqualToUTF8CString(character, "leftAlt")) {
+ virtualKeyCode = VK_MENU;
+ keyData += makeKeyDataForScanCode(VK_LMENU);
+ } else if (JSStringIsEqualToUTF8CString(character, "rightControl")) {
+ virtualKeyCode = VK_CONTROL;
+ keyData += makeKeyDataForScanCode(VK_RCONTROL);
+ } else if (JSStringIsEqualToUTF8CString(character, "rightShift")) {
+ virtualKeyCode = VK_SHIFT;
+ keyData += makeKeyDataForScanCode(VK_RSHIFT);
+ } else if (JSStringIsEqualToUTF8CString(character, "rightAlt")) {
+ virtualKeyCode = VK_MENU;
+ keyData += makeKeyDataForScanCode(VK_RMENU);
+ } else {
charCode = JSStringGetCharactersPtr(character)[0];
virtualKeyCode = LOBYTE(VkKeyScan(charCode));
if (WTF::isASCIIUpper(charCode))