mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Tests for bug 532246, r=jst
This commit is contained in:
parent
86980c504e
commit
43b7734985
@ -65,6 +65,7 @@ _MOCHITEST_FILES = \
|
||||
test_pluginstream_poststream.html \
|
||||
test_pluginstream_seek.html \
|
||||
test_pluginstream_newstream.html \
|
||||
test_multipleinstanceobjects.html \
|
||||
test_streamNotify.html \
|
||||
test_instantiation.html \
|
||||
$(NULL)
|
||||
|
@ -0,0 +1,23 @@
|
||||
<head>
|
||||
<title>NPNV*NPObject accessibility tests</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<body onload="runTests()">
|
||||
<embed id="plugin1" type="application/x-test" width="400" height="400"></embed>
|
||||
<embed id="plugin2" type="application/x-test" width="400" height="400"></embed>
|
||||
|
||||
<script class="testbody" type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function runTests() {
|
||||
var p1 = document.getElementById('plugin1');
|
||||
var p2 = document.getElementById('plugin2');
|
||||
|
||||
var o = p1.getObjectValue();
|
||||
ok(p1.checkObjectValue(o), "Plugin objects passed to the same instance are identical.");
|
||||
ok(!p2.checkObjectValue(o), "Plugin objects passed to another instance are double-wrapped.");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
@ -74,6 +74,13 @@ arguments passed to the method.
|
||||
|
||||
* .crash() - Crashes the plugin
|
||||
|
||||
* getObjectValue() - Returns a custom plugin-implemented scriptable object.
|
||||
* checkObjectValue(obj) - Returns true if the object from setObjectValue() is
|
||||
the same object passed into this function. It should return true when
|
||||
the object is passed to the same plugin instance, and false when passed
|
||||
to other plugin instances, see bug 532246 and
|
||||
test_multipleinstanceobjects.html.
|
||||
|
||||
== Private browsing ==
|
||||
|
||||
The test plugin object supports the following scriptable methods:
|
||||
|
@ -131,6 +131,9 @@ static bool convertPointY(NPObject* npobj, const NPVariant* args, uint32_t argCo
|
||||
static bool streamTest(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool crashPlugin(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool crashOnDestroy(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
static bool checkObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
|
||||
|
||||
|
||||
static const NPUTF8* sPluginMethodIdentifierNames[] = {
|
||||
"npnEvaluateTest",
|
||||
@ -162,6 +165,8 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = {
|
||||
"streamTest",
|
||||
"crash",
|
||||
"crashOnDestroy",
|
||||
"getObjectValue",
|
||||
"checkObjectValue",
|
||||
};
|
||||
static NPIdentifier sPluginMethodIdentifiers[ARRAY_LENGTH(sPluginMethodIdentifierNames)];
|
||||
static const ScriptableFunction sPluginMethodFunctions[ARRAY_LENGTH(sPluginMethodIdentifierNames)] = {
|
||||
@ -194,6 +199,8 @@ static const ScriptableFunction sPluginMethodFunctions[ARRAY_LENGTH(sPluginMetho
|
||||
streamTest,
|
||||
crashPlugin,
|
||||
crashOnDestroy,
|
||||
getObjectValue,
|
||||
checkObjectValue,
|
||||
};
|
||||
|
||||
struct URLNotifyData
|
||||
@ -2127,3 +2134,37 @@ void notifyDidPaint(InstanceData* instanceData)
|
||||
++instanceData->paintCount;
|
||||
instanceData->widthAtLastPaint = instanceData->window.width;
|
||||
}
|
||||
|
||||
static const NPClass kTestSharedNPClass = {
|
||||
NP_CLASS_STRUCT_VERSION,
|
||||
// Everything else is NULL
|
||||
};
|
||||
|
||||
static bool getObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
|
||||
|
||||
NPObject* o = NPN_CreateObject(npp,
|
||||
const_cast<NPClass*>(&kTestSharedNPClass));
|
||||
if (!o)
|
||||
return false;
|
||||
|
||||
OBJECT_TO_NPVARIANT(o, *result);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool checkObjectValue(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
|
||||
{
|
||||
VOID_TO_NPVARIANT(*result);
|
||||
|
||||
if (1 != argCount)
|
||||
return false;
|
||||
|
||||
if (!NPVARIANT_IS_OBJECT(args[0]))
|
||||
return false;
|
||||
|
||||
NPObject* o = NPVARIANT_TO_OBJECT(args[0]);
|
||||
|
||||
BOOLEAN_TO_NPVARIANT(o->_class == &kTestSharedNPClass, *result);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user