summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree')
-rw-r--r--WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj32
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.cpp22
-rw-r--r--WebKitTools/DumpRenderTree/LayoutTestController.h1
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp25
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h11
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp95
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h212
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp56
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp72
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp89
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp68
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp27
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj38
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/EventSender.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp31
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.h3
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.h2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp7
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellMac.mm2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp2
-rw-r--r--WebKitTools/DumpRenderTree/gtk/EventSender.cpp32
-rw-r--r--WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/mac/EventSendingController.mm8
-rw-r--r--WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm7
-rw-r--r--WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h2
-rw-r--r--WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro7
-rw-r--r--WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp32
-rw-r--r--WebKitTools/DumpRenderTree/win/EventSender.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp6
-rw-r--r--WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp6
33 files changed, 857 insertions, 66 deletions
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index 2ed5daa..c92c704 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -32,10 +32,16 @@
141BF439096A455900E0753C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; };
141BF453096A45EB00E0753C /* PluginObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 141BF447096A45C800E0753C /* PluginObject.h */; };
14770FE20A22ADF7009342EE /* GCController.h in Headers */ = {isa = PBXBuildFile; fileRef = 14770FE00A22ADF7009342EE /* GCController.h */; };
+ 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */; };
+ 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 */; };
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 */; };
1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC6C7810D07589B00CD3161 /* TestObject.cpp */; };
+ 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */; };
+ 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */; };
23BCB8900EA57623003C6289 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; };
3713EDE2115BE19300705720 /* ColorBits-A.png in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDDF115BE16F00705720 /* ColorBits-A.png */; };
3713EDE3115BE19300705720 /* ColorBits.ttf in Copy Font Files */ = {isa = PBXBuildFile; fileRef = 3713EDE0115BE16F00705720 /* ColorBits.ttf */; };
@@ -185,10 +191,16 @@
141BF447096A45C800E0753C /* PluginObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PluginObject.h; sourceTree = "<group>"; };
141BF448096A45C800E0753C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Info.plist; path = mac/Info.plist; sourceTree = "<group>"; };
14770FE00A22ADF7009342EE /* GCController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCController.h; sourceTree = "<group>"; };
+ 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentOpenInDestroyStream.cpp; sourceTree = "<group>"; };
+ 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>"; };
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>"; };
1AC6C7810D07589B00CD3161 /* TestObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestObject.cpp; sourceTree = "<group>"; };
+ 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPRuntimeRemoveProperty.cpp; sourceTree = "<group>"; };
+ 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginScriptableNPObjectInvokeDefault.cpp; sourceTree = "<group>"; };
23BCB88F0EA57623003C6289 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
3713EDDF115BE16F00705720 /* ColorBits-A.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "ColorBits-A.png"; path = "fonts/ColorBits-A.png"; sourceTree = "<group>"; };
@@ -357,11 +369,14 @@
141BF1F5096A439800E0753C /* TestNetscapePlugIn */ = {
isa = PBXGroup;
children = (
+ 1A215A6E11F25FF1008AD0F5 /* Tests */,
141BF448096A45C800E0753C /* Info.plist */,
1AC6C77F0D07589B00CD3161 /* main.cpp */,
1AC6C7800D07589B00CD3161 /* PluginObject.cpp */,
0F37A4A611E6628700275F54 /* PluginObjectMac.mm */,
141BF447096A45C800E0753C /* PluginObject.h */,
+ 1A215A7F11F2609C008AD0F5 /* PluginTest.cpp */,
+ 1A215A8011F2609C008AD0F5 /* PluginTest.h */,
1AC6C7810D07589B00CD3161 /* TestObject.cpp */,
1A8F024C0BB9B056008CFA34 /* TestObject.h */,
);
@@ -421,6 +436,17 @@
name = Delegates;
sourceTree = "<group>";
};
+ 1A215A6E11F25FF1008AD0F5 /* Tests */ = {
+ isa = PBXGroup;
+ children = (
+ 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */,
+ 1A24BAA8120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp */,
+ 1AC77DCE120605B6005C19EF /* NPRuntimeRemoveProperty.cpp */,
+ 1AD9D2FD12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp */,
+ );
+ path = Tests;
+ sourceTree = "<group>";
+ };
9340995508540CAF007F3BC8 /* Products */ = {
isa = PBXGroup;
children = (
@@ -521,6 +547,7 @@
files = (
141BF453096A45EB00E0753C /* PluginObject.h in Headers */,
1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */,
+ 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -684,6 +711,11 @@
1AC6C84A0D07638600CD3161 /* PluginObject.cpp in Sources */,
1AC6C84B0D07638600CD3161 /* TestObject.cpp in Sources */,
0F37A4A711E6628700275F54 /* PluginObjectMac.mm in Sources */,
+ 1A215A8111F2609C008AD0F5 /* PluginTest.cpp in Sources */,
+ 1A215BE711F27658008AD0F5 /* DocumentOpenInDestroyStream.cpp in Sources */,
+ 1AD9D2FE12028409001A70D1 /* PluginScriptableNPObjectInvokeDefault.cpp in Sources */,
+ 1AC77DCF120605B6005C19EF /* NPRuntimeRemoveProperty.cpp in Sources */,
+ 1A24BAA9120734EE00FBB059 /* NPRuntimeObjectFromDestroyedPlugin.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index 6a957c1..d98164b 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -970,6 +970,27 @@ static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef
return JSValueMakeUndefined(context);
}
+static JSValueRef setMockDeviceOrientationCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 6)
+ return JSValueMakeUndefined(context);
+
+ bool canProvideAlpha = JSValueToBoolean(context, arguments[0]);
+ double alpha = JSValueToNumber(context, arguments[1], exception);
+ ASSERT(!*exception);
+ bool canProvideBeta = JSValueToBoolean(context, arguments[2]);
+ double beta = JSValueToNumber(context, arguments[3], exception);
+ ASSERT(!*exception);
+ bool canProvideGamma = JSValueToBoolean(context, arguments[4]);
+ double gamma = JSValueToNumber(context, arguments[5], exception);
+ ASSERT(!*exception);
+
+ LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 3)
@@ -1824,6 +1845,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setJavaScriptProfilingEnabled", setJavaScriptProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setMockDeviceOrientation", setMockDeviceOrientationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationError", setMockGeolocationErrorCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMockGeolocationPosition", setMockGeolocationPositionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setNewWindowsCopyBackForwardList", setNewWindowsCopyBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 30eb9bd..39cc3fb 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -88,6 +88,7 @@ public:
void setJavaScriptProfilingEnabled(bool profilingEnabled);
void setJavaScriptCanAccessClipboard(bool flag);
void setMainFrameIsFirstResponder(bool flag);
+ void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
void setMockGeolocationError(int code, JSStringRef message);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
void setPersistentUserStyleSheetLocation(JSStringRef path);
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
index 671069e..0d556b1 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
@@ -99,7 +99,6 @@ static bool pluginHasMethod(NPObject*, NPIdentifier name);
static bool pluginGetProperty(NPObject*, NPIdentifier name, NPVariant*);
static bool pluginSetProperty(NPObject*, NPIdentifier name, const NPVariant*);
static bool pluginInvoke(NPObject*, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result);
-static bool pluginInvokeDefault(NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result);
static NPObject* pluginAllocate(NPP npp, NPClass*);
static void pluginDeallocate(NPObject*);
@@ -112,10 +111,13 @@ static NPClass pluginClass = {
pluginInvalidate,
pluginHasMethod,
pluginInvoke,
- pluginInvokeDefault,
+ 0, // NPClass::invokeDefault,
pluginHasProperty,
pluginGetProperty,
pluginSetProperty,
+ 0, // NPClass::removeProperty
+ 0, // NPClass::enumerate
+ 0 // NPClass::construct
};
NPClass *getPluginClass(void)
@@ -158,7 +160,6 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
enum {
ID_TEST_CALLBACK_METHOD = 0,
ID_TEST_GETURL,
- ID_REMOVE_DEFAULT_METHOD,
ID_TEST_DOM_ACCESS,
ID_TEST_GET_URL_NOTIFY,
ID_TEST_INVOKE_DEFAULT,
@@ -195,7 +196,6 @@ static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testCallback",
"getURL",
- "removeDefaultMethod",
"testDOMAccess",
"getURLNotify",
"testInvokeDefault",
@@ -462,13 +462,6 @@ static bool getURL(PluginObject* obj, const NPVariant* args, uint32_t argCount,
return false;
}
-static bool removeDefaultMethod(PluginObject*, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- pluginClass.invokeDefault = 0;
- VOID_TO_NPVARIANT(*result);
- return true;
-}
-
static bool getURLNotify(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 3 || !NPVARIANT_IS_STRING(args[0])
@@ -857,8 +850,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return testCallback(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_GETURL])
return getURL(plugin, args, argCount, result);
- else if (name == pluginMethodIdentifiers[ID_REMOVE_DEFAULT_METHOD])
- return removeDefaultMethod(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS])
return testDOMAccess(plugin, args, argCount, result);
else if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY])
@@ -941,12 +932,6 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return false;
}
-static bool pluginInvokeDefault(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
-{
- INT32_TO_NPVARIANT(1, *result);
- return true;
-}
-
static void pluginInvalidate(NPObject* header)
{
PluginObject* plugin = reinterpret_cast<PluginObject*>(header);
@@ -963,6 +948,7 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
initializeIdentifiers();
}
+ newInstance->pluginTest = 0;
newInstance->npp = npp;
newInstance->testObject = browser->createobject(npp, getTestClass());
newInstance->rememberedObject = 0;
@@ -984,7 +970,6 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
newInstance->lastHeaders = NULL;
newInstance->testGetURLOnDestroy = FALSE;
- newInstance->testDocumentOpenInDestroyStream = FALSE;
newInstance->testWindowOpen = FALSE;
newInstance->testKeyboardFocusForPlugins = FALSE;
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
index 03befb0..2c1d325 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
@@ -25,7 +25,7 @@
#include <WebKit/npfunctions.h>
-#if XP_MACOSX
+#if defined(XP_MACOSX)
#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
#elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
@@ -35,11 +35,15 @@
#endif
#endif // XP_MACOSX
+class PluginTest;
+
extern NPNetscapeFuncs *browser;
typedef struct {
NPObject header;
+ PluginTest* pluginTest;
+
NPP npp;
NPBool eventLogging;
NPBool logSetWindow;
@@ -50,7 +54,6 @@ typedef struct {
NPObject* testObject;
NPObject* rememberedObject;
NPStream* stream;
- NPBool testDocumentOpenInDestroyStream;
NPBool testGetURLOnDestroy;
NPBool testWindowOpen;
NPBool testKeyboardFocusForPlugins;
@@ -66,7 +69,7 @@ typedef struct {
#ifdef XP_MACOSX
NPEventModel eventModel;
#endif
-#if XP_MACOSX && !defined(BUILDING_ON_TIGER)
+#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
void* coreAnimationLayer;
#endif
NPWindow lastWindow;
@@ -80,7 +83,7 @@ extern void pluginLog(NPP instance, const char* format, ...);
extern bool testDocumentOpen(NPP npp);
extern bool testWindowOpen(NPP npp);
-#if XP_MACOSX && !defined(BUILDING_ON_TIGER)
+#if defined(XP_MACOSX) && !defined(BUILDING_ON_TIGER)
extern void* createCoreAnimationLayer();
#endif
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
new file mode 100644
index 0000000..0ff7029
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2010 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 <assert.h>
+
+using namespace std;
+extern NPNetscapeFuncs *browser;
+
+PluginTest* PluginTest::create(NPP npp, const string& identifier)
+{
+ CreateTestFunction createTestFunction = createTestFunctions()[identifier];
+ if (createTestFunction)
+ return createTestFunction(npp, identifier);
+
+ return new PluginTest(npp, identifier);
+}
+
+PluginTest::PluginTest(NPP npp, const string& identifier)
+ : m_npp(npp)
+ , m_identifier(identifier)
+{
+}
+
+PluginTest::~PluginTest()
+{
+}
+
+NPError PluginTest::NPP_DestroyStream(NPStream *stream, NPReason reason)
+{
+ return NPERR_NO_ERROR;
+}
+
+NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value)
+{
+ // We don't know anything about plug-in values so just return NPERR_GENERIC_ERROR.
+ return NPERR_GENERIC_ERROR;
+}
+
+NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
+{
+ return browser->getstringidentifier(name);
+}
+
+NPIdentifier PluginTest::NPN_GetIntIdentifier(int32_t intid)
+{
+ return browser->getintidentifier(intid);
+}
+
+NPObject* PluginTest::NPN_CreateObject(NPClass* npClass)
+{
+ return browser->createobject(m_npp, npClass);
+}
+
+bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyName)
+{
+ return browser->removeproperty(m_npp, npObject, propertyName);
+}
+
+void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
+{
+ assert(!createTestFunctions().count(identifier));
+
+ createTestFunctions()[identifier] = createTestFunction;
+}
+
+std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFunctions()
+{
+ static std::map<std::string, CreateTestFunction> testFunctions;
+
+ return testFunctions;
+}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
new file mode 100644
index 0000000..ecc0185
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -0,0 +1,212 @@
+/*
+ * Copyright (C) 2010 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.
+ */
+
+#ifndef PluginTest_h
+#define PluginTest_h
+
+#include <WebKit/npfunctions.h>
+#include <assert.h>
+#include <map>
+#include <string>
+
+// Helper classes for implementing has_member
+typedef char (&no_tag)[1];
+typedef char (&yes_tag)[2];
+
+#define DEFINE_HAS_MEMBER_CHECK(member, returnType, argumentTypes) \
+template<typename T, returnType (T::*member) argumentTypes> struct pmf_##member##_helper {}; \
+template<typename T> no_tag has_member_##member##_helper(...); \
+template<typename T> yes_tag has_member_##member##_helper(pmf_##member##_helper<T, &T::member >*); \
+template<typename T> struct has_member_##member { \
+static const bool value = sizeof(has_member_##member##_helper<T>(0)) == sizeof(yes_tag); \
+};
+
+DEFINE_HAS_MEMBER_CHECK(hasMethod, bool, (NPIdentifier methodName));
+DEFINE_HAS_MEMBER_CHECK(invoke, bool, (NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result));
+DEFINE_HAS_MEMBER_CHECK(invokeDefault, bool, (const NPVariant*, uint32_t, NPVariant* result));
+DEFINE_HAS_MEMBER_CHECK(hasProperty, bool, (NPIdentifier propertyName));
+DEFINE_HAS_MEMBER_CHECK(getProperty, bool, (NPIdentifier propertyName, NPVariant* result));
+
+class PluginTest {
+public:
+ static PluginTest* create(NPP, const std::string& identifier);
+ virtual ~PluginTest();
+
+ // NPP functions.
+ virtual NPError NPP_DestroyStream(NPStream* stream, NPReason reason);
+ virtual NPError NPP_GetValue(NPPVariable, void* value);
+
+ // NPN functions.
+ NPIdentifier NPN_GetStringIdentifier(const NPUTF8* name);
+ NPIdentifier NPN_GetIntIdentifier(int32_t intid);
+ NPObject* NPN_CreateObject(NPClass*);
+ bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName);
+
+ template<typename TestClassTy> class Register {
+ public:
+ Register(const std::string& identifier)
+ {
+ registerCreateTestFunction(identifier, Register::create);
+ }
+
+ private:
+ static PluginTest* create(NPP npp, const std::string& identifier)
+ {
+ return new TestClassTy(npp, identifier);
+ }
+ };
+
+protected:
+ PluginTest(NPP npp, const std::string& identifier);
+
+ // FIXME: A plug-in test shouldn't need to know about it's NPP. Make this private.
+ NPP m_npp;
+
+ const std::string& identifier() const { return m_identifier; }
+
+ // NPObject helper template.
+ template<typename T> struct Object : NPObject {
+ public:
+ static NPObject* create(PluginTest* pluginTest)
+ {
+ Object* object = static_cast<Object*>(pluginTest->NPN_CreateObject(npClass()));
+
+ object->m_pluginTest = pluginTest;
+ return object;
+ }
+
+ // These should never be called.
+ bool hasMethod(NPIdentifier methodName)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool invoke(NPIdentifier methodName, const NPVariant*, uint32_t, NPVariant* result)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool hasProperty(NPIdentifier propertyName)
+ {
+ assert(false);
+ return false;
+ }
+
+ bool getProperty(NPIdentifier propertyName, NPVariant* result)
+ {
+ assert(false);
+ return false;
+ }
+
+ protected:
+ Object()
+ : m_pluginTest(0)
+ {
+ }
+
+ virtual ~Object()
+ {
+ }
+
+ PluginTest* pluginTest() const { return m_pluginTest; }
+
+ private:
+ static NPObject* NP_Allocate(NPP npp, NPClass* aClass)
+ {
+ return new T;
+ }
+
+ static void NP_Deallocate(NPObject* npObject)
+ {
+ delete static_cast<T*>(npObject);
+ }
+
+ static bool NP_HasMethod(NPObject* npObject, NPIdentifier methodName)
+ {
+ return static_cast<T*>(npObject)->hasMethod(methodName);
+ }
+
+ static bool NP_Invoke(NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ return static_cast<T*>(npObject)->invoke(methodName, arguments, argumentCount, result);
+ }
+
+ static bool NP_InvokeDefault(NPObject* npObject, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ return static_cast<T*>(npObject)->invokeDefault(arguments, argumentCount, result);
+ }
+
+ static bool NP_HasProperty(NPObject* npObject, NPIdentifier propertyName)
+ {
+ return static_cast<T*>(npObject)->hasProperty(propertyName);
+ }
+
+ static bool NP_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* result)
+ {
+ return static_cast<T*>(npObject)->getProperty(propertyName, result);
+ }
+
+ static NPClass* npClass()
+ {
+ static NPClass npClass = {
+ NP_CLASS_STRUCT_VERSION,
+ NP_Allocate,
+ NP_Deallocate,
+ 0, // NPClass::invalidate
+ has_member_hasMethod<T>::value ? NP_HasMethod : 0,
+ has_member_invoke<T>::value ? NP_Invoke : 0,
+ has_member_invokeDefault<T>::value ? NP_InvokeDefault : 0,
+ has_member_hasProperty<T>::value ? NP_HasProperty : 0,
+ has_member_getProperty<T>::value ? NP_GetProperty : 0,
+ 0, // NPClass::setProperty
+ 0, // NPClass::removeProperty
+ 0, // NPClass::enumerate
+ 0 // NPClass::construct
+ };
+
+ return &npClass;
+ };
+
+ PluginTest* m_pluginTest;
+ };
+
+private:
+ typedef PluginTest* (*CreateTestFunction)(NPP, const std::string&);
+
+ static void registerCreateTestFunction(const std::string&, CreateTestFunction);
+ static std::map<std::string, CreateTestFunction>& createTestFunctions();
+
+ std::string m_identifier;
+};
+
+#endif // PluginTest_h
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
new file mode 100644
index 0000000..69e706e
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 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;
+
+extern bool testDocumentOpen(NPP npp);
+
+// Call document.open from NPP_DestroyStream.
+
+class DocumentOpenInDestroyStream : public PluginTest {
+public:
+ DocumentOpenInDestroyStream(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ , m_shouldOpen(true)
+ {
+ }
+
+private:
+ virtual NPError NPP_DestroyStream(NPStream*, NPReason)
+ {
+ if (m_shouldOpen) {
+ testDocumentOpen(m_npp);
+ m_shouldOpen = false;
+ }
+
+ return NPERR_NO_ERROR;
+ }
+
+ bool m_shouldOpen;
+};
+
+static PluginTest::Register<DocumentOpenInDestroyStream> documentOpenInDestroyStream("document-open-in-destroy-stream");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
new file mode 100644
index 0000000..38236e3
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2010 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;
+
+class NPRuntimeObjectFromDestroyedPlugin : public PluginTest {
+public:
+ NPRuntimeObjectFromDestroyedPlugin(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ // This is the test object.
+ class TestObject : public Object<TestObject> { };
+
+ // This is the scriptable object. It has a single "testObject" property.
+ class ScriptableObject : public Object<ScriptableObject> {
+ public:
+ bool hasProperty(NPIdentifier propertyName)
+ {
+ return propertyName == pluginTest()->NPN_GetStringIdentifier("testObject");
+ }
+
+ bool getProperty(NPIdentifier propertyName, NPVariant* result)
+ {
+ if (propertyName != pluginTest()->NPN_GetStringIdentifier("testObject"))
+ return false;
+
+ NPObject* testObject = TestObject::create(pluginTest());
+ OBJECT_TO_NPVARIANT(testObject, *result);
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ *(NPObject**)value = ScriptableObject::create(this);
+
+ return NPERR_NO_ERROR;
+ }
+};
+
+static PluginTest::Register<NPRuntimeObjectFromDestroyedPlugin> npRuntimeObjectFromDestroyedPlugin("npruntime-object-from-destroyed-plugin");
+
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
new file mode 100644
index 0000000..4d417d1
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2010 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;
+
+
+class NPRuntimeRemoveProperty : public PluginTest {
+public:
+ NPRuntimeRemoveProperty(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ struct TestObject : Object<TestObject> {
+ public:
+ bool hasMethod(NPIdentifier methodName)
+ {
+ return methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty");
+ }
+
+ bool invoke(NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result)
+ {
+ assert(methodName == pluginTest()->NPN_GetStringIdentifier("testRemoveProperty"));
+
+ if (argumentCount != 2)
+ return false;
+
+ if (!NPVARIANT_IS_OBJECT(arguments[0]))
+ return false;
+
+ if (!NPVARIANT_IS_STRING(arguments[1]) && !NPVARIANT_IS_DOUBLE(arguments[1]))
+ return false;
+
+ NPIdentifier propertyName;
+ if (NPVARIANT_IS_STRING(arguments[1])) {
+ string propertyNameString(arguments[1].value.stringValue.UTF8Characters,
+ arguments[1].value.stringValue.UTF8Length);
+
+ propertyName = pluginTest()->NPN_GetStringIdentifier(propertyNameString.c_str());
+ } else {
+ int32_t number = arguments[1].value.doubleValue;
+ propertyName = pluginTest()->NPN_GetIntIdentifier(number);
+ }
+
+ pluginTest()->NPN_RemoveProperty(NPVARIANT_TO_OBJECT(arguments[0]), propertyName);
+
+ VOID_TO_NPVARIANT(*result);
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ *(NPObject**)value = TestObject::create(this);
+
+ return NPERR_NO_ERROR;
+ }
+
+};
+
+static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("npruntime-remove-property");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
new file mode 100644
index 0000000..959e182
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 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;
+
+// A test where the plug-ins scriptable object either has or doesn't have an invokeDefault function.
+class PluginScriptableNPObjectInvokeDefault : public PluginTest {
+public:
+ PluginScriptableNPObjectInvokeDefault(NPP npp, const string& identifier)
+ : PluginTest(npp, identifier)
+ {
+ }
+
+private:
+ struct NPObjectWithoutInvokeDefault : Object<NPObjectWithoutInvokeDefault> { };
+
+ struct NPObjectWithInvokeDefault : Object<NPObjectWithInvokeDefault> {
+ public:
+ bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result)
+ {
+ INT32_TO_NPVARIANT(1, *result);
+ return true;
+ }
+ };
+
+ virtual NPError NPP_GetValue(NPPVariable variable, void *value)
+ {
+ if (variable != NPPVpluginScriptableNPObject)
+ return NPERR_GENERIC_ERROR;
+
+ NPObject* object;
+ if (identifier() == "plugin-scriptable-npobject-invoke-default")
+ object = NPObjectWithInvokeDefault::create(this);
+ else
+ object = NPObjectWithoutInvokeDefault::create(this);
+
+ *(NPObject**)value = object;
+
+ return NPERR_NO_ERROR;
+ }
+};
+
+static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectInvokeDefault("plugin-scriptable-npobject-invoke-default");
+static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScriptableNPObjectNoInvokeDefault("plugin-scriptable-npobject-no-invoke-default");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index 82a6e3a..fcda50b 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
@@ -25,6 +25,12 @@
#include "PluginObject.h"
+#include "PluginTest.h"
+
+#include <string>
+
+using namespace std;
+
#if XP_WIN
#define STDCALL __stdcall
@@ -132,7 +138,11 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
#endif
#endif // XP_MACOSX
+ string testIdentifier;
+
for (int i = 0; i < argc; i++) {
+ if (strcasecmp(argn[i], "test") == 0)
+ testIdentifier = argv[i];
if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = strdup(argv[i]);
else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
@@ -158,8 +168,6 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
executeScript(obj, "document.body.innerHTML = ''");
else if (!strcasecmp(argn[i], "ondestroy"))
obj->onDestroy = strdup(argv[i]);
- else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0)
- obj->testDocumentOpenInDestroyStream = TRUE;
else if (strcasecmp(argn[i], "testwindowopen") == 0)
obj->testWindowOpen = TRUE;
else if (strcasecmp(argn[i], "drawingmodel") == 0) {
@@ -196,7 +204,9 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
#endif
browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
-
+
+ obj->pluginTest = PluginTest::create(instance, testIdentifier);
+
return NPERR_NO_ERROR;
}
@@ -325,12 +335,7 @@ NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
}
}
- if (obj->testDocumentOpenInDestroyStream) {
- testDocumentOpen(instance);
- obj->testDocumentOpenInDestroyStream = FALSE;
- }
-
- return NPERR_NO_ERROR;
+ return obj->pluginTest->NPP_DestroyStream(stream, reason);
}
int32_t NPP_WriteReady(NPP instance, NPStream *stream)
@@ -524,6 +529,10 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
{
PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+ // First, check if the PluginTest object supports getting this value.
+ if (obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
+ return NPERR_NO_ERROR;
+
if (variable == NPPVpluginScriptableNPObject) {
void **v = (void **)value;
// Return value is expected to be retained
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index 34d2f08..c36666f 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -109,7 +109,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -178,7 +178,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -248,7 +248,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
DisableSpecificWarnings="4819"
/>
@@ -317,7 +317,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin.subproj&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
+ AdditionalIncludeDirectories="&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(ProjectDir)..\..\TestNetscapePlugin&quot;;&quot;$(WebKitLibrariesDir)\include&quot;"
PreprocessorDefinitions="_USRDLL;TESTNETSCAPEPLUGIN_EXPORTS;snprintf=_snprintf"
RuntimeLibrary="3"
DisableSpecificWarnings="4819"
@@ -425,6 +425,14 @@
>
</File>
<File
+ RelativePath="..\PluginTest.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PluginTest.h"
+ >
+ </File>
+ <File
RelativePath=".\resource.h"
>
</File>
@@ -448,6 +456,26 @@
RelativePath="..\TestObject.h"
>
</File>
+ <Filter
+ Name="Tests"
+ >
+ <File
+ RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\NPRuntimeObjectFromDestroyedPlugin.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\NPRuntimeRemoveProperty.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Tests\PluginScriptableNPObjectInvokeDefault.cpp"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
index 7194279..2885cf6 100644
--- a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -84,7 +84,7 @@ static void runTest(TestShell& shell, TestParams& params, const string& testName
int main(int argc, char* argv[])
{
webkit_support::SetUpTestEnvironment();
- platformInit();
+ platformInit(&argc, &argv);
TestParams params;
Vector<string> tests;
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
index fd7ba2d..4e84c96 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
@@ -541,6 +541,8 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result)
code = base::VKEY_LEFT;
else if ("upArrow" == codeStr)
code = base::VKEY_UP;
+ else if ("insert" == codeStr)
+ code = base::VKEY_INSERT;
else if ("delete" == codeStr)
code = base::VKEY_DELETE;
else if ("pageUp" == codeStr)
@@ -551,6 +553,8 @@ void EventSender::keyDown(const CppArgumentList& arguments, CppVariant* result)
code = base::VKEY_HOME;
else if ("end" == codeStr)
code = base::VKEY_END;
+ else if ("printScreen" == codeStr)
+ code = base::VKEY_SNAPSHOT;
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/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index ea1fd01..cd27c18 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -35,7 +35,6 @@
#include "DRTDevToolsAgent.h"
#include "TestShell.h"
#include "WebViewHost.h"
-#include "base/string_util.h"
#include "public/WebAnimationController.h"
#include "public/WebConsoleMessage.h"
#include "public/WebDocument.h"
@@ -51,6 +50,9 @@
#include "public/WebURL.h"
#include "public/WebView.h"
#include "webkit/support/webkit_support.h"
+#include <algorithm>
+#include <cstdlib>
+#include <limits>
#include <wtf/text/WTFString.h>
#if OS(WINDOWS)
@@ -164,6 +166,8 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
bindMethod("setEditingBehavior", &LayoutTestController::setEditingBehavior);
+ bindMethod("setMockDeviceOrientation", &LayoutTestController::setMockDeviceOrientation);
+
bindMethod("setGeolocationPermission", &LayoutTestController::setGeolocationPermission);
bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
@@ -702,7 +706,7 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments,
string url = arguments[0].toString();
#if OS(WINDOWS)
- if (StartsWithASCII(url, "/tmp/", true)) {
+ if (!url.find("/tmp/")) {
// We want a temp file.
const unsigned tempPrefixLength = 5;
size_t bufferSize = MAX_PATH;
@@ -714,7 +718,7 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments,
tempLength = GetTempPathW(bufferSize, tempPath.get());
ASSERT(tempLength < bufferSize);
}
- std::string resultPath(WebString(tempPath.get(), tempLength).utf8());
+ string resultPath(WebString(tempPath.get(), tempLength).utf8());
resultPath.append(url.substr(tempPrefixLength));
result->set(resultPath);
return;
@@ -723,8 +727,12 @@ void LayoutTestController::pathToLocalResource(const CppArgumentList& arguments,
// Some layout tests use file://// which we resolve as a UNC path. Normalize
// them to just file:///.
- while (StartsWithASCII(url, "file:////", false))
+ string lowerUrl = url;
+ transform(lowerUrl.begin(), lowerUrl.end(), lowerUrl.begin(), ::tolower);
+ while (!lowerUrl.find("file:////")) {
url = url.substr(0, 8) + url.substr(9);
+ lowerUrl = lowerUrl.substr(0, 8) + lowerUrl.substr(9);
+ }
result->set(webkit_support::RewriteLayoutTestsURL(url).spec());
}
@@ -1022,9 +1030,12 @@ int32_t LayoutTestController::cppVariantToInt32(const CppVariant& value)
if (value.isInt32())
return value.toInt32();
if (value.isString()) {
- int number;
- if (StringToInt(value.toString(), &number))
- return number;
+ 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;
@@ -1310,6 +1321,12 @@ void LayoutTestController::setEditingBehavior(const CppArgumentList& arguments,
logErrorToConsole("Passed invalid editing behavior. Should be 'mac' or 'win'.");
}
+void LayoutTestController::setMockDeviceOrientation(const CppArgumentList& arguments, CppVariant* result)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index 46a14de..6748352 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -282,6 +282,9 @@ public:
void addUserScript(const CppArgumentList&, CppVariant*);
void addUserStyleSheet(const CppArgumentList&, CppVariant*);
+ // DeviceOrientation related functions
+ void setMockDeviceOrientation(const CppArgumentList&, CppVariant*);
+
// Geolocation related functions.
void setGeolocationPermission(const CppArgumentList&, CppVariant*);
void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h
index 0f74ee1..0615552 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h
@@ -184,6 +184,6 @@ private:
#endif
};
-void platformInit();
+void platformInit(int*, char***);
#endif // TestShell_h
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
index 4f3eefd..a9d374c 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
@@ -33,6 +33,7 @@
#include "webkit/support/webkit_support.h"
#include <fontconfig/fontconfig.h>
+#include <gtk/gtk.h>
#include <signal.h>
static void AlarmHandler(int signatl)
@@ -185,7 +186,11 @@ void TestShell::waitTestFinished()
signal(SIGALRM, SIG_DFL);
}
-void platformInit()
+void platformInit(int* argc, char*** argv)
{
+ // FIXME: It's better call gtk_init() only when we run plugin tests.
+ // See http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/633ea167cde196ca#
+ gtk_init(argc, argv);
+
setupFontconfig();
}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
index 218b6d0..19cfd07 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
@@ -124,6 +124,6 @@ void TestShell::waitTestFinished()
[thread release];
}
-void platformInit()
+void platformInit(int*, char***)
{
}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
index a9ca6a9..72f800c 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
@@ -103,7 +103,7 @@ void TestShell::waitTestFinished()
WaitForSingleObject(threadHandle, 1000);
}
-void platformInit()
+void platformInit(int*, char***)
{
// Set stdout/stderr binary mode.
_setmode(_fileno(stdout), _O_BINARY);
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
index b95fec2..4f4246f 100644
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
@@ -103,6 +103,20 @@ static GdkWindow* gtk_widget_get_window(GtkWidget* widget)
}
#endif
+#if !GTK_CHECK_VERSION(2, 21, 2)
+static GdkDragAction gdk_drag_context_get_selected_action(GdkDragContext* context)
+{
+ g_return_val_if_fail(GDK_IS_DRAG_CONTEXT(context), static_cast<GdkDragAction>(0));
+ return context->action;
+}
+
+static GdkDragAction gdk_drag_context_get_actions(GdkDragContext* context)
+{
+ g_return_val_if_fail(GDK_IS_DRAG_CONTEXT(context), GDK_ACTION_DEFAULT);
+ return context->actions;
+}
+#endif
+
static JSValueRef getDragModeCallback(JSContextRef context, JSObjectRef object, JSStringRef propertyName, JSValueRef* exception)
{
return JSValueMakeBoolean(context, dragMode);
@@ -371,10 +385,12 @@ static void dispatchEvent(GdkEvent event)
// Simulate a drag motion on the top-level GDK window.
GtkWidget* parentWidget = gtk_widget_get_parent(GTK_WIDGET(view));
- GdkWindow* parentWidgetWindow = parentWidget->window;
+ GdkWindow* parentWidgetWindow = gtk_widget_get_window(parentWidget);
gdk_drag_motion(currentDragSourceContext, parentWidgetWindow, GDK_DRAG_PROTO_XDND,
event.motion.x_root, event.motion.y_root,
- currentDragSourceContext->action, currentDragSourceContext->actions, GDK_CURRENT_TIME);
+ gdk_drag_context_get_selected_action(currentDragSourceContext),
+ gdk_drag_context_get_actions(currentDragSourceContext),
+ GDK_CURRENT_TIME);
} else if (currentDragSourceContext && event.type == GDK_BUTTON_RELEASE) {
// We've released the mouse button, we should just be able to spin the
@@ -456,9 +472,13 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
gdkKeySym = GDK_KP_Home;
else if (JSStringIsEqualToUTF8CString(character, "end"))
gdkKeySym = GDK_KP_End;
+ else if (JSStringIsEqualToUTF8CString(character, "insert"))
+ gdkKeySym = GDK_KP_Insert;
+ else if (JSStringIsEqualToUTF8CString(character, "delete"))
+ gdkKeySym = GDK_KP_Delete;
else
- // Assume we only get arrow/pgUp/pgDn/home/end keys with
- // location=NUMPAD for now.
+ // If we get some other key specified with the numpad location,
+ // crash here, so we add it sooner rather than later.
g_assert_not_reached();
} else {
if (JSStringIsEqualToUTF8CString(character, "leftArrow"))
@@ -477,8 +497,12 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
gdkKeySym = GDK_Home;
else if (JSStringIsEqualToUTF8CString(character, "end"))
gdkKeySym = GDK_End;
+ else if (JSStringIsEqualToUTF8CString(character, "insert"))
+ gdkKeySym = GDK_Insert;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
gdkKeySym = GDK_Delete;
+ else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
+ gdkKeySym = GDK_Print;
else if (JSStringIsEqualToUTF8CString(character, "F1"))
gdkKeySym = GDK_F1;
else if (JSStringIsEqualToUTF8CString(character, "F2"))
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 5c942d3..2aece10 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -442,6 +442,12 @@ void LayoutTestController::disableImageLoading()
// Also need to make sure image loading is re-enabled for each new test.
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
// FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
index 9d2fc75..77999bd 100644
--- a/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
+++ b/WebKitTools/DumpRenderTree/mac/EventSendingController.mm
@@ -597,10 +597,18 @@ static int buildModifierFlags(const WebScriptObject* modifiers)
const unichar ch = NSEndFunctionKey;
eventCharacter = [NSString stringWithCharacters:&ch length:1];
keyCode = 0x77;
+ } else if ([character isEqualToString:@"insert"]) {
+ const unichar ch = NSInsertFunctionKey;
+ eventCharacter = [NSString stringWithCharacters:&ch length:1];
+ keyCode = 0x72;
} else if ([character isEqualToString:@"delete"]) {
const unichar ch = NSDeleteFunctionKey;
eventCharacter = [NSString stringWithCharacters:&ch length:1];
keyCode = 0x75;
+ } else if ([character isEqualToString:@"printScreen"]) {
+ const unichar ch = NSPrintScreenFunctionKey;
+ eventCharacter = [NSString stringWithCharacters:&ch length:1];
+ keyCode = 0x0; // There is no known virtual key code for PrintScreen.
}
// Compare the input string with the function-key names defined by the DOM spec (i.e. "F1",...,"F24").
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 6b921f0..7db7fff 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -320,6 +320,13 @@ void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidd
[WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()];
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
WebGeolocationPosition *position = [[WebGeolocationPosition alloc] initWithTimestamp:0 latitude:latitude longitude:longitude accuracy:accuracy];
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
index 1e495b1..63dbd2a 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
@@ -334,9 +334,15 @@ void EventSender::keyDown(const QString& string, const QStringList& modifiers, u
} else if (string == QLatin1String("end")) {
s = QString();
code = Qt::Key_End;
+ } else if (string == QLatin1String("insert")) {
+ s = QString();
+ code = Qt::Key_Insert;
} else if (string == QLatin1String("delete")) {
s = QString();
code = Qt::Key_Delete;
+ } else if (string == QLatin1String("printScreen")) {
+ s = QString();
+ code = Qt::Key_Print;
}
}
QKeyEvent event(QEvent::KeyPress, code, modifs, s);
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index 8ebdbae..ca51f1b 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -683,6 +683,12 @@ void LayoutTestController::setEditingBehavior(const QString& editingBehavior)
DumpRenderTreeSupportQt::setEditingBehavior(m_drt->webPage(), editingBehavior);
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setGeolocationPermission(bool allow)
{
m_isGeolocationPermissionSet = true;
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 4ebf99d..1dee6ce 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -197,6 +197,8 @@ public slots:
// which is a Mac-specific test.
void addDisallowedURL(const QString&) {}
+ void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
+
void setMockGeolocationError(int code, const QString& message);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
void setGeolocationPermission(bool allow);
diff --git a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
index 6ab22fc..e48b035 100644
--- a/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
+++ b/WebKitTools/DumpRenderTree/qt/TestNetscapePlugin/TestNetscapePlugin.pro
@@ -26,7 +26,12 @@ INCLUDEPATH += ../../../../JavaScriptCore \
../../TestNetscapePlugIn
SOURCES = PluginObject.cpp \
- TestObject.cpp
+ PluginTest.cpp \
+ TestObject.cpp \
+ Tests/DocumentOpenInDestroyStream.cpp \
+ Tests/NPRuntimeObjectFromDestroyedPlugin.cpp \
+ Tests/NPRuntimeRemoveProperty.cpp \
+ Tests/PluginScriptableNPObjectInvokeDefault.cpp
mac {
SOURCES += ../../TestNetscapePlugIn/main.cpp
diff --git a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
index ca868be..8216f7a 100644
--- a/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
+++ b/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
@@ -27,6 +27,7 @@
#include "config.h"
#include "PluginObject.h"
+#include "PluginTest.h"
#include "npapi.h"
#include "npruntime.h"
@@ -37,7 +38,10 @@
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>
+#include <string>
+using namespace std;
+
extern "C" {
NPError NP_Initialize (NPNetscapeFuncs *aMozillaVTable, NPPluginFuncs *aPluginVTable);
NPError NP_Shutdown(void);
@@ -60,8 +64,12 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
PluginObject* obj = (PluginObject*)browser->createobject(instance, getPluginClass());
instance->pdata = obj;
+ string testIdentifier;
+
for (int i = 0; i < argc; i++) {
- if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
+ if (strcasecmp(argn[i], "test") == 0)
+ testIdentifier = argv[i];
+ else if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad)
obj->onStreamLoad = strdup(argv[i]);
else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDestroy)
obj->onStreamDestroy = strdup(argv[i]);
@@ -82,8 +90,6 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
executeScript(obj, "document.body.innerHTML = ''");
else if (!strcasecmp(argn[i], "ondestroy"))
obj->onDestroy = strdup(argv[i]);
- else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0)
- obj->testDocumentOpenInDestroyStream = TRUE;
else if (strcasecmp(argn[i], "testwindowopen") == 0)
obj->testWindowOpen = TRUE;
else if (strcasecmp(argn[i], "onSetWindow") == 0 && !obj->onSetWindow)
@@ -91,6 +97,8 @@ webkit_test_plugin_new_instance(NPMIMEType /*mimetype*/,
}
browser->getvalue(instance, NPNVprivateModeBool, (void *)&obj->cachedPrivateBrowsingMode);
+
+ obj->pluginTest = PluginTest::create(instance, testIdentifier);
}
return NPERR_NO_ERROR;
@@ -190,7 +198,7 @@ webkit_test_plugin_new_stream(NPP instance,
}
static NPError
-webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError reason)
+webkit_test_plugin_destroy_stream(NPP instance, NPStream* stream, NPError reason)
{
PluginObject* obj = (PluginObject*)instance->pdata;
@@ -217,12 +225,7 @@ webkit_test_plugin_destroy_stream(NPP instance, NPStream* /*stream*/, NPError re
}
}
- if (obj->testDocumentOpenInDestroyStream) {
- testDocumentOpen(instance);
- obj->testDocumentOpenInDestroyStream = FALSE;
- }
-
- return NPERR_NO_ERROR;
+ return obj->pluginTest->NPP_DestroyStream(stream, reason);
}
static void
@@ -283,6 +286,14 @@ webkit_test_plugin_url_notify(NPP instance, const char* url, NPReason reason, vo
static NPError
webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
{
+ PluginObject* obj = 0;
+ if (instance)
+ obj = static_cast<PluginObject*>(instance->pdata);
+
+ // First, check if the PluginTest object supports getting this value.
+ if (obj && obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR)
+ return NPERR_NO_ERROR;
+
NPError err = NPERR_NO_ERROR;
switch (variable) {
@@ -308,7 +319,6 @@ webkit_test_plugin_get_value(NPP instance, NPPVariable variable, void *value)
if (variable == NPPVpluginScriptableNPObject) {
void **v = (void **)value;
- PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
browser->retainobject((NPObject *)obj);
*v = obj;
err = NPERR_NO_ERROR;
diff --git a/WebKitTools/DumpRenderTree/win/EventSender.cpp b/WebKitTools/DumpRenderTree/win/EventSender.cpp
index c9749e7..94f0945 100644
--- a/WebKitTools/DumpRenderTree/win/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/win/EventSender.cpp
@@ -467,8 +467,12 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS
virtualKeyCode = VK_HOME;
else if (JSStringIsEqualToUTF8CString(character, "end"))
virtualKeyCode = VK_END;
+ else if (JSStringIsEqualToUTF8CString(character, "insert"))
+ virtualKeyCode = VK_INSERT;
else if (JSStringIsEqualToUTF8CString(character, "delete"))
virtualKeyCode = VK_DELETE;
+ else if (JSStringIsEqualToUTF8CString(character, "printScreen"))
+ virtualKeyCode = VK_SNAPSHOT;
else {
charCode = JSStringGetCharactersPtr(character)[0];
virtualKeyCode = LOBYTE(VkKeyScan(charCode));
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index a29623e..6519a97 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -375,6 +375,12 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permis
webView->setPolicyDelegate(0);
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
// FIXME: Implement for Geolocation layout tests.
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 905463a..fd6b2d2 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -271,6 +271,12 @@ bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef prop
return false;
}
+void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
+{
+ // FIXME: Implement for DeviceOrientation layout tests.
+ // See https://bugs.webkit.org/show_bug.cgi?id=30335.
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
// FIXME: Implement for Geolocation layout tests.