summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 18:51:56 +0000
committerjaphet@chromium.org <japhet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 18:51:56 +0000
commit2c0b466198a33ea157f17d1b4f005546ba134082 (patch)
tree1a12782d5cc784b776b5380abd279fe5d7052299 /webkit
parent9b5fd424c6699472c8c93bbc17fcf0c2c85ae765 (diff)
downloadchromium_src-2c0b466198a33ea157f17d1b4f005546ba134082.zip
chromium_src-2c0b466198a33ea157f17d1b4f005546ba134082.tar.gz
chromium_src-2c0b466198a33ea157f17d1b4f005546ba134082.tar.bz2
Implement interface for testing exceptions in the test plugin.
BUG=6735 TEST=LayoutTests/plugins/netscape-throw-exception.html Review URL: http://codereview.chromium.org/255092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28281 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt3
-rw-r--r--webkit/tools/npapi_layout_test_plugin/PluginObject.cpp68
-rw-r--r--webkit/tools/npapi_layout_test_plugin/TestObject.cpp47
3 files changed, 77 insertions, 41 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index b9318ec..650334c 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -807,8 +807,6 @@ BUG10280 WIN LINUX : LayoutTests/fast/inline/dirtyLinesForInline.html = FAIL PAS
BUG20507 : LayoutTests/http/tests/uri/resolve-encoding-relative.html = FAIL
-BUG6735 : LayoutTests/plugins/netscape-throw-exception.html = FAIL
-
BUG10432 WIN LINUX : LayoutTests/fast/overflow/004.html = FAIL
BUG9071 MAC WIN DEBUG SLOW : LayoutTests/editing/selection/drag-to-contenteditable-iframe.html = FAIL PASS
@@ -1315,6 +1313,7 @@ BUG10351 MAC : LayoutTests/plugins/netscape-get-property-return-value.html = FAI
BUG10351 MAC : LayoutTests/plugins/netscape-identifier-conversion.html = FAIL
BUG10351 MAC : LayoutTests/plugins/netscape-invoke-browserfuncs.html = FAIL
BUG10351 MAC : LayoutTests/plugins/netscape-invoke-default.html = FAIL
+BUG10351 MAC : LayoutTests/plugins/netscape-throw-exception.html = FAIL
BUG10351 MAC : LayoutTests/plugins/npruntime.html = TIMEOUT
BUG10351 MAC : LayoutTests/plugins/plugin-remove-subframe.html = FAIL
BUG10351 MAC : LayoutTests/plugins/return-error-from-new-stream-doesnt-invoke-destroy-stream.html = TIMEOUT
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
index 1a72899..0e21a09 100644
--- a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
@@ -85,32 +85,35 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
"testObjectCount",
};
-#define ID_TEST_CALLBACK_METHOD 0
-#define ID_TEST_GETURL 1
-#define ID_REMOVE_DEFAULT_METHOD 2
-#define ID_TEST_DOM_ACCESS 3
-#define ID_TEST_GET_URL_NOTIFY 4
-#define ID_TEST_INVOKE_DEFAULT 5
-#define ID_DESTROY_STREAM 6
-#define ID_TEST_ENUMERATE 7
-#define ID_TEST_GETINTIDENTIFIER 8
-#define ID_TEST_GET_PROPERTY 9
-#define ID_TEST_EVALUATE 10
-#define ID_TEST_GET_PROPERTY_RETURN_VALUE 11
-#define ID_TEST_CALLBACK_METHOD_RET 12
-#define ID_TEST_CREATE_TEST_OBJECT 13
-#define ID_TEST_PASS_TEST_OBJECT 14
-#define ID_TEST_CLONE_OBJECT 15
-#define ID_TEST_SCRIPT_OBJECT_INVOKE 16
-#define ID_TEST_IDENTIFIER_TO_STRING 17
-#define ID_TEST_IDENTIFIER_TO_INT 18
-#define ID_TEST_POSTURL_FILE 19
-#define ID_TEST_CALLBACK_AND_GET_VALUE 20
-#define ID_TEST_CONSTRUCT 21
-#define ID_DESTROY_NULL_STREAM 22
-#define ID_TEST_HAS_PROPERTY 23
-#define ID_TEST_HAS_METHOD 24
-#define NUM_METHOD_IDENTIFIERS 25
+enum {
+ ID_TEST_CALLBACK_METHOD = 0,
+ ID_TEST_GETURL,
+ ID_REMOVE_DEFAULT_METHOD,
+ ID_TEST_DOM_ACCESS,
+ ID_TEST_GET_URL_NOTIFY,
+ ID_TEST_INVOKE_DEFAULT,
+ ID_DESTROY_STREAM,
+ ID_TEST_ENUMERATE,
+ ID_TEST_GETINTIDENTIFIER,
+ ID_TEST_GET_PROPERTY,
+ ID_TEST_EVALUATE,
+ ID_TEST_GET_PROPERTY_RETURN_VALUE,
+ ID_TEST_CALLBACK_METHOD_RET,
+ ID_TEST_CREATE_TEST_OBJECT,
+ ID_TEST_PASS_TEST_OBJECT,
+ ID_TEST_CLONE_OBJECT,
+ ID_TEST_SCRIPT_OBJECT_INVOKE,
+ ID_TEST_IDENTIFIER_TO_STRING,
+ ID_TEST_IDENTIFIER_TO_INT,
+ ID_TEST_POSTURL_FILE,
+ ID_TEST_CALLBACK_AND_GET_VALUE,
+ ID_TEST_CONSTRUCT,
+ ID_DESTROY_NULL_STREAM,
+ ID_TEST_HAS_PROPERTY,
+ ID_TEST_HAS_METHOD,
+ ID_TEST_THROW_EXCEPTION_METHOD,
+ NUM_METHOD_IDENTIFIERS
+};
static NPIdentifier pluginMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
@@ -139,7 +142,8 @@ static const NPUTF8 *pluginMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
"testConstruct",
"destroyNullStream",
"testHasProperty",
- "testHasMethod"
+ "testHasMethod",
+ "testThrowException"
};
static NPUTF8* createCStringFromNPVariant(const NPVariant* variant)
@@ -778,16 +782,20 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
}
return true;
}
- } else if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_AND_GET_VALUE]) {
+ } else if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_AND_GET_VALUE])
return testCallbackAndGetValue(plugin, args, argCount, result);
- } else if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT]) {
+ else if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT])
return testConstruct(plugin, args, argCount, result);
- } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
+ 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);
+ else if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) {
+ browser->setexception(header, "plugin object testThrowException SUCCESS");
+ return true;
+ }
return false;
}
diff --git a/webkit/tools/npapi_layout_test_plugin/TestObject.cpp b/webkit/tools/npapi_layout_test_plugin/TestObject.cpp
index edf3a856..a839c1e 100644
--- a/webkit/tools/npapi_layout_test_plugin/TestObject.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/TestObject.cpp
@@ -28,13 +28,15 @@
#include <stdlib.h>
-static bool testEnumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count);
-static bool testInvokeDefault(NPObject *obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
-static bool testHasProperty(NPObject *obj, NPIdentifier name);
-static bool testGetProperty(NPObject *obj, NPIdentifier name, NPVariant *variant);
+static bool testEnumerate(NPObject*, NPIdentifier **value, uint32_t *count);
+static bool testHasMethod(NPObject*, NPIdentifier name);
+static bool testInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result);
+static bool testInvokeDefault(NPObject*, const NPVariant *args, uint32_t argCount, NPVariant *result);
+static bool testHasProperty(NPObject*, NPIdentifier name);
+static bool testGetProperty(NPObject*, 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 void testDeallocate(NPObject*);
+static bool testConstruct(NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result);
static NPClass testClass = {
@@ -42,8 +44,8 @@ static NPClass testClass = {
testAllocate,
testDeallocate,
0,
- 0,
- 0,
+ testHasMethod,
+ testInvoke,
testInvokeDefault,
testHasProperty,
testGetProperty,
@@ -84,9 +86,18 @@ static const NPUTF8 *testIdentifierNames[NUM_TEST_IDENTIFIERS] = {
"objectPointer",
};
+#define ID_THROW_EXCEPTION_METHOD 0
+#define NUM_METHOD_IDENTIFIERS 1
+
+static NPIdentifier testMethodIdentifiers[NUM_METHOD_IDENTIFIERS];
+static const NPUTF8 *testMethodIdentifierNames[NUM_METHOD_IDENTIFIERS] = {
+ "throwException",
+};
+
static void initializeIdentifiers(void)
{
browser->getstringidentifiers(testIdentifierNames, NUM_TEST_IDENTIFIERS, testIdentifiers);
+ browser->getstringidentifiers(testMethodIdentifierNames, NUM_METHOD_IDENTIFIERS, testMethodIdentifiers);
}
static NPObject *testAllocate(NPP npp, NPClass *theClass)
@@ -113,6 +124,24 @@ static void testDeallocate(NPObject *obj)
free(obj);
}
+static bool testHasMethod(NPObject*, NPIdentifier name)
+{
+ for (unsigned i = 0; i < NUM_METHOD_IDENTIFIERS; i++) {
+ if (testMethodIdentifiers[i] == name)
+ return true;
+ }
+ return false;
+}
+
+static bool testInvoke(NPObject* header, NPIdentifier name, const NPVariant* /*args*/, uint32_t /*argCount*/, NPVariant* /*result*/)
+{
+ if (name == testMethodIdentifiers[ID_THROW_EXCEPTION_METHOD]) {
+ browser->setexception(header, "test object throwException SUCCESS");
+ return true;
+ }
+ return false;
+}
+
static bool testInvokeDefault(NPObject *obj, const NPVariant *args,
uint32_t argCount, NPVariant *result)
{
@@ -120,7 +149,7 @@ static bool testInvokeDefault(NPObject *obj, const NPVariant *args,
return true;
}
-static bool testHasProperty(NPObject *obj, NPIdentifier name)
+static bool testHasProperty(NPObject*, NPIdentifier name)
{
for (unsigned i = 0; i < NUM_TEST_IDENTIFIERS; i++) {
if (testIdentifiers[i] == name)