[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / plugins / embed-attributes-setting.html
1 <html>
2 <head>
3 <script>
4 function print(message, color) 
5 {
6     var paragraph = document.createElement("div");
7     paragraph.appendChild(document.createTextNode(message));
8     paragraph.style.fontFamily = "monospace";
9     if (color)
10         paragraph.style.color = color;
11     document.getElementById("console").appendChild(paragraph);
12 }
13
14 function write(s)
15 {
16     document.getElementById('pre').appendChild(document.createTextNode(s));
17 }
18
19 function shouldBe(a, b)
20 {
21     var evalA = eval(a);
22     if (evalA == b)
23         print("PASS: " + a + " should be " + b + " and is.", "green");
24     else
25         print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
26 }
27
28 var embed;
29
30 function test() 
31 {
32     if (window.layoutTestController)
33         layoutTestController.dumpAsText();
34         
35     embed = document.getElementById('embed');
36     print("[Embed is element specified in markup]");
37
38     embed.align = 1;
39     embed.height = 1;
40     embed.name = 1;
41     embed.width = 1;
42     embed.type = 1; // setting the type attribute should not effect the plugin once loaded
43     embed.src = 1; // setting the source attribute should not effect the plugin once loaded
44
45     shouldBe("embed.getAttribute('align')", 1);
46     shouldBe("embed.getAttribute('height')", 1);
47     shouldBe("embed.getAttribute('name')", 1);
48     shouldBe("embed.getAttribute('width')", 1);
49     shouldBe("embed.getAttribute('type')", 1);
50     shouldBe("embed.getAttribute('src')", 1);
51     shouldBe("typeof embed.testCallback", "function");
52
53     print("----------");
54     
55     embed = document.createElement('embed');
56     print("[Embed is dynamically created element with only type specified]");
57
58     embed.style.visibility = "hidden";
59     embed.type = "application/x-webkit-test-netscape";
60     document.body.appendChild(embed);
61     shouldBe("typeof embed.testCallback", "function");
62     
63     print("----------");
64     
65     embed = document.createElement('embed');
66     print("[Embed is dynamically created element with only src specified]");
67
68     embed.style.visibility = "hidden";
69     embed.src = "resources/test.testnetscape";
70     document.body.appendChild(embed);
71     shouldBe("typeof embed.testCallback", "function");
72 }
73 </script>
74 </head>
75
76 <body onload="test();">
77
78 <hr>
79 <div id='console'></div>
80
81 <embed style="visibility: hidden" type="application/x-webkit-test-netscape" id='embed'></embed>
82
83 </body>
84 </html>