summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-08-04 11:41:34 +0100
committerSteve Block <steveblock@google.com>2010-08-09 12:04:44 +0100
commitdb14019a23d96bc8a444b6576a5da8bd1cfbc8b0 (patch)
tree9f793c5b0f5e1f2aca8247158920e2c4bf962bbf /WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp
parentbf916837aa84f1e4b00e6ed6268516c2acd27545 (diff)
downloadexternal_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.zip
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.gz
external_webkit-db14019a23d96bc8a444b6576a5da8bd1cfbc8b0.tar.bz2
Merge WebKit at r64523 : Initial merge by git.
Change-Id: Ibb796c6802e757b1d9b40f58205cfbe4da95fcd4
Diffstat (limited to 'WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp')
-rw-r--r--WebKitTools/DumpRenderTree/unix/TestNetscapePlugin/TestNetscapePlugin.cpp32
1 files changed, 21 insertions, 11 deletions
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;