blob: 8e835742dabb7c84339346572a03da0def18ae02 [file] [log] [blame]
zecke@webkit.org1fccd862009-05-20 17:35:22 +00001<html>
2<head>
3<script>
4function doTest()
5{
rniwa@webkit.org5cf7fa82012-06-15 07:38:37 +00006 if (window.testRunner)
7 testRunner.dumpAsText();
zecke@webkit.org1fccd862009-05-20 17:35:22 +00008
9 var plugin = document.getElementById("testPlugin");
10 var console = document.getElementById("console");
11
12 var o = { internalFunction : Object, doStuff: function() {return 20;}, stringProperty : 'str', nullProperty : null, undefinedProperty : undefined };
13
14 function report(property, result, expected) {
15 if (result !== expected) {
16 console.innerHTML += "FAILURE: " + property + "<br/>";
17 } else {
18 console.innerHTML += "SUCCESS: " + property + "<br/>";
19 }
20 }
21
22 function shouldBeFunction(property, expected) {
23 report(property, plugin.testHasMethod(o, property), expected);
24 }
25
26 function shouldBeProperty(property, expected) {
27 report(property, plugin.testHasProperty(o, property), expected);
28 }
29
30 /* test hasmethod */
31 console.innerHTML += "Testing hasmethod<br />";
32 shouldBeFunction("internalFunction", true);
33 shouldBeFunction("doStuff", true);
34 shouldBeFunction("undefinedProperty", false);
35
36 /* test hasproperty */
37 console.innerHTML += "<br />Testing hasproperty<br />";
38 shouldBeProperty("internalFunction", true);
39 shouldBeProperty("doStuff", true);
40 shouldBeProperty("stringProperty", true);
41 shouldBeProperty("nullProperty", true);
42 shouldBeProperty("undefinedProperty", true);
43 shouldBeProperty("notDefinedProperty", false);
44}
45</script>
46</head>
47<body onload="doTest();">
48<p>Test if the plugin can properly invoke the browserfuncs</p>
49<embed id="testPlugin" type="application/x-webkit-test-netscape"></embed>
50<div id="console"></div>
51</body>
52</html>