summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-05 14:36:32 +0100
committerBen Murdoch <benm@google.com>2011-05-10 15:38:30 +0100
commitf05b935882198ccf7d81675736e3aeb089c5113a (patch)
tree4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests
parent60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff)
downloadexternal_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz
external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests')
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp56
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp64
-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/NullNPPGetValuePointer.cpp70
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp70
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp68
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp118
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp73
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp188
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp90
-rw-r--r--WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp114
12 files changed, 0 insertions, 1072 deletions
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
deleted file mode 100644
index 69e706e..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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/EvaluateJSAfterRemovingPluginElement.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp
deleted file mode 100644
index 4b5d3e0..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/EvaluateJSAfterRemovingPluginElement.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 "PluginObject.h"
-
-using namespace std;
-
-// Executing JS after removing the plugin element from the document should not crash.
-
-class EvaluateJSAfterRemovingPluginElement : public PluginTest {
-public:
- EvaluateJSAfterRemovingPluginElement(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_DestroyStream(NPStream*, NPReason);
-
- bool m_didExecuteScript;
-};
-
-static PluginTest::Register<EvaluateJSAfterRemovingPluginElement> registrar("evaluate-js-after-removing-plugin-element");
-
-EvaluateJSAfterRemovingPluginElement::EvaluateJSAfterRemovingPluginElement(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didExecuteScript(false)
-{
- waitUntilDone();
-}
-
-NPError EvaluateJSAfterRemovingPluginElement::NPP_DestroyStream(NPStream*, NPReason)
-{
- if (m_didExecuteScript)
- return NPERR_NO_ERROR;
- m_didExecuteScript = true;
-
- executeScript("var plugin = document.getElementsByTagName('embed')[0]; plugin.parentElement.removeChild(plugin);");
- executeScript("document.body.appendChild(document.createTextNode('Executing script after removing the plugin element from the document succeeded.'));");
- notifyDone();
-
- return NPERR_NO_ERROR;
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
deleted file mode 100644
index 38236e3..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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
deleted file mode 100644
index 4d417d1..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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/NullNPPGetValuePointer.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp
deleted file mode 100644
index 9e4e976..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 "PluginObject.h"
-
-using namespace std;
-
-// Passing null for our NPP_GetValue function pointer should not crash.
-
-class NullNPPGetValuePointer : public PluginTest {
-public:
- NullNPPGetValuePointer(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_Destroy(NPSavedData**);
- virtual NPError NPP_GetValue(NPPVariable, void* value);
-
- NPP_GetValueProcPtr m_originalNPPGetValuePointer;
-};
-
-static PluginTest::Register<NullNPPGetValuePointer> registrar("null-npp-getvalue-pointer");
-
-NullNPPGetValuePointer::NullNPPGetValuePointer(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_originalNPPGetValuePointer(pluginFunctions->getvalue)
-{
- // Be sneaky and null out the getvalue pointer the browser is holding. This simulates a plugin
- // that doesn't implement NPP_GetValue (like Shockwave Director 10.3 on Windows). Note that if
- // WebKit copies the NPPluginFuncs struct this technique will have no effect and WebKit will
- // call into our NPP_GetValue implementation.
- pluginFunctions->getvalue = 0;
-}
-
-NPError NullNPPGetValuePointer::NPP_Destroy(NPSavedData**)
-{
- // Set the NPP_GetValue pointer back the way it was before we mucked with it so we don't mess
- // up future uses of the plugin module.
- pluginFunctions->getvalue = m_originalNPPGetValuePointer;
- return NPERR_NO_ERROR;
-}
-
-NPError NullNPPGetValuePointer::NPP_GetValue(NPPVariable, void*)
-{
- pluginLog(m_npp, "NPP_GetValue was called but should not have been. Maybe WebKit copied the NPPluginFuncs struct, which would invalidate this test.");
- return NPERR_GENERIC_ERROR;
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp
deleted file mode 100644
index e464996..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PassDifferentNPPStruct.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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 "PluginObject.h"
-
-using namespace std;
-
-// Passing a different NPP struct that has the same ndata value as the one passed to NPP_New should
-// not trigger an assertion failure.
-
-class PassDifferentNPPStruct : public PluginTest {
-public:
- PassDifferentNPPStruct(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
- {
- }
-
-private:
- virtual NPError NPP_SetWindow(NPP instance, NPWindow* window)
- {
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- NPP oldNPP = m_npp;
- NPP_t differentNPP = *m_npp;
- m_npp = &differentNPP;
-
- NPBool privateMode;
- NPError error = NPN_GetValue(NPNVprivateModeBool, &privateMode);
-
- m_npp = oldNPP;
-
- if (error != NPERR_NO_ERROR) {
- pluginLog(instance, "NPN_GetValue(NPNVprivateModeBool) with a different NPP struct failed with error %d", error);
- return NPERR_GENERIC_ERROR;
- }
- pluginLog(instance, "NPN_GetValue(NPNVprivateModeBool) with a different NPP struct succeeded");
- return NPERR_NO_ERROR;
- }
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<PassDifferentNPPStruct> getValueNetscapeWindow("pass-different-npp-struct");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
deleted file mode 100644
index 959e182..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/PluginScriptableNPObjectInvokeDefault.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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/Tests/win/DrawsGradient.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp
deleted file mode 100644
index 2b06198..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/DrawsGradient.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* 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 "WindowedPluginTest.h"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// Just fills its window with some gradients
-
-class DrawsGradient : public WindowedPluginTest {
-public:
- DrawsGradient(NPP, const string& identifier);
-
-private:
- void paint(HDC) const;
-
- LRESULT onPaint(WPARAM, LPARAM, bool& handled);
- LRESULT onPrintClient(WPARAM, LPARAM, bool& handled);
-
- virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled);
-};
-
-static PluginTest::Register<DrawsGradient> registrar("draws-gradient");
-
-DrawsGradient::DrawsGradient(NPP npp, const string& identifier)
- : WindowedPluginTest(npp, identifier)
-{
-}
-
-LRESULT DrawsGradient::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
-{
- LRESULT result = 0;
-
- switch (message) {
- case WM_PAINT:
- result = onPaint(wParam, lParam, handled);
- break;
- case WM_PRINTCLIENT:
- result = onPrintClient(wParam, lParam, handled);
- break;
- default:
- handled = false;
- }
-
- return result;
-}
-
-LRESULT DrawsGradient::onPaint(WPARAM, LPARAM, bool& handled)
-{
- PAINTSTRUCT paintStruct;
- HDC dc = ::BeginPaint(window(), &paintStruct);
- if (!dc)
- return 0;
-
- paint(dc);
- ::EndPaint(window(), &paintStruct);
-
- handled = true;
- return 0;
-}
-
-LRESULT DrawsGradient::onPrintClient(WPARAM wParam, LPARAM, bool& handled)
-{
- paint(reinterpret_cast<HDC>(wParam));
-
- handled = true;
- return 0;
-}
-
-void DrawsGradient::paint(HDC dc) const
-{
- RECT clientRect;
- if (!::GetClientRect(window(), &clientRect))
- return;
-
- TRIVERTEX vertices[] = {
- // Upper-left: green
- { clientRect.left, clientRect.top, 0, 0xff00, 0, 0 },
- // Upper-right: blue
- { clientRect.right, clientRect.top, 0, 0, 0xff00, 0 },
- // Lower-left: yellow
- { clientRect.left, clientRect.bottom, 0xff00, 0xff00, 0, 0 },
- // Lower-right: red
- { clientRect.right, clientRect.bottom, 0xff00, 0, 0, 0 },
- };
-
- GRADIENT_TRIANGLE mesh[] = {
- // Upper-left triangle
- { 0, 1, 2 },
- // Lower-right triangle
- { 1, 2, 3 },
- };
-
- ::GradientFill(dc, vertices, _countof(vertices), mesh, _countof(mesh), GRADIENT_FILL_TRIANGLE);
-}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp
deleted file mode 100644
index 32fd99b..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/GetValueNetscapeWindow.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 "PluginObject.h"
-
-using namespace std;
-
-// NPN_GetValue(NPNVnetscapeWindow) should return a valid HWND.
-
-class GetValueNetscapeWindow : public PluginTest {
-public:
- GetValueNetscapeWindow(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
- {
- }
-
-private:
- virtual NPError NPP_SetWindow(NPP instance, NPWindow* window)
- {
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- HWND hwnd;
- NPError error = NPN_GetValue(NPNVnetscapeWindow, &hwnd);
- if (error != NPERR_NO_ERROR) {
- pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) failed with error %d", error);
- return NPERR_GENERIC_ERROR;
- }
-
- if (!::IsWindow(hwnd)) {
- pluginLog(instance, "::IsWindow returned FALSE");
- return NPERR_GENERIC_ERROR;
- }
-
- if (hwnd == window->window) {
- pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) returned the same value as NPWindow::window");
- return NPERR_GENERIC_ERROR;
- }
-
- pluginLog(instance, "NPN_GetValue(NPNVnetscapeWindow) succeeded");
- return NPERR_NO_ERROR;
- }
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<GetValueNetscapeWindow> getValueNetscapeWindow("get-value-netscape-window");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
deleted file mode 100644
index e598c49..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/NPNInvalidateRectInvalidatesWindow.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * 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 "WindowedPluginTest.h"
-
-#include "PluginObject.h"
-
-using namespace std;
-
-// NPN_InvalidateRect should invalidate the plugin's HWND.
-
-static const wchar_t instancePointerProperty[] = L"org.webkit.TestNetscapePlugin.NPNInvalidateRectInvalidatesWindow.InstancePointer";
-
-class TemporaryWindowMover {
-public:
- TemporaryWindowMover(HWND);
- ~TemporaryWindowMover();
-
- bool moveSucceeded() const { return m_moveSucceeded; }
-
-private:
- static const UINT standardSetWindowPosFlags = SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER;
- bool m_moveSucceeded;
- HWND m_window;
- RECT m_savedWindowRect;
-};
-
-TemporaryWindowMover::TemporaryWindowMover(HWND window)
- : m_window(window)
-{
- m_moveSucceeded = false;
-
- if (!::GetWindowRect(m_window, &m_savedWindowRect))
- return;
-
- if (!::SetWindowPos(m_window, 0, 0, 0, 0, 0, SWP_SHOWWINDOW | standardSetWindowPosFlags))
- return;
-
- m_moveSucceeded = true;
-};
-
-TemporaryWindowMover::~TemporaryWindowMover()
-{
- if (!m_moveSucceeded)
- return;
-
- ::SetWindowPos(m_window, 0, m_savedWindowRect.left, m_savedWindowRect.top, 0, 0, SWP_HIDEWINDOW | standardSetWindowPosFlags);
-}
-
-class NPNInvalidateRectInvalidatesWindow : public WindowedPluginTest {
-public:
- NPNInvalidateRectInvalidatesWindow(NPP, const string& identifier);
- ~NPNInvalidateRectInvalidatesWindow();
-
-private:
- virtual LRESULT wndProc(UINT message, WPARAM, LPARAM, bool& handled);
-
- void onPaint();
- void testInvalidateRect();
-
- virtual NPError NPP_SetWindow(NPP, NPWindow*);
-
- TemporaryWindowMover* m_windowMover;
-};
-
-NPNInvalidateRectInvalidatesWindow::NPNInvalidateRectInvalidatesWindow(NPP npp, const string& identifier)
- : WindowedPluginTest(npp, identifier)
- , m_windowMover(0)
-{
-}
-
-NPNInvalidateRectInvalidatesWindow::~NPNInvalidateRectInvalidatesWindow()
-{
- delete m_windowMover;
-}
-
-NPError NPNInvalidateRectInvalidatesWindow::NPP_SetWindow(NPP instance, NPWindow* npWindow)
-{
- NPError error = WindowedPluginTest::NPP_SetWindow(instance, npWindow);
- if (error != NPERR_NO_ERROR)
- return error;
-
- if (!window())
- return NPERR_NO_ERROR;
-
- // The test harness's window (the one that contains the WebView) is off-screen and hidden.
- // We need to move it on-screen and make it visible in order for the plugin's window to
- // accumulate an update region when the DWM is disabled.
-
- HWND testHarnessWindow = ::GetAncestor(window(), GA_ROOT);
- if (!testHarnessWindow) {
- pluginLog(instance, "Failed to get test harness window");
- return NPERR_GENERIC_ERROR;
- }
-
- m_windowMover = new TemporaryWindowMover(testHarnessWindow);
- if (!m_windowMover->moveSucceeded()) {
- pluginLog(instance, "Failed to move test harness window on-screen");
- return NPERR_GENERIC_ERROR;
- }
-
- // Wait until we receive a WM_PAINT message to ensure that the window is on-screen before we do
- // the NPN_InvalidateRect test.
- waitUntilDone();
- return NPERR_NO_ERROR;
-}
-
-LRESULT NPNInvalidateRectInvalidatesWindow::wndProc(UINT message, WPARAM wParam, LPARAM lParam, bool& handled)
-{
- if (message == WM_PAINT)
- onPaint();
-
- handled = false;
- return 0;
-}
-
-void NPNInvalidateRectInvalidatesWindow::onPaint()
-{
- testInvalidateRect();
- notifyDone();
- delete m_windowMover;
- m_windowMover = 0;
-}
-
-void NPNInvalidateRectInvalidatesWindow::testInvalidateRect()
-{
- RECT clientRect;
- if (!::GetClientRect(window(), &clientRect)) {
- pluginLog(m_npp, "::GetClientRect failed");
- return;
- }
-
- if (::IsRectEmpty(&clientRect)) {
- pluginLog(m_npp, "Plugin's HWND has not been sized when NPP_SetWindow is called");
- return;
- }
-
- // Clear the invalid region.
- if (!::ValidateRect(window(), 0)) {
- pluginLog(m_npp, "::ValidateRect failed");
- return;
- }
-
- // Invalidate our lower-right quadrant.
- NPRect rectToInvalidate;
- rectToInvalidate.left = (clientRect.right - clientRect.left) / 2;
- rectToInvalidate.top = (clientRect.bottom - clientRect.top) / 2;
- rectToInvalidate.right = clientRect.right;
- rectToInvalidate.bottom = clientRect.bottom;
- NPN_InvalidateRect(&rectToInvalidate);
-
- RECT invalidRect;
- if (!::GetUpdateRect(window(), &invalidRect, FALSE)) {
- pluginLog(m_npp, "::GetUpdateRect failed");
- return;
- }
-
- if (invalidRect.left != rectToInvalidate.left || invalidRect.top != rectToInvalidate.top || invalidRect.right != rectToInvalidate.right || invalidRect.bottom != rectToInvalidate.bottom) {
- pluginLog(m_npp, "Expected invalid rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", rectToInvalidate.left, rectToInvalidate.top, rectToInvalidate.right, rectToInvalidate.bottom, invalidRect.left, invalidRect.top, invalidRect.right, invalidRect.bottom);
- return;
- }
-
- pluginLog(m_npp, "Plugin's HWND has been invalidated as expected");
-}
-
-static PluginTest::Register<NPNInvalidateRectInvalidatesWindow> registrar("npn-invalidate-rect-invalidates-window");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp
deleted file mode 100644
index 8054497..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowGeometryInitializedBeforeSetWindow.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * 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 "PluginObject.h"
-
-using namespace std;
-
-// Plugin's HWND should be sized/positioned before NPP_SetWindow is called.
-
-class WindowGeometryInitializedBeforeSetWindow : public PluginTest {
-public:
- WindowGeometryInitializedBeforeSetWindow(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
- {
- }
-
-private:
- virtual NPError NPP_SetWindow(NPP instance, NPWindow* window)
- {
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- if (window->type != NPWindowTypeWindow) {
- pluginLog(instance, "window->type should be NPWindowTypeWindow but was %d", window->type);
- return NPERR_GENERIC_ERROR;
- }
-
- HWND hwnd = reinterpret_cast<HWND>(window->window);
- RECT rect;
- if (!::GetClientRect(hwnd, &rect)) {
- pluginLog(instance, "::GetClientRect failed");
- return NPERR_GENERIC_ERROR;
- }
-
- if (::IsRectEmpty(&rect)) {
- pluginLog(instance, "Plugin's HWND has not been sized when NPP_SetWindow is called");
- return NPERR_GENERIC_ERROR;
- }
-
- HWND parent = ::GetParent(hwnd);
- if (!parent) {
- pluginLog(instance, "::GetParent failed");
- return NPERR_GENERIC_ERROR;
- }
-
- // MSDN says that calling ::MapWindowPoints this way will tell it we're passing a RECT rather than two POINTs.
- if (!::MapWindowPoints(hwnd, parent, reinterpret_cast<POINT*>(&rect), 2)) {
- pluginLog(instance, "::MapWindowPoints failed");
- return NPERR_GENERIC_ERROR;
- }
-
- if (rect.left != window->x || rect.top != window->y || (rect.right - rect.left) != window->width || (rect.bottom - rect.top) != window->height) {
- pluginLog(instance, "HWND's rect and NPWindow's rect are not equal");
- return NPERR_GENERIC_ERROR;
- }
-
- pluginLog(instance, "Plugin's HWND has been sized and positioned before NPP_SetWindow was called");
- return NPERR_NO_ERROR;
- }
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<WindowGeometryInitializedBeforeSetWindow> windowGeometryInitializedBeforeSetWindow("window-geometry-initialized-before-set-window");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp
deleted file mode 100644
index 975a598..0000000
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/win/WindowRegionIsSetToClipRect.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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 "PluginObject.h"
-
-using namespace std;
-
-// The plugin's window's window region should be set to the plugin's clip rect.
-
-class WindowRegionIsSetToClipRect : public PluginTest {
-public:
- WindowRegionIsSetToClipRect(NPP, const string& identifier);
-
-private:
- virtual NPError NPP_SetWindow(NPP, NPWindow*);
-
- bool m_didReceiveInitialSetWindowCall;
-};
-
-static PluginTest::Register<WindowRegionIsSetToClipRect> registrar("window-region-is-set-to-clip-rect");
-
-WindowRegionIsSetToClipRect::WindowRegionIsSetToClipRect(NPP npp, const string& identifier)
- : PluginTest(npp, identifier)
- , m_didReceiveInitialSetWindowCall(false)
-{
-}
-
-NPError WindowRegionIsSetToClipRect::NPP_SetWindow(NPP instance, NPWindow* window)
-{
- if (m_didReceiveInitialSetWindowCall)
- return NPERR_NO_ERROR;
- m_didReceiveInitialSetWindowCall = true;
-
- if (window->type != NPWindowTypeWindow) {
- pluginLog(instance, "window->type should be NPWindowTypeWindow but was %d", window->type);
- return NPERR_GENERIC_ERROR;
- }
-
- HWND hwnd = reinterpret_cast<HWND>(window->window);
-
- RECT regionRect;
- if (::GetWindowRgnBox(hwnd, &regionRect) == ERROR) {
- pluginLog(instance, "::GetWindowRgnBox failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
- // This expected rect is based on the layout of window-region-is-set-to-clip-rect.html.
- RECT expectedRect = { 50, 50, 100, 100 };
- if (!::EqualRect(&regionRect, &expectedRect)) {
- pluginLog(instance, "Expected region rect {left=%u, top=%u, right=%u, bottom=%u}, but got {left=%d, top=%d, right=%d, bottom=%d}", expectedRect.left, expectedRect.top, expectedRect.right, expectedRect.bottom, regionRect.left, regionRect.top, regionRect.right, regionRect.bottom);
- return NPERR_GENERIC_ERROR;
- }
-
- pluginLog(instance, "PASS: Plugin's window's window region has been set as expected");
-
- // While we're here, check that our window class doesn't have the CS_PARENTDC style, which
- // defeats clipping by ignoring the window region and always clipping to the parent window.
- // FIXME: It would be nice to have a pixel test that shows that we're
- // getting clipped correctly, but unfortunately window regions are ignored
- // during WM_PRINT (see <http://webkit.org/b/49034>).
- wchar_t className[512];
- if (!::GetClassNameW(hwnd, className, _countof(className))) {
- pluginLog(instance, "::GetClassName failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
-#ifdef DEBUG_ALL
- const wchar_t webKitDLLName[] = L"WebKit_debug.dll";
-#else
- const wchar_t webKitDLLName[] = L"WebKit.dll";
-#endif
- HMODULE webKitModule = ::GetModuleHandleW(webKitDLLName);
- if (!webKitModule) {
- pluginLog(instance, "::GetModuleHandleW failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
- WNDCLASSW wndClass;
- if (!::GetClassInfoW(webKitModule, className, &wndClass)) {
- pluginLog(instance, "::GetClassInfoW failed with error %u", ::GetLastError());
- return NPERR_GENERIC_ERROR;
- }
-
- if (wndClass.style & CS_PARENTDC)
- pluginLog(instance, "FAIL: Plugin's window's class has the CS_PARENTDC style, which will defeat clipping");
- else
- pluginLog(instance, "PASS: Plugin's window's class does not have the CS_PARENTDC style");
-
- return NPERR_NO_ERROR;
-}