summaryrefslogtreecommitdiffstats
path: root/Tools/DumpRenderTree
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/DumpRenderTree')
-rw-r--r--Tools/DumpRenderTree/DumpRenderTree.gypi3
-rw-r--r--Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj4
-rw-r--r--Tools/DumpRenderTree/LayoutTestController.cpp65
-rw-r--r--Tools/DumpRenderTree/LayoutTestController.h11
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp10
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h3
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp48
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowlessPaintRectCoordinates.cpp83
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp3
-rw-r--r--Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj8
-rw-r--r--Tools/DumpRenderTree/chromium/AccessibilityController.cpp3
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp16
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h11
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.cpp36
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h65
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp18
-rw-r--r--Tools/DumpRenderTree/chromium/DRTDevToolsClient.h12
-rw-r--r--Tools/DumpRenderTree/chromium/DumpRenderTree.cpp21
-rw-r--r--Tools/DumpRenderTree/chromium/EventSender.cpp3
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.cpp9
-rw-r--r--Tools/DumpRenderTree/chromium/LayoutTestController.h4
-rw-r--r--Tools/DumpRenderTree/chromium/Task.cpp3
-rw-r--r--Tools/DumpRenderTree/chromium/Task.h8
-rw-r--r--Tools/DumpRenderTree/chromium/TestShell.cpp15
-rw-r--r--Tools/DumpRenderTree/chromium/WebPreferences.cpp7
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.cpp28
-rw-r--r--Tools/DumpRenderTree/chromium/WebViewHost.h21
-rw-r--r--Tools/DumpRenderTree/config.h4
-rw-r--r--Tools/DumpRenderTree/gtk/DumpRenderTree.cpp34
-rw-r--r--Tools/DumpRenderTree/gtk/EventSender.cpp26
-rw-r--r--Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp18
-rw-r--r--Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm7
-rw-r--r--Tools/DumpRenderTree/mac/CheckedMalloc.cpp27
-rw-r--r--Tools/DumpRenderTree/mac/DumpRenderTree.mm13
-rw-r--r--Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm17
-rw-r--r--Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm11
-rw-r--r--Tools/DumpRenderTree/mac/UIDelegate.mm2
-rw-r--r--Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp20
-rw-r--r--Tools/DumpRenderTree/qt/EventSenderQt.cpp3
-rw-r--r--Tools/DumpRenderTree/qt/ImageDiff.cpp2
-rw-r--r--Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp18
-rw-r--r--Tools/DumpRenderTree/qt/LayoutTestControllerQt.h4
-rw-r--r--Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro1
-rw-r--r--Tools/DumpRenderTree/win/DumpRenderTree.cpp67
-rw-r--r--Tools/DumpRenderTree/win/DumpRenderTreeWin.h2
-rw-r--r--Tools/DumpRenderTree/win/EditingDelegate.cpp4
-rw-r--r--Tools/DumpRenderTree/win/EventSender.cpp2
-rw-r--r--Tools/DumpRenderTree/win/FrameLoadDelegate.cpp30
-rw-r--r--Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp28
-rwxr-xr-xTools/DumpRenderTree/win/UIDelegate.cpp2
-rw-r--r--Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp12
51 files changed, 638 insertions, 234 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi
index 3c3384d..a3f0520 100644
--- a/Tools/DumpRenderTree/DumpRenderTree.gypi
+++ b/Tools/DumpRenderTree/DumpRenderTree.gypi
@@ -11,8 +11,6 @@
'chromium/CppVariant.h',
'chromium/DRTDevToolsAgent.cpp',
'chromium/DRTDevToolsAgent.h',
- 'chromium/DRTDevToolsCallArgs.cpp',
- 'chromium/DRTDevToolsCallArgs.h',
'chromium/DRTDevToolsClient.cpp',
'chromium/DRTDevToolsClient.h',
'chromium/DumpRenderTree.cpp',
@@ -54,6 +52,7 @@
'TestNetscapePlugIn/TestObject.h',
'TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp',
'TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp',
+ 'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp',
'TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp',
'TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp',
'TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp',
diff --git a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index 34ff710..000d83a 100644
--- a/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -36,6 +36,7 @@
1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A215A8011F2609C008AD0F5 /* PluginTest.h */; };
1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */; };
1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */; };
+ 1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */; };
1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8F024C0BB9B056008CFA34 /* TestObject.h */; };
1AC6C8490D07638600CD3161 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C77F0D07589B00CD3161 /* main.cpp */; };
1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7800D07589B00CD3161 /* PluginObject.cpp */; };
@@ -205,6 +206,7 @@
1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginTest.cpp; sourceTree = "<group>"; };
1A215A8011F2609C008AD0F5 /* PluginTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginTest.h; sourceTree = "<group>"; };
1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeObjectFromDestroyedPlugin.cpp; sourceTree = "<group>"; };
+ 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetURLWithJavaScriptURLDestroyingPlugin.cpp; sourceTree = "<group>"; };
1A8F024C0BB9B056008CFA34 /* TestObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestObject.h; sourceTree = "<group>"; };
1AC6C77F0D07589B00CD3161 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
1AC6C7800D07589B00CD3161 /* PluginObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginObject.cpp; sourceTree = "<group>"; };
@@ -467,6 +469,7 @@
children = (
1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */,
C0E720741281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp */,
+ 1A3E28A91311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp */,
1AD4CB2012A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp */,
1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */,
1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */,
@@ -759,6 +762,7 @@
C0EC3C9C12787F0500939164 /* NullNPPGetValuePointer.cpp in Sources */,
C0E720751281C828004EF533 /* EvaluateJSAfterRemovingPluginElement.cpp in Sources */,
1AD4CB2212A6D1350027A7AF /* GetUserAgentWithNullNPPFromNPPNew.cpp in Sources */,
+ 1A3E28AA1311D73B00501349 /* GetURLWithJavaScriptURLDestroyingPlugin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/Tools/DumpRenderTree/LayoutTestController.cpp b/Tools/DumpRenderTree/LayoutTestController.cpp
index 29eeeb0..9f1877c 100644
--- a/Tools/DumpRenderTree/LayoutTestController.cpp
+++ b/Tools/DumpRenderTree/LayoutTestController.cpp
@@ -83,6 +83,7 @@ LayoutTestController::LayoutTestController(const std::string& testPathOrURL, con
, m_handlesAuthenticationChallenges(false)
, m_isPrinting(false)
, m_deferMainResourceDataLoad(true)
+ , m_shouldPaintBrokenImage(true)
, m_testPathOrURL(testPathOrURL)
, m_expectedPixelHash(expectedPixelHash)
{
@@ -146,14 +147,21 @@ static JSValueRef dumpConfigurationForViewportCallback(JSContextRef context, JSO
if (argumentCount < 2)
return JSValueMakeUndefined(context);
- double availableWidth = JSValueToNumber(context, arguments[0], exception);
+
+ double deviceDPI = JSValueToNumber(context, arguments[0], exception);
+ ASSERT(!*exception);
+ double deviceWidth = JSValueToNumber(context, arguments[1], exception);
+ ASSERT(!*exception);
+ double deviceHeight = JSValueToNumber(context, arguments[2], exception);
ASSERT(!*exception);
- double availableHeight = JSValueToNumber(context, arguments[1], exception);
+ double availableWidth = JSValueToNumber(context, arguments[3], exception);
+ ASSERT(!*exception);
+ double availableHeight = JSValueToNumber(context, arguments[4], exception);
ASSERT(!*exception);
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
- controller->dumpConfigurationForViewport(static_cast<int>(availableWidth), static_cast<int>(availableHeight));
-
+ controller->dumpConfigurationForViewport(static_cast<int>(deviceDPI), static_cast<int>(deviceWidth), static_cast<int>(deviceHeight), static_cast<int>(availableWidth), static_cast<int>(availableHeight));
+
return JSValueMakeUndefined(context);
}
@@ -1424,6 +1432,21 @@ static JSValueRef setUserStyleSheetLocationCallback(JSContextRef context, JSObje
return JSValueMakeUndefined(context);
}
+static JSValueRef setValueForUserCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac implementation
+ if (argumentCount != 2)
+ return JSValueMakeUndefined(context);
+
+ JSRetainPtr<JSStringRef> value(Adopt, JSValueToStringCopy(context, arguments[1], exception));
+ ASSERT(!*exception);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setValueForUser(context, arguments[0], value.get());
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setViewModeMediaFeatureCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac implementation
@@ -1780,6 +1803,18 @@ static JSValueRef addUserStyleSheetCallback(JSContextRef context, JSObjectRef, J
return JSValueMakeUndefined(context);
}
+static JSValueRef setShouldPaintBrokenImageCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has Mac implementation
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setShouldPaintBrokenImage(JSValueToBoolean(context, arguments[0]));
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef apiTestNewWindowDataLoadBaseURLCallback(JSContextRef context, JSObjectRef, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount != 2)
@@ -1926,6 +1961,20 @@ static bool setGlobalFlagCallback(JSContextRef context, JSObjectRef thisObject,
return true;
}
+static JSValueRef setMinimumTimerIntervalCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+
+ double minimum = JSValueToNumber(context, arguments[0], exception);
+ ASSERT(!*exception);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setMinimumTimerInterval(minimum);
+
+ return JSValueMakeUndefined(context);
+}
+
static void layoutTestControllerObjectFinalize(JSObjectRef object)
{
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(object));
@@ -2073,6 +2122,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setMinimumTimerInterval", setMinimumTimerIntervalCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -2094,6 +2144,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setValueForUser", setValueForUserCallback, kJSPropertyAttributeDontDelete },
{ "setViewModeMediaFeature", setViewModeMediaFeatureCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setWebViewEditable", setWebViewEditableCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setWillSendRequestClearHeader", setWillSendRequestClearHeaderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
@@ -2112,6 +2163,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "addOriginAccessWhitelistEntry", addOriginAccessWhitelistEntryCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setScrollbarPolicy", setScrollbarPolicyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "authenticateSession", authenticateSessionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setShouldPaintBrokenImage", setShouldPaintBrokenImageCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
@@ -2201,5 +2253,10 @@ const std::string& LayoutTestController::redirectionDestinationForURL(std::strin
return m_URLsToRedirect[origin];
}
+void LayoutTestController::setShouldPaintBrokenImage(bool shouldPaintBrokenImage)
+{
+ m_shouldPaintBrokenImage = shouldPaintBrokenImage;
+}
+
const unsigned LayoutTestController::maxViewWidth = 800;
const unsigned LayoutTestController::maxViewHeight = 600;
diff --git a/Tools/DumpRenderTree/LayoutTestController.h b/Tools/DumpRenderTree/LayoutTestController.h
index 11558dd..4b1c04e 100644
--- a/Tools/DumpRenderTree/LayoutTestController.h
+++ b/Tools/DumpRenderTree/LayoutTestController.h
@@ -111,6 +111,7 @@ public:
void setUseDashboardCompatibilityMode(bool flag);
void setUserStyleSheetEnabled(bool flag);
void setUserStyleSheetLocation(JSStringRef path);
+ void setValueForUser(JSContextRef, JSValueRef nodeObject, JSStringRef value);
void setViewModeMediaFeature(JSStringRef mode);
void setXSSAuditorEnabled(bool flag);
void setFrameFlatteningEnabled(bool enable);
@@ -291,8 +292,8 @@ public:
bool hasSpellingMarker(int from, int length);
- void dumpConfigurationForViewport(int availableWidth, int availableHeight);
-
+ void dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
+
static void setSerializeHTTPLoads(bool serialize);
// The following API test functions should probably be moved to platform-specific
@@ -307,9 +308,14 @@ public:
JSRetainPtr<JSStringRef> markerTextForListItem(JSContextRef context, JSValueRef nodeObject) const;
+ void setShouldPaintBrokenImage(bool);
+ bool shouldPaintBrokenImage() const { return m_shouldPaintBrokenImage; }
+
static const unsigned maxViewWidth;
static const unsigned maxViewHeight;
+ void setMinimumTimerInterval(double);
+
private:
LayoutTestController(const std::string& testPathOrURL, const std::string& expectedPixelHash);
@@ -356,6 +362,7 @@ private:
bool m_handlesAuthenticationChallenges;
bool m_isPrinting;
bool m_deferMainResourceDataLoad;
+ bool m_shouldPaintBrokenImage;
std::string m_authenticationUsername;
std::string m_authenticationPassword;
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
index 0dd9da6..23120c4 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
@@ -79,11 +79,21 @@ NPError PluginTest::NPP_SetWindow(NPP, NPWindow*)
return NPERR_NO_ERROR;
}
+int16_t PluginTest::NPP_HandleEvent(void*)
+{
+ return 0;
+}
+
void PluginTest::NPN_InvalidateRect(NPRect* invalidRect)
{
browser->invalidaterect(m_npp, invalidRect);
}
+NPError PluginTest::NPN_GetURL(const char* url, const char* target)
+{
+ return browser->geturl(m_npp, url, target);
+}
+
NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
{
return browser->getstringidentifier(name);
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
index 2c06079..7c3a53e 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -60,8 +60,11 @@ public:
virtual NPError NPP_DestroyStream(NPStream* stream, NPReason reason);
virtual NPError NPP_GetValue(NPPVariable, void* value);
virtual NPError NPP_SetWindow(NPP, NPWindow*);
+ virtual int16_t NPP_HandleEvent(void* event);
// NPN functions.
+ NPError NPN_GetURL(const char* url, const char* target);
+
void NPN_InvalidateRect(NPRect* invalidRect);
NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
NPIdentifier NPN_GetIntIdentifier(int32_t intid);
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp
new file mode 100644
index 0000000..9d63198
--- /dev/null
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "PluginTest.h"
+
+using namespace std;
+
+// From NPP_New, call NPN_GetURL to evaluate JavaScript that destroys the plug-in.
+
+class GetURLWithJavaScriptURLDestroyingPlugin : public PluginTest {
+public:
+ GetURLWithJavaScriptURLDestroyingPlugin(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+
+ virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved)
+ {
+ NPN_GetURL("javascript:removePlugin()", 0);
+ return NPERR_NO_ERROR;
+ }
+};
+
+static PluginTest::Register<GetURLWithJavaScriptURLDestroyingPlugin> getURLWithJavaScriptURLDestroyingPlugin("get-url-with-javascript-url-destroying-plugin");
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowlessPaintRectCoordinates.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowlessPaintRectCoordinates.cpp
new file mode 100644
index 0000000..ffc92ea
--- /dev/null
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowlessPaintRectCoordinates.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2011 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "PluginTest.h"
+
+#include "PluginObject.h"
+
+using namespace std;
+
+// The rect passed in the WM_PAINT event for a windowless plugin should be relative to the page's
+// HWND and clipped to the plugin's bounds.
+
+class WindowlessPaintRectCoordinates : public PluginTest {
+public:
+ WindowlessPaintRectCoordinates(NPP, const string& identifier);
+
+private:
+ virtual NPError NPP_New(NPMIMEType, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData*);
+ virtual int16_t NPP_HandleEvent(void* event);
+};
+
+static PluginTest::Register<WindowlessPaintRectCoordinates> registrar("windowless-paint-rect-coordinates");
+
+WindowlessPaintRectCoordinates::WindowlessPaintRectCoordinates(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+{
+}
+
+NPError WindowlessPaintRectCoordinates::NPP_New(NPMIMEType, uint16_t, int16_t, char*[], char*[], NPSavedData*)
+{
+ browser->setvalue(m_npp, NPPVpluginWindowBool, 0);
+ return NPERR_NO_ERROR;
+}
+
+int16_t WindowlessPaintRectCoordinates::NPP_HandleEvent(void* typelessEvent)
+{
+ NPEvent* event = static_cast<NPEvent*>(typelessEvent);
+ if (!event) {
+ pluginLog(m_npp, "NPP_HandleEvent was passed a null event pointer");
+ return 0;
+ }
+
+ if (event->event != WM_PAINT)
+ return 0;
+
+ RECT* paintRect = reinterpret_cast<RECT*>(event->lParam);
+ if (!paintRect) {
+ pluginLog(m_npp, "A null paint rect was passed in the WM_PAINT event");
+ return 1;
+ }
+
+ // Keep these values in sync with windowless-paint-rect-coordinates.html.
+ RECT expectedRect = { 100, 100, 200, 200 };
+
+ if (::EqualRect(paintRect, &expectedRect))
+ pluginLog(m_npp, "Success");
+ else
+ pluginLog(m_npp, "Expected paint rect {left=%d, top=%d, right=%d, bottom=%d}, but got {left=%d, top=%d, right=%d, bottom=%d}", expectedRect.left, expectedRect.top, expectedRect.right, expectedRect.bottom, paintRect->left, paintRect->top, paintRect->right, paintRect->bottom);
+
+ return 1;
+}
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index 7635a09..b523fcb 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -697,6 +697,9 @@ int16_t NPP_HandleEvent(NPP instance, void *event)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+ if (obj->pluginTest->NPP_HandleEvent(event) == 1)
+ return 1;
+
#ifdef XP_MACOSX
#ifndef NP_NO_CARBON
if (obj->eventModel == NPEventModelCarbon)
diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index 11c9723..58a0a1f 100644
--- a/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/Tools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -398,6 +398,10 @@
>
</File>
<File
+ RelativePath="..\Tests\GetURLWithJavaScriptURLDestroyingPlugin.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\GetUserAgentWithNullNPPFromNPPNew.cpp"
>
</File>
@@ -441,6 +445,10 @@
>
</File>
<File
+ RelativePath="..\Tests\win\WindowlessPaintRectCoordinates.cpp"
+ >
+ </File>
+ <File
RelativePath="..\Tests\win\WindowRegionIsSetToClipRect.cpp"
>
</File>
diff --git a/Tools/DumpRenderTree/chromium/AccessibilityController.cpp b/Tools/DumpRenderTree/chromium/AccessibilityController.cpp
index 5601d9d..fc8855a 100644
--- a/Tools/DumpRenderTree/chromium/AccessibilityController.cpp
+++ b/Tools/DumpRenderTree/chromium/AccessibilityController.cpp
@@ -41,7 +41,8 @@
using namespace WebKit;
AccessibilityController::AccessibilityController(TestShell* shell)
- : m_shell(shell)
+ : m_dumpAccessibilityNotifications(false)
+ , m_shell(shell)
{
bindMethod("dumpAccessibilityNotifications", &AccessibilityController::dumpAccessibilityNotifications);
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
index 78c86e7..76aa781 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
@@ -31,12 +31,10 @@
#include "config.h"
#include "DRTDevToolsAgent.h"
-#include "DRTDevToolsCallArgs.h"
#include "DRTDevToolsClient.h"
#include "WebCString.h"
#include "WebDevToolsAgent.h"
-#include "WebString.h"
#include "WebView.h"
#include "webkit/support/webkit_support.h"
@@ -63,13 +61,13 @@ void DRTDevToolsAgent::setWebView(WebView* webView)
m_webView = webView;
}
-void DRTDevToolsAgent::sendMessageToInspectorFrontend(const WebKit::WebString& data)
+void DRTDevToolsAgent::sendMessageToInspectorFrontend(const WebString& data)
{
if (m_drtDevToolsClient)
- m_drtDevToolsClient->asyncCall(DRTDevToolsCallArgs(data));
+ m_drtDevToolsClient->asyncCall(data);
}
-void DRTDevToolsAgent::runtimePropertyChanged(const WebKit::WebString& name, const WebKit::WebString& value)
+void DRTDevToolsAgent::runtimePropertyChanged(const WebString& name, const WebString& value)
{
// FIXME: Implement.
}
@@ -84,18 +82,16 @@ WebDevToolsAgentClient::WebKitClientMessageLoop* DRTDevToolsAgent::createClientM
return webkit_support::CreateDevToolsMessageLoop();
}
-void DRTDevToolsAgent::asyncCall(const DRTDevToolsCallArgs& args)
+void DRTDevToolsAgent::asyncCall(const WebString& args)
{
postTask(new AsyncCallTask(this, args));
}
-void DRTDevToolsAgent::call(const DRTDevToolsCallArgs &args)
+void DRTDevToolsAgent::call(const WebString& args)
{
WebDevToolsAgent* agent = webDevToolsAgent();
if (agent)
- agent->dispatchOnInspectorBackend(args.m_data);
- if (DRTDevToolsCallArgs::callsCount() == 1 && m_drtDevToolsClient)
- m_drtDevToolsClient->allMessagesProcessed();
+ agent->dispatchOnInspectorBackend(args);
}
void DRTDevToolsAgent::delayedFrontendLoaded()
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
index 665435c..4cbc8bc 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsAgent.h
@@ -31,9 +31,9 @@
#ifndef DRTDevToolsAgent_h
#define DRTDevToolsAgent_h
-#include "DRTDevToolsCallArgs.h"
#include "Task.h"
#include "WebDevToolsAgentClient.h"
+#include "WebString.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
@@ -41,7 +41,6 @@ namespace WebKit {
class WebCString;
class WebDevToolsAgent;
-class WebString;
class WebView;
struct WebDevToolsMessageData;
@@ -65,7 +64,7 @@ public:
virtual WebKit::WebCString debuggerScriptSource();
virtual WebKitClientMessageLoop* createClientMessageLoop();
- void asyncCall(const DRTDevToolsCallArgs&);
+ void asyncCall(const WebKit::WebString& args);
void attach(DRTDevToolsClient*);
void detach();
@@ -76,18 +75,18 @@ public:
TaskList* taskList() { return &m_taskList; }
private:
- void call(const DRTDevToolsCallArgs&);
+ void call(const WebKit::WebString& args);
void delayedFrontendLoaded();
static void dispatchMessageLoop();
WebKit::WebDevToolsAgent* webDevToolsAgent();
class AsyncCallTask: public MethodTask<DRTDevToolsAgent> {
public:
- AsyncCallTask(DRTDevToolsAgent* object, const DRTDevToolsCallArgs& args)
+ AsyncCallTask(DRTDevToolsAgent* object, const WebKit::WebString& args)
: MethodTask<DRTDevToolsAgent>(object), m_args(args) {}
virtual void runIfValid() { m_object->call(m_args); }
private:
- DRTDevToolsCallArgs m_args;
+ WebKit::WebString m_args;
};
struct DelayedFrontendLoadedTask: public MethodTask<DRTDevToolsAgent> {
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.cpp
deleted file mode 100644
index dacd6f7..0000000
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "DRTDevToolsCallArgs.h"
-
-// static
-int DRTDevToolsCallArgs::m_callsCount = 0;
-
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h b/Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h
deleted file mode 100644
index a548159..0000000
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DRTDevToolsCallArgs_h
-#define DRTDevToolsCallArgs_h
-
-#include "WebString.h"
-#include <wtf/Assertions.h>
-
-class DRTDevToolsCallArgs {
-public:
- DRTDevToolsCallArgs(const WebKit::WebString& data)
- : m_data(data)
- {
- ++m_callsCount;
- }
-
- DRTDevToolsCallArgs(const DRTDevToolsCallArgs& args)
- : m_data(args.m_data)
- {
- ++m_callsCount;
- }
-
- ~DRTDevToolsCallArgs()
- {
- --m_callsCount;
- ASSERT(m_callsCount >= 0);
- }
-
- static int callsCount() { return m_callsCount; }
-
- WebKit::WebString m_data;
-
-private:
- static int m_callsCount;
-};
-
-#endif // DRTDevToolsCallArgs_h
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
index acccf18..27f0091 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
@@ -32,13 +32,11 @@
#include "DRTDevToolsClient.h"
#include "DRTDevToolsAgent.h"
-#include "DRTDevToolsCallArgs.h"
#include "WebDevToolsAgent.h"
#include "WebDevToolsFrontend.h"
#include "WebFrame.h"
#include "WebScriptSource.h"
-#include "WebString.h"
#include "WebView.h"
#include "webkit/support/webkit_support.h"
@@ -76,7 +74,7 @@ void DRTDevToolsClient::sendFrontendLoaded() {
void DRTDevToolsClient::sendMessageToBackend(const WebString& data)
{
if (m_drtDevToolsAgent)
- m_drtDevToolsAgent->asyncCall(DRTDevToolsCallArgs(data));
+ m_drtDevToolsAgent->asyncCall(data);
}
void DRTDevToolsClient::sendDebuggerCommandToAgent(const WebString& command)
@@ -104,21 +102,13 @@ void DRTDevToolsClient::undockWindow()
// Not implemented.
}
-void DRTDevToolsClient::asyncCall(const DRTDevToolsCallArgs& args)
+void DRTDevToolsClient::asyncCall(const WebString& args)
{
postTask(new AsyncCallTask(this, args));
}
-void DRTDevToolsClient::call(const DRTDevToolsCallArgs& args)
+void DRTDevToolsClient::call(const WebString& args)
{
- m_webDevToolsFrontend->dispatchOnInspectorFrontend(args.m_data);
- if (DRTDevToolsCallArgs::callsCount() == 1)
- allMessagesProcessed();
+ m_webDevToolsFrontend->dispatchOnInspectorFrontend(args);
}
-void DRTDevToolsClient::allMessagesProcessed()
-{
- m_webView->mainFrame()->executeScript(
- WebKit::WebScriptSource(WebString::fromUTF8(
- "if (window.WebInspector && WebInspector.queuesAreEmpty) WebInspector.queuesAreEmpty();")));
-}
diff --git a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h
index 0cba51c..8a93ee0 100644
--- a/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h
+++ b/Tools/DumpRenderTree/chromium/DRTDevToolsClient.h
@@ -31,17 +31,15 @@
#ifndef DRTDevToolsClient_h
#define DRTDevToolsClient_h
-#include "DRTDevToolsCallArgs.h"
#include "Task.h"
#include "WebDevToolsFrontendClient.h"
+#include "WebString.h"
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
-
namespace WebKit {
class WebDevToolsFrontend;
struct WebDevToolsMessageData;
-class WebString;
class WebView;
} // namespace WebKit
@@ -65,20 +63,20 @@ public:
virtual void dockWindow();
virtual void undockWindow();
- void asyncCall(const DRTDevToolsCallArgs&);
+ void asyncCall(const WebKit::WebString& args);
void allMessagesProcessed();
TaskList* taskList() { return &m_taskList; }
private:
- void call(const DRTDevToolsCallArgs&);
+ void call(const WebKit::WebString& args);
class AsyncCallTask: public MethodTask<DRTDevToolsClient> {
public:
- AsyncCallTask(DRTDevToolsClient* object, const DRTDevToolsCallArgs& args)
+ AsyncCallTask(DRTDevToolsClient* object, const WebKit::WebString& args)
: MethodTask<DRTDevToolsClient>(object), m_args(args) {}
virtual void runIfValid() { m_object->call(m_args); }
private:
- DRTDevToolsCallArgs m_args;
+ WebKit::WebString m_args;
};
TaskList m_taskList;
diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
index 7e9010f..e008432 100644
--- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -58,7 +58,19 @@ static const char optionEnableAccelerated2DCanvas[] = "--enable-accelerated-2d-c
static const char optionStressOpt[] = "--stress-opt";
static const char optionStressDeopt[] = "--stress-deopt";
static const char optionJavaScriptFlags[] = "--js-flags=";
-static const char optionNoTimeout[] = "--no-timeout=";
+static const char optionNoTimeout[] = "--no-timeout";
+
+class WebKitSupportTestEnvironment {
+public:
+ WebKitSupportTestEnvironment()
+ {
+ webkit_support::SetUpTestEnvironment();
+ }
+ ~WebKitSupportTestEnvironment()
+ {
+ webkit_support::TearDownTestEnvironment();
+ }
+};
static void runTest(TestShell& shell, TestParams& params, const string& testName, bool testShellMode)
{
@@ -109,7 +121,7 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName
int main(int argc, char* argv[])
{
- webkit_support::SetUpTestEnvironment();
+ WebKitSupportTestEnvironment testEnvironment;
platformInit(&argc, &argv);
TestParams params;
@@ -144,7 +156,7 @@ int main(int argc, char* argv[])
else if (argument == optionStartupDialog)
startupDialog = true;
else if (argument == optionCheckLayoutTestSystemDeps)
- exit(checkLayoutTestSystemDependencies() ? EXIT_SUCCESS : EXIT_FAILURE);
+ return checkLayoutTestSystemDependencies() ? EXIT_SUCCESS : EXIT_FAILURE;
else if (argument == optionHardwareAcceleratedGL)
hardwareAcceleratedGL = true;
else if (argument == optionEnableAcceleratedCompositing)
@@ -157,7 +169,7 @@ int main(int argc, char* argv[])
stressDeopt = true;
else if (!argument.find(optionJavaScriptFlags))
javaScriptFlags = argument.substr(strlen(optionJavaScriptFlags));
- else if (!argument.find(optionNoTimeout))
+ else if (argument == optionNoTimeout)
noTimeout = true;
else if (argument.size() && argument[0] == '-')
fprintf(stderr, "Unknown option: %s\n", argv[i]);
@@ -218,6 +230,5 @@ int main(int argc, char* argv[])
shell.resetTestController();
}
- webkit_support::TearDownTestEnvironment();
return EXIT_SUCCESS;
}
diff --git a/Tools/DumpRenderTree/chromium/EventSender.cpp b/Tools/DumpRenderTree/chromium/EventSender.cpp
index 77760ba..c5b7aa9 100644
--- a/Tools/DumpRenderTree/chromium/EventSender.cpp
+++ b/Tools/DumpRenderTree/chromium/EventSender.cpp
@@ -528,6 +528,9 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result)
code = webkit_support::VKEY_END;
else if ("printScreen" == codeStr)
code = webkit_support::VKEY_SNAPSHOT;
+ else if ("menu" == codeStr)
+ // FIXME: Change this to webkit_support::VKEY_APPS.
+ code = 0x5D;
else {
// Compare the input string with the function-key names defined by the
// DOM spec (i.e. "F1",...,"F24"). If the input string is a function-key
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
index 59537c6..b891d1e 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -147,6 +147,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
bindMethod("setIconDatabaseEnabled", &LayoutTestController::setIconDatabaseEnabled);
bindMethod("setJavaScriptCanAccessClipboard", &LayoutTestController::setJavaScriptCanAccessClipboard);
+ bindMethod("setMinimumTimerInterval", &LayoutTestController::setMinimumTimerInterval);
bindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation);
bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
@@ -1593,3 +1594,11 @@ void LayoutTestController::hasSpellingMarker(const CppArgumentList& arguments, C
return;
result->set(m_shell->webView()->mainFrame()->selectionStartHasSpellingMarkerFor(arguments[0].toInt32(), arguments[1].toInt32()));
}
+
+void LayoutTestController::setMinimumTimerInterval(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 1 || !arguments[0].isNumber())
+ return;
+ m_shell->webView()->settings()->setMinimumTimerInterval(arguments[0].toDouble());
+}
diff --git a/Tools/DumpRenderTree/chromium/LayoutTestController.h b/Tools/DumpRenderTree/chromium/LayoutTestController.h
index 0ef8607..6150133 100644
--- a/Tools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/Tools/DumpRenderTree/chromium/LayoutTestController.h
@@ -335,12 +335,15 @@ public:
void markerTextForListItem(const CppArgumentList&, CppVariant*);
void hasSpellingMarker(const CppArgumentList&, CppVariant*);
+ void setMinimumTimerInterval(const CppArgumentList&, CppVariant*);
+
public:
// The following methods are not exposed to JavaScript.
void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
bool shouldDumpAsText() { return m_dumpAsText; }
+ void setShouldDumpAsText(bool value) { m_dumpAsText = value; }
bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
@@ -356,6 +359,7 @@ public:
bool shouldDumpChildFrameScrollPositions() { return m_dumpChildFrameScrollPositions; }
bool shouldDumpChildFramesAsText() { return m_dumpChildFramesAsText; }
bool shouldGeneratePixelResults() { return m_generatePixelResults; }
+ void setShouldGeneratePixelResults(bool value) { m_generatePixelResults = value; }
bool acceptsEditing() { return m_acceptsEditing; }
bool canOpenWindows() { return m_canOpenWindows; }
bool shouldAddFileToPasteboard() { return m_shouldAddFileToPasteboard; }
diff --git a/Tools/DumpRenderTree/chromium/Task.cpp b/Tools/DumpRenderTree/chromium/Task.cpp
index 007a479..8638915 100644
--- a/Tools/DumpRenderTree/chromium/Task.cpp
+++ b/Tools/DumpRenderTree/chromium/Task.cpp
@@ -33,7 +33,6 @@
#include "WebKit.h"
#include "WebKitClient.h"
-#include "webkit/support/webkit_support.h"
WebTask::WebTask(TaskList* list): m_taskList(list) { m_taskList->registerTask(this); }
WebTask::~WebTask()
@@ -69,7 +68,7 @@ void postTask(WebTask* task)
void postDelayedTask(WebTask* task, int64_t ms)
{
- webkit_support::PostDelayedTask(invokeTask, static_cast<void*>(task), ms);
+ webkit_support::PostDelayedTask(task, ms);
}
diff --git a/Tools/DumpRenderTree/chromium/Task.h b/Tools/DumpRenderTree/chromium/Task.h
index f29dc7d..57d27ea 100644
--- a/Tools/DumpRenderTree/chromium/Task.h
+++ b/Tools/DumpRenderTree/chromium/Task.h
@@ -31,13 +31,15 @@
#ifndef Task_h
#define Task_h
+#include "webkit/support/webkit_support.h"
+#include <wtf/OwnPtr.h>
#include <wtf/Vector.h>
class TaskList;
// WebTask represents a task which can run by postTask() or postDelayedTask().
// it is named "WebTask", not "Task", to avoid conflist with base/task.h.
-class WebTask {
+class WebTask : public webkit_support::TaskAdaptor {
public:
WebTask(TaskList*);
// The main code of this task.
@@ -45,6 +47,10 @@ public:
virtual void run() = 0;
virtual void cancel() = 0;
virtual ~WebTask();
+
+private:
+ virtual void Run() { run(); }
+
protected:
TaskList* m_taskList;
};
diff --git a/Tools/DumpRenderTree/chromium/TestShell.cpp b/Tools/DumpRenderTree/chromium/TestShell.cpp
index 11a598f..2574abc 100644
--- a/Tools/DumpRenderTree/chromium/TestShell.cpp
+++ b/Tools/DumpRenderTree/chromium/TestShell.cpp
@@ -173,16 +173,18 @@ void TestShell::runFileTest(const TestParams& params)
m_params = params;
string testUrl = m_params.testUrl.spec();
- bool inspectorTestMode = testUrl.find("/inspector/") != string::npos
- || testUrl.find("\\inspector\\") != string::npos;
- m_prefs.developerExtrasEnabled = inspectorTestMode;
- applyPreferences();
-
if (testUrl.find("loading/") != string::npos
|| testUrl.find("loading\\") != string::npos)
m_layoutTestController->setShouldDumpFrameLoadCallbacks(true);
- if (inspectorTestMode)
+ if (testUrl.find("/dumpAsText/") != string::npos
+ || testUrl.find("\\dumpAsText\\") != string::npos) {
+ m_layoutTestController->setShouldDumpAsText(true);
+ m_layoutTestController->setShouldGeneratePixelResults(false);
+ }
+
+ if (testUrl.find("/inspector/") != string::npos
+ || testUrl.find("\\inspector\\") != string::npos)
showDevTools();
if (m_dumpWhenFinished)
@@ -222,6 +224,7 @@ void TestShell::resetTestController()
m_drtDevToolsAgent->reset();
if (m_drtDevToolsClient)
m_drtDevToolsClient->reset();
+ webView()->mainFrame()->clearOpener();
}
void TestShell::loadURL(const WebURL& url)
diff --git a/Tools/DumpRenderTree/chromium/WebPreferences.cpp b/Tools/DumpRenderTree/chromium/WebPreferences.cpp
index 7c274c3..71f5ec7 100644
--- a/Tools/DumpRenderTree/chromium/WebPreferences.cpp
+++ b/Tools/DumpRenderTree/chromium/WebPreferences.cpp
@@ -73,7 +73,7 @@ void WebPreferences::reset()
allowFileAccessFromFileURLs = true;
authorAndUserStylesEnabled = true;
defaultTextEncodingName = WebString::fromUTF8("ISO-8859-1");
- developerExtrasEnabled = false;
+ developerExtrasEnabled = true;
experimentalWebGLEnabled = false;
javaEnabled = false;
javaScriptCanAccessClipboard = true;
@@ -148,6 +148,8 @@ void WebPreferences::applyTo(WebView* webView)
// tabbing to links by default.
webView->setTabsToLinks(tabsToLinks);
settings->setCaretBrowsingEnabled(caretBrowsingEnabled);
+ settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled);
+ settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled);
// Fixed values.
settings->setShouldPaintCustomScrollbars(true);
@@ -160,7 +162,6 @@ void WebPreferences::applyTo(WebView* webView)
settings->setTextDirectionSubmenuInclusionBehaviorNeverIncluded();
settings->setUsesEncodingDetector(false);
settings->setImagesEnabled(true);
- settings->setAcceleratedCompositingEnabled(acceleratedCompositingEnabled);
- settings->setAccelerated2dCanvasEnabled(accelerated2dCanvasEnabled);
+ settings->setInteractiveFormValidationEnabled(true);
}
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.cpp b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
index e1a2fcb..a0ed6da 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -228,12 +228,6 @@ static string textAffinityDescription(WebTextAffinity affinity)
return "(UNKNOWN AFFINITY)";
}
-static void invokeFinishLastTextCheck(void* context)
-{
- WebViewHost* wvh = static_cast<WebViewHost*>(context);
- wvh->finishLastTextCheck();
-}
-
// WebViewClient -------------------------------------------------------------
WebView* WebViewHost::createView(WebFrame*, const WebURLRequest&, const WebWindowFeatures&, const WebString&)
@@ -422,7 +416,7 @@ void WebViewHost::requestCheckingOfText(const WebString& text, WebTextCheckingCo
{
m_lastRequestedTextCheckingCompletion = completion;
m_lastRequestedTextCheckString = text;
- webkit_support::PostDelayedTask(invokeFinishLastTextCheck, static_cast<void*>(this), 0);
+ postDelayedTask(new HostMethodTask(this, &WebViewHost::finishLastTextCheck), 0);
}
void WebViewHost::finishLastTextCheck()
@@ -663,15 +657,9 @@ void WebViewHost::scheduleComposite()
}
#if ENABLE(REQUEST_ANIMATION_FRAME)
-static void invokeScheduleComposite(void* context)
-{
- WebViewHost* wvh = static_cast<WebViewHost*>(context);
- wvh->scheduleComposite();
-}
-
void WebViewHost::scheduleAnimation()
{
- webkit_support::PostDelayedTask(invokeScheduleComposite, this, 0);
+ postDelayedTask(new HostMethodTask(this, &WebViewHost::scheduleComposite), 0);
}
#endif
@@ -716,15 +704,9 @@ void WebViewHost::closeWidget()
// No more code here, we should be deleted at this point.
}
-static void invokeCloseWidget(void* context)
-{
- WebViewHost* wvh = static_cast<WebViewHost*>(context);
- wvh->closeWidget();
-}
-
void WebViewHost::closeWidgetSoon()
{
- webkit_support::PostDelayedTask(invokeCloseWidget, static_cast<void*>(this), 0);
+ postDelayedTask(new HostMethodTask(this, &WebViewHost::closeWidget), 0);
}
void WebViewHost::didChangeCursor(const WebCursorInfo& cursorInfo)
@@ -1226,8 +1208,10 @@ void WebViewHost::reset()
m_windowRect = WebRect();
m_paintRect = WebRect();
- if (m_webWidget)
+ if (m_webWidget) {
webView()->mainFrame()->setName(WebString());
+ webView()->settings()->setMinimumTimerInterval(webkit_support::GetForegroundTabTimerInterval());
+ }
}
void WebViewHost::setSelectTrailingWhitespaceEnabled(bool enabled)
diff --git a/Tools/DumpRenderTree/chromium/WebViewHost.h b/Tools/DumpRenderTree/chromium/WebViewHost.h
index e6d82ae..4fc3400 100644
--- a/Tools/DumpRenderTree/chromium/WebViewHost.h
+++ b/Tools/DumpRenderTree/chromium/WebViewHost.h
@@ -32,6 +32,7 @@
#define WebViewHost_h
#include "MockSpellCheck.h"
+#include "Task.h"
#include "TestNavigationController.h"
#include "WebAccessibilityNotification.h"
#include "WebCursorInfo.h"
@@ -216,7 +217,25 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
// Geolocation client mocks for LayoutTestController
WebKit::WebGeolocationClientMock* geolocationClientMock();
+ // Pending task list, Note taht the method is referred from MethodTask class.
+ TaskList* taskList() { return &m_taskList; }
+
private:
+
+ class HostMethodTask : public MethodTask<WebViewHost> {
+ public:
+ typedef void (WebViewHost::*CallbackMethodType)();
+ HostMethodTask(WebViewHost* object, CallbackMethodType callback)
+ : MethodTask<WebViewHost>(object)
+ , m_callback(callback)
+ { }
+
+ virtual void runIfValid() { (m_object->*m_callback)(); }
+
+ private:
+ CallbackMethodType m_callback;
+ };
+
LayoutTestController* layoutTestController() const;
// Called the title of the page changes.
@@ -327,6 +346,8 @@ private:
WebKit::WebString m_lastRequestedTextCheckString;
WebKit::WebTextCheckingCompletion* m_lastRequestedTextCheckingCompletion;
+
+ TaskList m_taskList;
};
#endif // WebViewHost_h
diff --git a/Tools/DumpRenderTree/config.h b/Tools/DumpRenderTree/config.h
index 55e2dc1..351a2b1 100644
--- a/Tools/DumpRenderTree/config.h
+++ b/Tools/DumpRenderTree/config.h
@@ -41,7 +41,7 @@
#endif
#if PLATFORM(MAC)
-#define WTF_PLATFORM_CF 1
+#define WTF_USE_CF 1
#if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
#define BUILDING_ON_TIGER 1
@@ -53,7 +53,7 @@
#endif // PLATFORM(MAC)
#if PLATFORM(WIN)
-#define WTF_PLATFORM_CF 1
+#define WTF_USE_CF 1
#if defined(WIN_CAIRO)
#define WTF_PLATFORM_CAIRO 1
#define WTF_USE_CURL 1
diff --git a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
index ff3327f..3f70b49 100644
--- a/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -105,6 +105,11 @@ static bool shouldOpenWebInspector(const string& pathOrURL)
return pathOrURL.find("inspector/") != string::npos;
}
+static bool shouldDumpAsText(const string& pathOrURL)
+{
+ return pathOrURL.find("dumpAsText/") != string::npos;
+}
+
static bool shouldEnableDeveloperExtras(const string& pathOrURL)
{
return true;
@@ -232,6 +237,13 @@ static void initializeFonts(const char* testURL = 0)
if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(ahemFontFilename.get())))
g_error("Could not load font at %s!", ahemFontFilename.get());
+ for (int i = 1; i <= 9; i++) {
+ GOwnPtr<gchar> fontFilename(g_strdup_printf("WebKitWeightWatcher%i00.ttf", i));
+ GOwnPtr<gchar> fontPath(g_build_filename(FONTS_CONF_DIR, "..", "..", "fonts", fontFilename.get(), NULL));
+ if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(fontPath.get())))
+ g_error("Could not load font at %s!", fontPath.get());
+ }
+
// A font with no valid Fontconfig encoding to test https://bugs.webkit.org/show_bug.cgi?id=47452
GOwnPtr<gchar> fontWithNoValidEncodingFilename(g_build_filename(FONTS_CONF_DIR, "FontWithNoValidEncoding.fon", NULL));
if (!FcConfigAppFontAddFile(config, reinterpret_cast<FcChar8*>(fontWithNoValidEncodingFilename.get())))
@@ -428,6 +440,7 @@ static void resetDefaultsToConsistentValues()
g_object_set(G_OBJECT(inspector), "javascript-profiling-enabled", FALSE, NULL);
webkit_web_view_set_zoom_level(webView, 1.0);
+ DumpRenderTreeSupportGtk::setMinimumTimerInterval(webView, DumpRenderTreeSupportGtk::defaultMinimumTimerInterval());
DumpRenderTreeSupportGtk::resetOriginAccessWhiteLists();
@@ -446,9 +459,12 @@ static void resetDefaultsToConsistentValues()
DumpRenderTreeSupportGtk::setLinksIncludedInFocusChain(true);
DumpRenderTreeSupportGtk::setIconDatabaseEnabled(false);
+ DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(false);
if (axController)
axController->resetToConsistentState();
+
+ DumpRenderTreeSupportGtk::clearOpener(mainFrame);
}
static bool useLongRunningServerMode(int argc, char *argv[])
@@ -504,7 +520,7 @@ void dump()
gchar* responseMimeType = webkit_web_frame_get_response_mime_type(mainFrame);
if (g_str_equal(responseMimeType, "text/plain")) {
- gLayoutTestController->setDumpAsText(true);
+ gLayoutTestController->setDumpAsText(true);
gLayoutTestController->setGeneratePixelResults(false);
}
g_free(responseMimeType);
@@ -630,6 +646,10 @@ static void runTest(const string& testPathOrURL)
gLayoutTestController->setDeveloperExtrasEnabled(true);
if (shouldOpenWebInspector(testURL))
gLayoutTestController->showWebInspector();
+ if (shouldDumpAsText(testURL)) {
+ gLayoutTestController->setDumpAsText(true);
+ gLayoutTestController->setGeneratePixelResults(false);
+ }
}
WorkQueue::shared()->clear();
@@ -1004,6 +1024,17 @@ static void frameCreatedCallback(WebKitWebView* webView, WebKitWebFrame* webFram
g_signal_connect(webFrame, "notify::load-status", G_CALLBACK(webFrameLoadStatusNotified), NULL);
}
+static void willSendRequestCallback(WebKitWebView* webView, WebKitWebFrame*, WebKitWebResource*, WebKitNetworkRequest* request, WebKitNetworkResponse*)
+{
+ SoupMessage* soupMessage = webkit_network_request_get_message(request);
+
+ if (soupMessage) {
+ const set<string>& clearHeaders = gLayoutTestController->willSendRequestClearHeaders();
+ for (set<string>::const_iterator header = clearHeaders.begin(); header != clearHeaders.end(); ++header)
+ soup_message_headers_remove(soupMessage->request_headers, header->c_str());
+ }
+}
+
static WebKitWebView* createWebView()
{
WebKitWebView* view = WEBKIT_WEB_VIEW(webkit_web_view_new());
@@ -1032,6 +1063,7 @@ static WebKitWebView* createWebView()
"signal::drag-end", dragEndCallback, 0,
"signal::drag-failed", dragFailedCallback, 0,
"signal::frame-created", frameCreatedCallback, 0,
+ "signal::resource-request-starting", willSendRequestCallback, 0,
NULL);
connectEditingCallbacks(view);
diff --git a/Tools/DumpRenderTree/gtk/EventSender.cpp b/Tools/DumpRenderTree/gtk/EventSender.cpp
index 10e129c..068dd5a 100644
--- a/Tools/DumpRenderTree/gtk/EventSender.cpp
+++ b/Tools/DumpRenderTree/gtk/EventSender.cpp
@@ -229,6 +229,29 @@ static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef functio
return valueRef;
}
+static gboolean sendClick(gpointer)
+{
+ GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS);
+
+ if (!prepareMouseButtonEvent(pressEvent, 1, 0)) {
+ gdk_event_free(pressEvent);
+ return FALSE;
+ }
+
+ GdkEvent* releaseEvent = gdk_event_copy(pressEvent);
+ dispatchEvent(pressEvent);
+ releaseEvent->type = GDK_BUTTON_RELEASE;
+ dispatchEvent(releaseEvent);
+
+ return FALSE;
+}
+
+static JSValueRef scheduleAsynchronousClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ g_idle_add(sendClick, 0);
+ return JSValueMakeUndefined(context);
+}
+
static void updateClickCount(int button)
{
if (lastClickPositionX != lastMousePositionX
@@ -644,6 +667,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
gdkKeySym = GDK_Delete;
else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
gdkKeySym = GDK_Print;
+ else if (JSStringIsEqualToUTF8CString(character, "menu"))
+ gdkKeySym = GDK_Menu;
else if (JSStringIsEqualToUTF8CString(character, "F1"))
gdkKeySym = GDK_F1;
else if (JSStringIsEqualToUTF8CString(character, "F2"))
@@ -776,6 +801,7 @@ static JSStaticFunction staticFunctions[] = {
{ "textZoomOut", textZoomOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "zoomPageIn", zoomPageInCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "zoomPageOut", zoomPageOutCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "scheduleAsynchronousClick", scheduleAsynchronousClickCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
diff --git a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 56d75f7..77d6ae1 100644
--- a/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/Tools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -50,7 +50,6 @@
#include <wtf/gobject/GOwnPtr.h>
extern "C" {
-void webkit_application_cache_set_maximum_size(unsigned long long size);
void webkit_web_inspector_execute_script(WebKitWebInspector* inspector, long callId, const gchar* script);
}
@@ -333,6 +332,11 @@ void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
setUserStyleSheetEnabled(true);
}
+void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setViewModeMediaFeature(JSStringRef mode)
{
WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
@@ -508,7 +512,7 @@ void LayoutTestController::setJavaScriptProfilingEnabled(bool flag)
void LayoutTestController::setSelectTrailingWhitespaceEnabled(bool flag)
{
- // FIXME: implement
+ DumpRenderTreeSupportGtk::setSelectTrailingWhitespaceEnabled(flag);
}
void LayoutTestController::setPopupBlockingEnabled(bool flag)
@@ -869,14 +873,20 @@ bool LayoutTestController::hasSpellingMarker(int from, int length)
return DumpRenderTreeSupportGtk::webkitWebFrameSelectionHasSpellingMarker(mainFrame, from, length);
}
-void LayoutTestController::dumpConfigurationForViewport(int availableWidth, int availableHeight)
+void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight)
{
WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
ASSERT(webView);
- DumpRenderTreeSupportGtk::dumpConfigurationForViewport(webView, availableWidth, availableHeight);
+ DumpRenderTreeSupportGtk::dumpConfigurationForViewport(webView, deviceDPI, deviceWidth, deviceHeight, availableWidth, availableHeight);
}
void LayoutTestController::setSerializeHTTPLoads(bool)
{
// FIXME: Implement if needed for https://bugs.webkit.org/show_bug.cgi?id=50758.
}
+
+void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval)
+{
+ WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
+ DumpRenderTreeSupportGtk::setMinimumTimerInterval(webView, minimumTimerInterval);
+}
diff --git a/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm b/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm
index d41f01d..475b839 100644
--- a/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm
+++ b/Tools/DumpRenderTree/mac/AccessibilityControllerMac.mm
@@ -50,7 +50,6 @@ AccessibilityUIElement AccessibilityController::elementAtPoint(int x, int y)
AccessibilityUIElement AccessibilityController::focusedElement()
{
- // FIXME: we could do some caching here.
id accessibilityObject = [[mainFrame accessibilityRoot] accessibilityFocusedUIElement];
return AccessibilityUIElement(accessibilityObject);
}
@@ -58,7 +57,11 @@ AccessibilityUIElement AccessibilityController::focusedElement()
AccessibilityUIElement AccessibilityController::rootElement()
{
// FIXME: we could do some caching here.
- id accessibilityObject = [mainFrame accessibilityRoot];
+
+ // Layout tests expect that the root element will be the scroll area
+ // containing the web area object. That will be the parent of the accessibilityRoot on WK1.
+
+ id accessibilityObject = [[mainFrame accessibilityRoot] accessibilityAttributeValue:NSAccessibilityParentAttribute];
return AccessibilityUIElement(accessibilityObject);
}
diff --git a/Tools/DumpRenderTree/mac/CheckedMalloc.cpp b/Tools/DumpRenderTree/mac/CheckedMalloc.cpp
index faef760..bb45c23 100644
--- a/Tools/DumpRenderTree/mac/CheckedMalloc.cpp
+++ b/Tools/DumpRenderTree/mac/CheckedMalloc.cpp
@@ -31,8 +31,10 @@
#import "config.h"
#import "CheckedMalloc.h"
+#import <mach/mach_init.h>
+#import <mach/mach_vm.h>
+#import <mach/vm_region.h>
#import <malloc/malloc.h>
-#import <sys/mman.h>
static void* (*savedMalloc)(malloc_zone_t*, size_t);
static void* (*savedRealloc)(malloc_zone_t*, void*, size_t);
@@ -51,14 +53,30 @@ static void* checkedRealloc(malloc_zone_t* zone, void* ptr, size_t size)
return savedRealloc(zone, ptr, size);
}
+#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+static vm_prot_t protectionOfRegion(mach_vm_address_t address)
+{
+ mach_vm_size_t regionSize = 0;
+ vm_region_basic_info_64 regionInfo;
+ mach_msg_type_number_t regionInfoCount = VM_REGION_BASIC_INFO_COUNT_64;
+ mach_port_t objectName;
+ if (mach_vm_region(mach_task_self(), &address, &regionSize, VM_REGION_BASIC_INFO_64, (vm_region_info_t)&regionInfo, &regionInfoCount, &objectName))
+ CRASH();
+ return regionInfo.protection;
+}
+#endif
+
void makeLargeMallocFailSilently()
{
malloc_zone_t* zone = malloc_default_zone();
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- vm_address_t pageStart = reinterpret_cast<vm_address_t>(zone) & static_cast<vm_size_t>(~(getpagesize() - 1));
+ mach_vm_address_t pageStart = reinterpret_cast<vm_address_t>(zone) & static_cast<vm_size_t>(~(getpagesize() - 1));
+ vm_prot_t initialProtection = protectionOfRegion(pageStart);
+
vm_size_t len = reinterpret_cast<vm_address_t>(zone) - pageStart + sizeof(malloc_zone_t);
- mprotect(reinterpret_cast<void*>(pageStart), len, PROT_READ | PROT_WRITE);
+ if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection | VM_PROT_WRITE))
+ CRASH();
#endif
savedMalloc = zone->malloc;
@@ -67,6 +85,7 @@ void makeLargeMallocFailSilently()
zone->realloc = checkedRealloc;
#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
- mprotect(reinterpret_cast<void*>(pageStart), len, PROT_READ);
+ if (mach_vm_protect(mach_task_self(), pageStart, len, 0, initialProtection))
+ CRASH();
#endif
}
diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm
index eab3742..dca0d38 100644
--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -407,6 +407,7 @@ static void resetDefaultsToConsistentValues()
[defaults setBool:NO forKey:@"AppleScrollAnimationEnabled"];
[defaults setBool:NO forKey:@"NSOverlayScrollersEnabled"];
+ [defaults setObject:@"Always" forKey:@"AppleShowScrollBars"];
if (initialValue)
CFPreferencesSetValue(CFSTR("AppleScrollBarVariant"), initialValue.get(), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
@@ -995,6 +996,11 @@ static bool shouldOpenWebInspector(const char* pathOrURL)
return strstr(pathOrURL, "inspector/");
}
+static bool shouldDumpAsText(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "dumpAsText/");
+}
+
static bool shouldEnableDeveloperExtras(const char* pathOrURL)
{
return true;
@@ -1017,6 +1023,7 @@ static void resetWebViewToConsistentStateBeforeTesting()
[[webView undoManager] removeAllActions];
[WebView _removeAllUserContentFromGroup:[webView groupName]];
[[webView window] setAutodisplay:NO];
+ [webView _setMinimumTimerInterval:[WebView _defaultMinimumTimerInterval]];
resetDefaultsToConsistentValues();
@@ -1030,6 +1037,8 @@ static void resetWebViewToConsistentStateBeforeTesting()
// Clear the contents of the general pasteboard
[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
+
+ [mainFrame _clearOpener];
}
static void runTest(const string& testPathOrURL)
@@ -1088,6 +1097,10 @@ static void runTest(const string& testPathOrURL)
gLayoutTestController->setDeveloperExtrasEnabled(true);
if (shouldOpenWebInspector(pathOrURL.c_str()))
gLayoutTestController->showWebInspector();
+ if (shouldDumpAsText(pathOrURL.c_str())) {
+ gLayoutTestController->setDumpAsText(true);
+ gLayoutTestController->setGeneratePixelResults(false);
+ }
}
if ([WebHistory optionalSharedHistory])
diff --git a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index a691951..72ec759 100644
--- a/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/Tools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -479,6 +479,16 @@ void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
[[WebPreferences standardPreferences] setUserStyleSheetLocation:url];
}
+void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef nodeObject, JSStringRef value)
+{
+ DOMElement *element = [DOMElement _DOMElementFromJSContext:context value:nodeObject];
+ if (!element || ![element isKindOfClass:[DOMHTMLInputElement class]])
+ return;
+
+ RetainPtr<CFStringRef> valueCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, value));
+ [(DOMHTMLInputElement *)element _setValueForUser:(NSString *)valueCF.get()];
+}
+
void LayoutTestController::setViewModeMediaFeature(JSStringRef mode)
{
// FIXME: implement
@@ -994,7 +1004,7 @@ bool LayoutTestController::hasSpellingMarker(int from, int length)
{
return [mainFrame hasSpellingMarker:from length:length];
}
-void LayoutTestController::dumpConfigurationForViewport(int /*availableWidth*/, int /*availableHeight*/)
+void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/)
{
}
@@ -1003,3 +1013,8 @@ void LayoutTestController::setSerializeHTTPLoads(bool serialize)
{
[WebView _setLoadResourcesSerially:serialize];
}
+
+void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval)
+{
+ [[mainFrame webView] _setMinimumTimerInterval:minimumTimerInterval];
+}
diff --git a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm
index 2854ca4..f5a2121 100644
--- a/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm
+++ b/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm
@@ -245,4 +245,15 @@ using namespace std;
return response;
}
+-(BOOL)webView: (WebView*)webView shouldPaintBrokenImageForURL:(NSURL*)imageURL
+{
+ // Only log the message when shouldPaintBrokenImage() returns NO; this avoids changing results of layout tests with failed
+ // images, e.g., security/block-test-no-port.html.
+ if (!done && gLayoutTestController->dumpResourceLoadCallbacks() && !gLayoutTestController->shouldPaintBrokenImage()) {
+ NSString *string = [NSString stringWithFormat:@"%@ - shouldPaintBrokenImage: NO", [imageURL _drt_descriptionSuitableForTestResult]];
+ printf("%s\n", [string UTF8String]);
+ }
+
+ return gLayoutTestController->shouldPaintBrokenImage();
+}
@end
diff --git a/Tools/DumpRenderTree/mac/UIDelegate.mm b/Tools/DumpRenderTree/mac/UIDelegate.mm
index 6194c26..06a71f8 100644
--- a/Tools/DumpRenderTree/mac/UIDelegate.mm
+++ b/Tools/DumpRenderTree/mac/UIDelegate.mm
@@ -57,7 +57,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
return m_frame;
}
-- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary
+- (void)webView:(WebView *)sender addMessageToConsole:(NSDictionary *)dictionary withSource:(NSString *)source
{
NSString *message = [dictionary objectForKey:@"message"];
NSNumber *lineNumber = [dictionary objectForKey:@"lineNumber"];
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index 7d20f47..6af6fc2 100644
--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -205,6 +205,8 @@ void WebPage::resetSettings()
QWebSettings::setMaximumPagesInCache(0); // reset to default
settings()->setUserStyleSheetUrl(QUrl()); // reset to default
+ DumpRenderTreeSupportQt::setMinimumTimerInterval(this, DumpRenderTreeSupportQt::defaultMinimumTimerInterval());
+
m_pendingGeolocationRequests.clear();
}
@@ -416,11 +418,12 @@ DumpRenderTree::DumpRenderTree()
, m_graphicsBased(false)
, m_persistentStoragePath(QString(getenv("DUMPRENDERTREE_TEMP")))
{
-
QByteArray viewMode = getenv("QT_DRT_WEBVIEW_MODE");
if (viewMode == "graphics")
setGraphicsBased(true);
+ // Set running in DRT mode for qwebpage to create testable objects.
+ DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(true);
DumpRenderTreeSupportQt::overwritePluginDirectories();
DumpRenderTreeSupportQt::activeMockDeviceOrientationClient(true);
QWebSettings::enablePersistentStorage(m_persistentStoragePath);
@@ -578,6 +581,8 @@ void DumpRenderTree::resetToConsistentStateBeforeTesting(const QUrl& url)
#ifndef Q_OS_WINCE
setlocale(LC_ALL, "");
#endif
+
+ DumpRenderTreeSupportQt::clearOpener(m_page->mainFrame());
}
static bool isGlobalHistoryTest(const QUrl& url)
@@ -594,6 +599,14 @@ static bool isWebInspectorTest(const QUrl& url)
return false;
}
+static bool isDumpAsTextTest(const QUrl& url)
+{
+ if (url.path().contains("dumpAsText/"))
+ return true;
+ return false;
+}
+
+
void DumpRenderTree::open(const QUrl& url)
{
DumpRenderTreeSupportQt::dumpResourceLoadCallbacksPath(QFileInfo(url.toString()).path());
@@ -605,6 +618,11 @@ void DumpRenderTree::open(const QUrl& url)
if (isWebInspectorTest(url))
layoutTestController()->showWebInspector();
+ if (isDumpAsTextTest(url)) {
+ layoutTestController()->dumpAsText();
+ setDumpPixels(false);
+ }
+
if (isGlobalHistoryTest(url))
layoutTestController()->dumpHistoryCallbacks();
diff --git a/Tools/DumpRenderTree/qt/EventSenderQt.cpp b/Tools/DumpRenderTree/qt/EventSenderQt.cpp
index 6449484..ef89e02 100644
--- a/Tools/DumpRenderTree/qt/EventSenderQt.cpp
+++ b/Tools/DumpRenderTree/qt/EventSenderQt.cpp
@@ -352,6 +352,9 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u
} else if (string == QLatin1String("printScreen")) {
s = QString();
code = Qt::Key_Print;
+ } else if (string == QLatin1String("menu")) {
+ s = QString();
+ code = Qt::Key_Menu;
}
}
QKeyEvent event(QEvent::KeyPress, code, modifs, s);
diff --git a/Tools/DumpRenderTree/qt/ImageDiff.cpp b/Tools/DumpRenderTree/qt/ImageDiff.cpp
index 9282e2f..def1294 100644
--- a/Tools/DumpRenderTree/qt/ImageDiff.cpp
+++ b/Tools/DumpRenderTree/qt/ImageDiff.cpp
@@ -142,6 +142,8 @@ int main(int argc, char* argv[])
fflush(stdout);
}
+ actualImage = QImage();
+ baselineImage = QImage();
}
}
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index a11bc60..74055e2 100644
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -86,6 +86,7 @@ void LayoutTestController::reset()
DumpRenderTreeSupportQt::setCustomPolicyDelegate(false, false);
DumpRenderTreeSupportQt::dumpHistoryCallbacks(false);
DumpRenderTreeSupportQt::dumpVisitedLinksCallbacks(false);
+ DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->webPage());
setIconDatabaseEnabled(false);
clearAllDatabases();
@@ -235,9 +236,9 @@ QString LayoutTestController::pathToLocalResource(const QString& url)
return QDir::toNativeSeparators(url);
}
-void LayoutTestController::dumpConfigurationForViewport(int availableWidth, int availableHeight)
+void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight)
{
- QString res = DumpRenderTreeSupportQt::viewportAsText(m_drt->webPage(), QSize(availableWidth, availableHeight));
+ QString res = DumpRenderTreeSupportQt::viewportAsText(m_drt->webPage(), deviceDPI, QSize(deviceWidth, deviceHeight), QSize(availableWidth, availableHeight));
fputs(qPrintable(res), stdout);
}
@@ -620,7 +621,7 @@ void LayoutTestController::overridePreference(const QString& name, const QVarian
void LayoutTestController::setUserStyleSheetLocation(const QString& url)
{
- m_userStyleSheetLocation = QUrl(url);
+ m_userStyleSheetLocation = QUrl::fromEncoded(url.toAscii(), QUrl::StrictMode);
if (m_userStyleSheetEnabled)
setUserStyleSheetEnabled(true);
@@ -762,7 +763,7 @@ void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double
void LayoutTestController::setGeolocationPermission(bool allow)
{
setGeolocationPermissionCommon(allow);
- emit geolocationPermissionSet();
+ DumpRenderTreeSupportQt::setMockGeolocationPermission(m_drt->webPage(), allow);
}
void LayoutTestController::setGeolocationPermissionCommon(bool allow)
@@ -773,12 +774,12 @@ void LayoutTestController::setGeolocationPermissionCommon(bool allow)
void LayoutTestController::setMockGeolocationError(int code, const QString& message)
{
- DumpRenderTreeSupportQt::setMockGeolocationError(code, message);
+ DumpRenderTreeSupportQt::setMockGeolocationError(m_drt->webPage(), code, message);
}
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
- DumpRenderTreeSupportQt::setMockGeolocationPosition(latitude, longitude, accuracy);
+ DumpRenderTreeSupportQt::setMockGeolocationPosition(m_drt->webPage(), latitude, longitude, accuracy);
}
void LayoutTestController::addMockSpeechInputResult(const QString& result, double confidence, const QString& language)
@@ -836,5 +837,10 @@ void LayoutTestController::addURLToRedirect(const QString& origin, const QString
DumpRenderTreeSupportQt::addURLToRedirect(origin, destination);
}
+void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval)
+{
+ DumpRenderTreeSupportQt::setMinimumTimerInterval(m_drt->webPage(), minimumTimerInterval);
+}
+
const unsigned LayoutTestController::maxViewWidth = 800;
const unsigned LayoutTestController::maxViewHeight = 600;
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
index bc62c51..0b5bbba 100644
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -114,7 +114,7 @@ public slots:
void dumpResourceLoadCallbacks();
void dumpResourceResponseMIMETypes();
void dumpHistoryCallbacks();
- void dumpConfigurationForViewport(int availableWidth, int availableHeight);
+ void dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight);
void setWillSendRequestReturnsNullOnRedirect(bool enabled);
void setWillSendRequestReturnsNull(bool enabled);
void setWillSendRequestClearHeader(const QStringList& headers);
@@ -252,6 +252,8 @@ public slots:
QString pageProperty(const QString& propertyName, int pageNumber);
void addUserStyleSheet(const QString& sourceCode);
+ void setMinimumTimerInterval(double);
+
private slots:
void processWork();
diff --git a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
index 176c4c4..96f0fc5 100644
--- a/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
+++ b/Tools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
@@ -30,6 +30,7 @@ SOURCES = PluginObject.cpp \
TestObject.cpp \
Tests/DocumentOpenInDestroyStream.cpp \
Tests/EvaluateJSAfterRemovingPluginElement.cpp \
+ Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp \
Tests/GetUserAgentWithNullNPPFromNPPNew.cpp \
Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \
Tests/NPRuntimeRemoveProperty.cpp \
diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp
index a8028c5..66e7311 100644
--- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -40,6 +40,7 @@
#include "WorkQueueItem.h"
#include "WorkQueue.h"
+#include <comutil.h>
#include <fcntl.h>
#include <io.h>
#include <math.h>
@@ -131,12 +132,40 @@ bool setAlwaysAcceptCookies(bool alwaysAcceptCookies)
#endif
}
-wstring urlSuitableForTestResult(const wstring& url)
+static RetainPtr<CFStringRef> substringFromIndex(CFStringRef string, CFIndex index)
{
- if (url.find(L"file://") == wstring::npos)
- return url;
+ return RetainPtr<CFStringRef>(AdoptCF, CFStringCreateWithSubstring(kCFAllocatorDefault, string, CFRangeMake(index, CFStringGetLength(string) - index)));
+}
+
+wstring urlSuitableForTestResult(const wstring& urlString)
+{
+ RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(urlString.c_str()), urlString.length() * sizeof(wstring::value_type), kCFStringEncodingUTF16, 0));
+
+ RetainPtr<CFStringRef> scheme(AdoptCF, CFURLCopyScheme(url.get()));
+ if (scheme && CFStringCompare(scheme.get(), CFSTR("file"), kCFCompareCaseInsensitive) != kCFCompareEqualTo)
+ return urlString;
+
+ COMPtr<IWebDataSource> dataSource;
+ if (FAILED(frame->dataSource(&dataSource))) {
+ if (FAILED(frame->provisionalDataSource(&dataSource)))
+ return urlString;
+ }
+
+ COMPtr<IWebMutableURLRequest> request;
+ if (FAILED(dataSource->request(&request)))
+ return urlString;
+
+ _bstr_t requestURLString;
+ if (FAILED(request->URL(requestURLString.GetAddress())))
+ return urlString;
+
+ RetainPtr<CFURLRef> requestURL(AdoptCF, CFURLCreateWithBytes(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(requestURLString.GetBSTR()), requestURLString.length() * sizeof(OLECHAR), kCFStringEncodingUTF16, 0));
+ RetainPtr<CFURLRef> baseURL(AdoptCF, CFURLCreateCopyDeletingLastPathComponent(kCFAllocatorDefault, requestURL.get()));
+
+ RetainPtr<CFStringRef> basePath(AdoptCF, CFURLCopyPath(baseURL.get()));
+ RetainPtr<CFStringRef> path(AdoptCF, CFURLCopyPath(url.get()));
- return lastPathComponent(url);
+ return cfStringRefToWString(substringFromIndex(path.get(), CFStringGetLength(basePath.get())).get());
}
wstring lastPathComponent(const wstring& url)
@@ -168,6 +197,14 @@ string toUTF8(const wstring& wideString)
return toUTF8(wideString.c_str(), wideString.length());
}
+wstring cfStringRefToWString(CFStringRef cfStr)
+{
+ Vector<wchar_t> v(CFStringGetLength(cfStr));
+ CFStringGetCharacters(cfStr, CFRangeMake(0, CFStringGetLength(cfStr)), (UniChar *)v.data());
+
+ return wstring(v.data(), v.size());
+}
+
static LRESULT CALLBACK DumpRenderTreeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -763,6 +800,11 @@ static bool shouldOpenWebInspector(const char* pathOrURL)
return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\");
}
+static bool shouldDumpAsText(const char* pathOrURL)
+{
+ return strstr(pathOrURL, "/dumpAsText/") || strstr(pathOrURL, "\\dumpAsText\\");
+}
+
static bool shouldEnableDeveloperExtras(const char* pathOrURL)
{
return true;
@@ -866,6 +908,10 @@ static void resetWebViewToConsistentStateBeforeTesting()
if (!webViewPrivate)
return;
+ double minimumInterval = 0;
+ if (SUCCEEDED(webViewPrivate->defaultMinimumTimerInterval(&minimumInterval)))
+ webViewPrivate->setMinimumTimerInterval(minimumInterval);
+
COMPtr<IWebInspector> inspector;
if (SUCCEEDED(webViewPrivate->inspector(&inspector)))
inspector->setJavaScriptProfilingEnabled(FALSE);
@@ -886,6 +932,10 @@ static void resetWebViewToConsistentStateBeforeTesting()
sharedUIDelegate->resetUndoManager();
sharedFrameLoadDelegate->resetToConsistentState();
+
+ COMPtr<IWebFramePrivate> framePrivate;
+ if (SUCCEEDED(frame->QueryInterface(&framePrivate)))
+ framePrivate->clearOpener();
}
static void runTest(const string& testPathOrURL)
@@ -954,6 +1004,10 @@ static void runTest(const string& testPathOrURL)
if (shouldOpenWebInspector(pathOrURL.c_str()))
gLayoutTestController->showWebInspector();
}
+ if (shouldDumpAsText(pathOrURL.c_str())) {
+ gLayoutTestController->setDumpAsText(true);
+ gLayoutTestController->setGeneratePixelResults(false);
+ }
prevTestBFItem = 0;
if (webView) {
@@ -1245,6 +1299,11 @@ static LONG WINAPI exceptionFilter(EXCEPTION_POINTERS*)
int main(int argc, char* argv[])
{
+ // Cygwin calls ::SetErrorMode(SEM_FAILCRITICALERRORS), which we will inherit. This is bad for
+ // testing/debugging, as it causes the post-mortem debugger not to be invoked. We reset the
+ // error mode here to work around Cygwin's behavior. See <http://webkit.org/b/55222>.
+ ::SetErrorMode(0);
+
::SetUnhandledExceptionFilter(exceptionFilter);
leakChecking = false;
diff --git a/Tools/DumpRenderTree/win/DumpRenderTreeWin.h b/Tools/DumpRenderTree/win/DumpRenderTreeWin.h
index 27edaa6..c64c3bf 100644
--- a/Tools/DumpRenderTree/win/DumpRenderTreeWin.h
+++ b/Tools/DumpRenderTree/win/DumpRenderTreeWin.h
@@ -52,6 +52,8 @@ std::wstring urlSuitableForTestResult(const std::wstring& url);
std::wstring lastPathComponent(const std::wstring&);
std::string toUTF8(BSTR);
std::string toUTF8(const std::wstring&);
+std::wstring cfStringRefToWString(CFStringRef);
+
IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow = 0);
Vector<HWND>& openWindows();
typedef HashMap<HWND, COMPtr<IWebView> > WindowToWebViewMap;
diff --git a/Tools/DumpRenderTree/win/EditingDelegate.cpp b/Tools/DumpRenderTree/win/EditingDelegate.cpp
index 71859cb..3552ecd 100644
--- a/Tools/DumpRenderTree/win/EditingDelegate.cpp
+++ b/Tools/DumpRenderTree/win/EditingDelegate.cpp
@@ -357,7 +357,7 @@ HRESULT STDMETHODCALLTYPE EditingDelegate::webViewDidChangeSelection(
static int indexOfFirstWordCharacter(const TCHAR* text)
{
const TCHAR* cursor = text;
- while (*cursor && !isalpha(*cursor))
+ while (*cursor && !iswalpha(*cursor))
++cursor;
return *cursor ? (cursor - text) : -1;
};
@@ -365,7 +365,7 @@ static int indexOfFirstWordCharacter(const TCHAR* text)
static int wordLength(const TCHAR* text)
{
const TCHAR* cursor = text;
- while (*cursor && isalpha(*cursor))
+ while (*cursor && iswalpha(*cursor))
++cursor;
return cursor - text;
};
diff --git a/Tools/DumpRenderTree/win/EventSender.cpp b/Tools/DumpRenderTree/win/EventSender.cpp
index 94f0945..e1c5cd5 100644
--- a/Tools/DumpRenderTree/win/EventSender.cpp
+++ b/Tools/DumpRenderTree/win/EventSender.cpp
@@ -473,6 +473,8 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
virtualKeyCode = VK_DELETE;
else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
virtualKeyCode = VK_SNAPSHOT;
+ else if (JSStringIsEqualToUTF8CString(character, "menu"))
+ virtualKeyCode = VK_APPS;
else {
charCode = JSStringGetCharactersPtr(character)[0];
virtualKeyCode = LOBYTE(VkKeyScan(charCode));
diff --git a/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp b/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp
index a84e0f3..9f0de91 100644
--- a/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp
+++ b/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp
@@ -206,12 +206,26 @@ void FrameLoadDelegate::resetToConsistentState()
m_accessibilityController->resetToConsistentState();
}
-static void CALLBACK processWorkTimer(HWND, UINT, UINT_PTR id, DWORD)
+typedef Vector<COMPtr<FrameLoadDelegate> > DelegateVector;
+static DelegateVector& delegatesWithDelayedWork()
{
- ::KillTimer(0, id);
- FrameLoadDelegate* d = g_delegateWaitingOnTimer;
- g_delegateWaitingOnTimer = 0;
- d->processWork();
+ DEFINE_STATIC_LOCAL(DelegateVector, delegates, ());
+ return delegates;
+}
+
+static UINT_PTR processWorkTimerID;
+
+static void CALLBACK processWorkTimer(HWND hwnd, UINT, UINT_PTR id, DWORD)
+{
+ ASSERT_ARG(id, id == processWorkTimerID);
+ ::KillTimer(hwnd, id);
+ processWorkTimerID = 0;
+
+ DelegateVector delegates;
+ delegates.swap(delegatesWithDelayedWork());
+
+ for (size_t i = 0; i < delegates.size(); ++i)
+ delegates[i]->processWork();
}
void FrameLoadDelegate::locationChangeDone(IWebError*, IWebFrame* frame)
@@ -226,9 +240,9 @@ void FrameLoadDelegate::locationChangeDone(IWebError*, IWebFrame* frame)
return;
if (WorkQueue::shared()->count()) {
- ASSERT(!g_delegateWaitingOnTimer);
- g_delegateWaitingOnTimer = this;
- ::SetTimer(0, 0, 0, processWorkTimer);
+ if (!processWorkTimerID)
+ processWorkTimerID = ::SetTimer(0, 0, 0, processWorkTimer);
+ delegatesWithDelayedWork().append(this);
return;
}
diff --git a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 1dabf03..12a3a55 100644
--- a/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -711,14 +711,6 @@ static bool resolveCygwinPath(const wstring& cygwinPath, wstring& windowsPath)
return true;
}
-static wstring cfStringRefToWString(CFStringRef cfStr)
-{
- Vector<wchar_t> v(CFStringGetLength(cfStr));
- CFStringGetCharacters(cfStr, CFRangeMake(0, CFStringGetLength(cfStr)), (UniChar *)v.data());
-
- return wstring(v.data(), v.size());
-}
-
void LayoutTestController::setUserStyleSheetLocation(JSStringRef jsURL)
{
COMPtr<IWebView> webView;
@@ -763,6 +755,11 @@ void LayoutTestController::setUserStyleSheetLocation(JSStringRef jsURL)
SysFreeString(resultPathBSTR);
}
+void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setViewModeMediaFeature(JSStringRef mode)
{
// FIXME: implement
@@ -1421,7 +1418,7 @@ bool LayoutTestController::hasSpellingMarker(int from, int length)
return ret;
}
-void LayoutTestController::dumpConfigurationForViewport(int /*availableWidth*/, int /*availableHeight*/)
+void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/)
{
// FIXME: Implement this.
}
@@ -1430,3 +1427,16 @@ void LayoutTestController::setSerializeHTTPLoads(bool)
{
// FIXME: Implement.
}
+
+void LayoutTestController::setMinimumTimerInterval(double minimumTimerInterval)
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebViewPrivate> viewPrivate(Query, webView);
+ if (!viewPrivate)
+ return;
+
+ viewPrivate->setMinimumTimerInterval(minimumTimerInterval);
+}
diff --git a/Tools/DumpRenderTree/win/UIDelegate.cpp b/Tools/DumpRenderTree/win/UIDelegate.cpp
index 1e7669f..a734a84 100755
--- a/Tools/DumpRenderTree/win/UIDelegate.cpp
+++ b/Tools/DumpRenderTree/win/UIDelegate.cpp
@@ -486,7 +486,7 @@ HRESULT STDMETHODCALLTYPE UIDelegate::webViewAddMessageToConsole(
newMessage = message;
size_t fileProtocol = newMessage.find(L"file://");
if (fileProtocol != wstring::npos)
- newMessage = newMessage.substr(0, fileProtocol) + urlSuitableForTestResult(newMessage.substr(fileProtocol));
+ newMessage = newMessage.substr(0, fileProtocol) + lastPathComponent(newMessage.substr(fileProtocol));
}
printf("CONSOLE MESSAGE: line %d: %s\n", lineNumber, toUTF8(newMessage).c_str());
diff --git a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 1befb77..a95aa50 100644
--- a/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/Tools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -135,6 +135,11 @@ void LayoutTestController::setUserStyleSheetLocation(JSStringRef path)
{
}
+void LayoutTestController::setValueForUser(JSContextRef context, JSValueRef element, JSStringRef value)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setViewModeMediaFeature(JSStringRef mode)
{
// FIXME: implement
@@ -511,7 +516,7 @@ bool LayoutTestController::hasSpellingMarker(int, int)
return false;
}
-void LayoutTestController::dumpConfigurationForViewport(int /*availableWidth*/, int /*availableHeight*/)
+void LayoutTestController::dumpConfigurationForViewport(int /*deviceDPI*/, int /*deviceWidth*/, int /*deviceHeight*/, int /*availableWidth*/, int /*availableHeight*/)
{
// FIXME: Implement
}
@@ -549,3 +554,8 @@ void LayoutTestController::setSerializeHTTPLoads(bool)
{
// FIXME: Implement.
}
+
+void LayoutTestController::setMinimumTimerInterval(double interval) {
+
+}
+