summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-01 21:00:45 +0000
committerjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-01 21:00:45 +0000
commit95ed7f6967a53e19aaa1027bf0bec4f7bef4886c (patch)
treeb79d2171a624ccf47ec5ce97829394c50ff80f8c
parente3da3002a3ff02537220ecd56d166c0e2eeca511 (diff)
downloadchromium_src-95ed7f6967a53e19aaa1027bf0bec4f7bef4886c.zip
chromium_src-95ed7f6967a53e19aaa1027bf0bec4f7bef4886c.tar.gz
chromium_src-95ed7f6967a53e19aaa1027bf0bec4f7bef4886c.tar.bz2
Implement testHasProperty and testHasMethod in the test plugin
BUG=12354 TEST=plugins/netscape-invoke-browserfuncs.html Review URL: http://codereview.chromium.org/259002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27765 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt1
-rw-r--r--webkit/tools/npapi_layout_test_plugin/PluginObject.cpp50
2 files changed, 44 insertions, 7 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 1d20751..f50bbee 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -1902,7 +1902,6 @@ BUG12310 SKIP : LayoutTests/fast/wcss/marquee-style.xhtml = FAIL
// Details for all of these are in the bugs.
BUG12341 DEBUG WIN : LayoutTests/editing/selection/4975120.html = PASS FAIL
-BUG12354 : LayoutTests/plugins/netscape-invoke-browserfuncs.html = FAIL
BUG12361 : LayoutTests/http/tests/cookies/double-quoted-value-with-semi-colon.html = FAIL
// webkit 44010+44027 introducted new tests
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
index 2bfab8f..be6c988 100644
--- a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
@@ -108,7 +108,9 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
#define ID_TEST_CALLBACK_AND_GET_VALUE 20
#define ID_TEST_CONSTRUCT 21
#define ID_DESTROY_NULL_STREAM 22
-#define NUM_METHOD_IDENTIFIERS 23
+#define ID_TEST_HAS_PROPERTY 23
+#define ID_TEST_HAS_METHOD 24
+#define NUM_METHOD_IDENTIFIERS 25
static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
@@ -136,6 +138,8 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testCallbackAndGetValue",
"testConstruct",
"destroyNullStream",
+ "testHasProperty",
+ "testHasMethod"
};
static NPUTF8* createCStringFromNPVariant(const NPVariant* variant)
@@ -419,6 +423,36 @@ static bool destroyNullStream(PluginObject* obj, const NPVariant* args, uint32_t
return true;
}
+static bool testHasProperty(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_STRING(args[1]))
+ return false;
+
+ NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
+ NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
+ free(propertyString);
+
+ bool retval = browser->hasproperty(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier);
+
+ BOOLEAN_TO_NPVARIANT(retval, *result);
+ return true;
+}
+
+static bool testHasMethod(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
+{
+ if (argCount != 2 || !NPVARIANT_IS_OBJECT(args[0]) || !NPVARIANT_IS_STRING(args[1]))
+ return false;
+
+ NPUTF8* propertyString = createCStringFromNPVariant(&args[1]);
+ NPIdentifier propertyIdentifier = browser->getstringidentifier(propertyString);
+ free(propertyString);
+
+ bool retval = browser->hasmethod(obj->npp, NPVARIANT_TO_OBJECT(args[0]), propertyIdentifier);
+
+ BOOLEAN_TO_NPVARIANT(retval, *result);
+ return true;
+}
+
static bool testEnumerate(PluginObject* obj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount == 2 && NPVARIANT_IS_OBJECT(args[0]) && NPVARIANT_IS_OBJECT(args[1])) {
@@ -745,12 +779,16 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return true;
}
} else if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_AND_GET_VALUE]) {
- return testCallbackAndGetValue(plugin, args, argCount, result);
+ return testCallbackAndGetValue(plugin, args, argCount, result);
} else if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT]) {
- return testConstruct(plugin, args, argCount, result);
- } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
- return destroyNullStream(plugin, args, argCount, result);
-
+ return testConstruct(plugin, args, argCount, result);
+ } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
+ return destroyNullStream(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_HAS_PROPERTY])
+ return testHasProperty(plugin, args, argCount, result);
+ else if (name == pluginMethodIdentifiers[ID_TEST_HAS_METHOD])
+ return testHasMethod(plugin, args, argCount, result);
+
return false;
}