53 lines
1.6 KiB
HTML
53 lines
1.6 KiB
HTML
<html>
|
|
<head>
|
|
<script>
|
|
function doTest()
|
|
{
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
var plugin = document.getElementById("testPlugin");
|
|
var console = document.getElementById("console");
|
|
|
|
var o = { internalFunction : Object, doStuff: function() {return 20;}, stringProperty : 'str', nullProperty : null, undefinedProperty : undefined };
|
|
|
|
function report(property, result, expected) {
|
|
if (result !== expected) {
|
|
console.innerHTML += "FAILURE: " + property + "<br/>";
|
|
} else {
|
|
console.innerHTML += "SUCCESS: " + property + "<br/>";
|
|
}
|
|
}
|
|
|
|
function shouldBeFunction(property, expected) {
|
|
report(property, plugin.testHasMethod(o, property), expected);
|
|
}
|
|
|
|
function shouldBeProperty(property, expected) {
|
|
report(property, plugin.testHasProperty(o, property), expected);
|
|
}
|
|
|
|
/* test hasmethod */
|
|
console.innerHTML += "Testing hasmethod<br />";
|
|
shouldBeFunction("internalFunction", true);
|
|
shouldBeFunction("doStuff", true);
|
|
shouldBeFunction("undefinedProperty", false);
|
|
|
|
/* test hasproperty */
|
|
console.innerHTML += "<br />Testing hasproperty<br />";
|
|
shouldBeProperty("internalFunction", true);
|
|
shouldBeProperty("doStuff", true);
|
|
shouldBeProperty("stringProperty", true);
|
|
shouldBeProperty("nullProperty", true);
|
|
shouldBeProperty("undefinedProperty", true);
|
|
shouldBeProperty("notDefinedProperty", false);
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="doTest();">
|
|
<p>Test if the plugin can properly invoke the browserfuncs</p>
|
|
<embed id="testPlugin" type="application/x-webkit-test-netscape"></embed>
|
|
<div id="console"></div>
|
|
</body>
|
|
</html>
|