[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 11:35:25 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit cfe3e92545ab9a7f4b0c887b4ac21149e6e0b998
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jul 30 00:11:45 2010 +0000
Refactor TestNetscapePlugin so tests can be split in separate files
https://bugs.webkit.org/show_bug.cgi?id=43220
Reviewed by Sam Weinig.
WebKitTools:
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp.
* DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
(pluginAllocate):
Initialize pluginTest to 0. Remove testDocumentOpenInDestroyStream.
* DumpRenderTree/TestNetscapePlugIn/PluginObject.h:
* DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: Added.
(PluginTest::PluginTest):
Initialize m_npp and the test identifier.
(PluginTest::createTestFunctions):
Return the map from identifiers to createTest functions.
(PluginTest::registerCreateTestFunction):
Insert the identifier and create function pair in the map.
(PluginTest::create):
Look for a createTest function. If one is found, call it. Otherwise create a vanilla PluginTest object.
* DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added.
(PluginTest::Register::Register):
Helper class template for registering plug-in tests.
(PluginTest::Register::create):
Create a new test of the given type.
* DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp: Added.
(DocumentOpenInDestroyStream::DocumentOpenInDestroyStream):
Add a test that calls testDocumentOpen from its NPP_DestroyStream callback.
* DumpRenderTree/TestNetscapePlugIn/main.cpp:
(NPP_New):
Create a PluginTest given the identifier. Remove the check for "testdocumentopenindestroystream".
(NPP_DestroyStream):
Call the plug-in test NPP_DestroyStream member function.
* DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp.
LayoutTests:
* plugins/document-open.html:
Pass the test identifier as an attribute of the embed tag.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 99932c5..01c57e1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-29 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Refactor TestNetscapePlugin so tests can be split in separate files
+ https://bugs.webkit.org/show_bug.cgi?id=43220
+
+ * plugins/document-open.html:
+ Pass the test identifier as an attribute of the embed tag.
+
2010-07-29 Dumitru Daniliuc <dumi at chromium.org>
Unreviewed, updating Chromium expectations.
diff --git a/LayoutTests/plugins/document-open.html b/LayoutTests/plugins/document-open.html
index 7c9df70..e12545a 100644
--- a/LayoutTests/plugins/document-open.html
+++ b/LayoutTests/plugins/document-open.html
@@ -4,7 +4,7 @@
<embed id="testPlugin"
type="application/x-webkit-test-netscape"
src="data:text/plain,"
- testdocumentopenindestroystream="true">
+ test="document-open-in-destroy-stream">
</embed>
<div>
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 2e589fd..78239f4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,52 @@
+2010-07-29 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Refactor TestNetscapePlugin so tests can be split in separate files
+ https://bugs.webkit.org/show_bug.cgi?id=43220
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp:
+ (pluginAllocate):
+ Initialize pluginTest to 0. Remove testDocumentOpenInDestroyStream.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginObject.h:
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp: Added.
+ (PluginTest::PluginTest):
+ Initialize m_npp and the test identifier.
+
+ (PluginTest::createTestFunctions):
+ Return the map from identifiers to createTest functions.
+
+ (PluginTest::registerCreateTestFunction):
+ Insert the identifier and create function pair in the map.
+
+ (PluginTest::create):
+ Look for a createTest function. If one is found, call it. Otherwise create a vanilla PluginTest object.
+
+ * DumpRenderTree/TestNetscapePlugIn/PluginTest.h: Added.
+ (PluginTest::Register::Register):
+ Helper class template for registering plug-in tests.
+
+ (PluginTest::Register::create):
+ Create a new test of the given type.
+
+ * DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp: Added.
+ (DocumentOpenInDestroyStream::DocumentOpenInDestroyStream):
+ Add a test that calls testDocumentOpen from its NPP_DestroyStream callback.
+
+ * DumpRenderTree/TestNetscapePlugIn/main.cpp:
+ (NPP_New):
+ Create a PluginTest given the identifier. Remove the check for "testdocumentopenindestroystream".
+
+ (NPP_DestroyStream):
+ Call the plug-in test NPP_DestroyStream member function.
+
+ * DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj:
+ Add PluginTest.cpp, PluginTest.h and Tests/DocumentOpenInDestroyStream.cpp.
+
2010-07-29 Martin Robinson <mrobinson at igalia.com>
Unreviewed build fix.
diff --git a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
index 2ed5daa..283d7d8 100644
--- a/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
+++ b/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
@@ -32,6 +32,9 @@
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 */; };
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 */; };
@@ -185,6 +188,9 @@
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>"; };
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>"; };
@@ -357,11 +363,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 +430,14 @@
name = Delegates;
sourceTree = "<group>";
};
+ 1A215A6E11F25FF1008AD0F5 /* Tests */ = {
+ isa = PBXGroup;
+ children = (
+ 1A215A7511F26072008AD0F5 /* DocumentOpenInDestroyStream.cpp */,
+ );
+ path = Tests;
+ sourceTree = "<group>";
+ };
9340995508540CAF007F3BC8 /* Products */ = {
isa = PBXGroup;
children = (
@@ -521,6 +538,7 @@
files = (
141BF453096A45EB00E0753C /* PluginObject.h in Headers */,
1A8F02E80BB9B4EC008CFA34 /* TestObject.h in Headers */,
+ 1A215A8211F2609C008AD0F5 /* PluginTest.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -684,6 +702,8 @@
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 */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
index d341ed6..72475e0 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.cpp
@@ -966,6 +966,7 @@ static NPObject *pluginAllocate(NPP npp, NPClass *theClass)
initializeIdentifiers();
}
+ newInstance->pluginTest = 0;
newInstance->npp = npp;
newInstance->testObject = browser->createobject(npp, getTestClass());
newInstance->rememberedObject = 0;
@@ -987,7 +988,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 645c81c..2c1d325 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginObject.h
@@ -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;
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp
new file mode 100644
index 0000000..a684e95
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.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;
+extern NPNetscapeFuncs *browser;
+
+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;
+}
+
+std::map<std::string, PluginTest::CreateTestFunction>& PluginTest::createTestFunctions()
+{
+ static std::map<std::string, CreateTestFunction> testFunctions;
+
+ return testFunctions;
+}
+
+void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
+{
+ assert(!createTestFunctions().count(identifier));
+
+ createTestFunctions()[identifier] = createTestFunction;
+}
+
+PluginTest* PluginTest::create(NPP npp, const string& identifier)
+{
+ CreateTestFunction createTestFunction = createTestFunctions()[identifier];
+ if (createTestFunction)
+ return createTestFunction(npp, identifier);
+
+ return new PluginTest(npp, identifier);
+}
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
new file mode 100644
index 0000000..49159ce
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h
@@ -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.
+ */
+
+#ifndef PluginTest_h
+#define PluginTest_h
+
+#include <WebKit/npfunctions.h>
+#include <map>
+#include <string>
+
+class PluginTest {
+public:
+ static PluginTest* create(NPP, const std::string& identifier);
+ virtual ~PluginTest();
+
+ // Add more NPP functions here if needed.
+ virtual NPError NPP_DestroyStream(NPStream *stream, NPReason reason);
+
+ 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);
+
+ // NPN functions.
+
+ // FIXME: A plug-in test shouldn't need to know about it's NPP. Make this private.
+ NPP m_npp;
+
+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..e00a810
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/Tests/DocumentOpenInDestroyStream.cpp
@@ -0,0 +1,54 @@
+/*
+ * 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"
+
+extern bool testDocumentOpen(NPP npp);
+
+class DocumentOpenInDestroyStream : public PluginTest {
+public:
+ DocumentOpenInDestroyStream(NPP npp, const std::string& identifier)
+ : PluginTest(npp, identifier)
+ , m_shouldOpen(true)
+ {
+ }
+
+private:
+ virtual NPError NPP_DestroyStream(NPStream*, NPReason);
+
+ bool m_shouldOpen;
+};
+
+NPError DocumentOpenInDestroyStream::NPP_DestroyStream(NPStream*, NPReason)
+{
+ if (m_shouldOpen) {
+ testDocumentOpen(m_npp);
+ m_shouldOpen = false;
+ }
+
+ return NPERR_NO_ERROR;
+}
+
+static PluginTest::Register<DocumentOpenInDestroyStream> documentOpenInDestroyStream("document-open-in-destroy-stream");
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/main.cpp
index 82a6e3a..ab1cc3f 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)
diff --git a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
index 34d2f08..d5d5ed8 100644
--- a/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
+++ b/WebKitTools/DumpRenderTree/TestNetscapePlugIn/win/TestNetscapePlugin.vcproj
@@ -425,6 +425,14 @@
>
</File>
<File
+ RelativePath="..\PluginTest.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PluginTest.h"
+ >
+ </File>
+ <File
RelativePath=".\resource.h"
>
</File>
@@ -448,6 +456,14 @@
RelativePath="..\TestObject.h"
>
</File>
+ <Filter
+ Name="Tests"
+ >
+ <File
+ RelativePath="..\Tests\DocumentOpenInDestroyStream.cpp"
+ >
+ </File>
+ </Filter>
</Files>
<Globals>
</Globals>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list