Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: webkit/tools/npapi_layout_test_plugin/TestObject.cpp

Issue 332013: Add a regression test for the PluginChannel::CleanUp. My earlier speculative... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/tools/npapi_layout_test_plugin/TestObject.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/npapi_layout_test_plugin/TestObject.cpp
===================================================================
--- webkit/tools/npapi_layout_test_plugin/TestObject.cpp (revision 29926)
+++ webkit/tools/npapi_layout_test_plugin/TestObject.cpp (working copy)
@@ -87,11 +87,13 @@
};
#define ID_THROW_EXCEPTION_METHOD 0
-#define NUM_METHOD_IDENTIFIERS 1
+#define ID_PAGE_TEST_OBJECT_METHOD 1
+#define NUM_METHOD_IDENTIFIERS 2
static NPIdentifier testMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *testMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"throwException",
+ "pageTestObject",
};
static void initializeIdentifiers(void)
@@ -104,7 +106,9 @@
{
TestObject *newInstance =
static_cast<TestObject*>(malloc(sizeof(TestObject)));
+ newInstance->npp = npp;
newInstance->testObject = NULL;
+ newInstance->testPageObject = NULL;
++testObjectCount;
if (!identifiersInitialized) {
@@ -120,6 +124,8 @@
TestObject *testObject = reinterpret_cast<TestObject*>(obj);
if (testObject->testObject)
browser->releaseobject(testObject->testObject);
+ if (testObject->testPageObject)
+ browser->releaseobject(testObject->testPageObject);
--testObjectCount;
free(obj);
}
@@ -138,6 +144,23 @@
if (name == testMethodIdentifiers[ID_THROW_EXCEPTION_METHOD]) {
browser->setexception(header, "test object throwException SUCCESS");
return true;
+ } else if (name == testMethodIdentifiers[ID_PAGE_TEST_OBJECT_METHOD]) {
+ TestObject* testObject = reinterpret_cast<TestObject*>(header);
+ if (testObject->testPageObject == NULL) {
+ NPObject *windowScriptObject;
+ browser->getvalue(testObject->npp, NPNVWindowNPObject, &windowScriptObject);
+
+ NPIdentifier pageMethod = browser->getstringidentifier("dummyMethod");
+
+ NPVariant functionPointer;
+ browser->invoke(testObject->npp, windowScriptObject, pageMethod,
+ NULL, 0, &functionPointer);
+
+ if (NPVARIANT_IS_OBJECT(functionPointer))
+ testObject->testPageObject = NPVARIANT_TO_OBJECT(functionPointer);
+
+ return true;
+ }
}
return false;
}
« no previous file with comments | « webkit/tools/npapi_layout_test_plugin/TestObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698