OSDN Git Service

Merge Webkit at r70949: Initial merge by git.
[android-x86/external-webkit.git] / WebKitTools / DumpRenderTree / TestNetscapePlugIn / PluginTest.cpp
index 0ff7029..e41e6e5 100644 (file)
@@ -26,6 +26,7 @@
 #include "PluginTest.h"
 
 #include <assert.h>
+#include <string.h>
 
 using namespace std;
 extern NPNetscapeFuncs *browser;
@@ -49,6 +50,11 @@ PluginTest::~PluginTest()
 {
 }
 
+NPError PluginTest::NPP_Destroy(NPSavedData**)
+{
+    return NPERR_NO_ERROR;
+}
+
 NPError PluginTest::NPP_DestroyStream(NPStream *stream, NPReason reason)
 {
     return NPERR_NO_ERROR;
@@ -60,6 +66,16 @@ NPError PluginTest::NPP_GetValue(NPPVariable variable, void *value)
     return NPERR_GENERIC_ERROR;
 }
 
+NPError PluginTest::NPP_SetWindow(NPP, NPWindow*)
+{
+    return NPERR_NO_ERROR;
+}
+
+void PluginTest::NPN_InvalidateRect(NPRect* invalidRect)
+{
+    browser->invalidaterect(m_npp, invalidRect);
+}
+
 NPIdentifier PluginTest::NPN_GetStringIdentifier(const NPUTF8 *name)
 {
     return browser->getstringidentifier(name);
@@ -70,6 +86,11 @@ NPIdentifier PluginTest::NPN_GetIntIdentifier(int32_t intid)
     return browser->getintidentifier(intid);
 }
 
+NPError PluginTest::NPN_GetValue(NPNVariable variable, void* value)
+{
+    return browser->getvalue(m_npp, variable, value);
+}
+
 NPObject* PluginTest::NPN_CreateObject(NPClass* npClass)
 {
     return browser->createobject(m_npp, npClass);
@@ -80,6 +101,30 @@ bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyNam
     return browser->removeproperty(m_npp, npObject, propertyName);
 }
 
+static void executeScript(NPP npp, const char* script)
+{
+    NPObject* windowScriptObject;
+    browser->getvalue(npp, NPNVWindowNPObject, &windowScriptObject);
+
+    NPString npScript;
+    npScript.UTF8Characters = script;
+    npScript.UTF8Length = strlen(script);
+
+    NPVariant browserResult;
+    browser->evaluate(npp, windowScriptObject, &npScript, &browserResult);
+    browser->releasevariantvalue(&browserResult);
+}
+
+void PluginTest::waitUntilDone()
+{
+    executeScript(m_npp, "layoutTestController.waitUntilDone()");
+}
+
+void PluginTest::notifyDone()
+{
+    executeScript(m_npp, "layoutTestController.notifyDone()");
+}
+
 void PluginTest::registerCreateTestFunction(const string& identifier, CreateTestFunction createTestFunction)
 {
     assert(!createTestFunctions().count(identifier));