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

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

Issue 113823: Added support for constructor calls in the NPAPI (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/layout_tests/test_expectations.txt ('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 16974)
+++ webkit/tools/npapi_layout_test_plugin/TestObject.cpp (working copy)
@@ -34,7 +34,9 @@
static bool testGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant);
static NPObject *testAllocate(NPP npp, NPClass *theClass);
static void testDeallocate(NPObject *obj);
+static bool testConstruct(NPObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result);
+
static NPClass testClass = {
NP_CLASS_STRUCT_VERSION,
testAllocate,
@@ -47,7 +49,8 @@
testGetProperty,
0,
0,
- testEnumerate
+ testEnumerate,
+ testConstruct
};
NPClass *getTestClass(void)
@@ -63,18 +66,22 @@
static bool identifiersInitialized = false;
-#define NUM_TEST_IDENTIFIERS 4
-#define ID_PROPERTY_FOO 0
-#define ID_PROPERTY_BAR 1
-#define ID_PROPERTY_TEST_OBJECT 2
-#define ID_PROPERTY_REF_COUNT 3
+#define NUM_ENUMERABLE_TEST_IDENTIFIERS 4
+#define NUM_TEST_IDENTIFIERS 5
+#define ID_PROPERTY_FOO 0
+#define ID_PROPERTY_BAR 1
+#define ID_PROPERTY_TEST_OBJECT 2
+#define ID_PROPERTY_REF_COUNT 3
+#define ID_PROPERTY_OBJECT_POINTER 4
+
static NPIdentifier testIdentifiers[NUM_TEST_IDENTIFIERS];
static const NPUTF8 *testIdentifierNames[NUM_TEST_IDENTIFIERS] = {
"foo",
"bar",
"testObject",
"refCount",
+ "objectPointer",
};
static void initializeIdentifiers(void)
@@ -144,18 +151,31 @@
} else if (name == testIdentifiers[ID_PROPERTY_REF_COUNT]) {
INT32_TO_NPVARIANT(obj->referenceCount, *variant);
return true;
+ } else if (name == testIdentifiers[ID_PROPERTY_OBJECT_POINTER]) {
+ int32_t objectPointer = static_cast<int32_t>(reinterpret_cast<long long>(obj));
+ INT32_TO_NPVARIANT(objectPointer, *variant);
+ return true;
}
return false;
}
static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count)
{
- *count = NUM_TEST_IDENTIFIERS;
+ *count = NUM_ENUMERABLE_TEST_IDENTIFIERS;
- *value = (NPIdentifier*)browser->memalloc(NUM_TEST_IDENTIFIERS * sizeof(NPIdentifier));
- memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_TEST_IDENTIFIERS);
+ *value = (NPIdentifier*)browser->memalloc(NUM_ENUMERABLE_TEST_IDENTIFIERS * sizeof(NPIdentifier));
+ memcpy(*value, testIdentifiers, sizeof(NPIdentifier) * NUM_ENUMERABLE_TEST_IDENTIFIERS);
return true;
}
+static bool testConstruct(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ browser->retainobject(npobj);
+ // Just return the same object.
+ OBJECT_TO_NPVARIANT(npobj, *result);
+ return true;
+}
+
+
« no previous file with comments | « webkit/tools/layout_tests/test_expectations.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698