blob: 04b0ffc8893549ddf3450e45a0e95923731cfe52 [file] [log] [blame]
<html>
<head>
<script>
function doTest()
{
if (window.layoutTestController)
layoutTestController.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>