OLD | NEW |
1 <html><head> | 1 <html><head> |
2 <link rel="stylesheet" href="test_page.css"> | 2 <link rel="stylesheet" href="test_page.css"> |
3 <script> | 3 <script> |
| 4 function AdjustHeight() { |
| 5 // Called when a frame loads, so that we can adjust its height to the |
| 6 // minimize size required to not have to show a scrollbar. This works |
| 7 // because tests run to completion during the ViewChanged notification. |
| 8 var frame = event.target; |
| 9 var div = frame.contentDocument.getElementsByTagName("div")[0]; |
| 10 var height = frame.contentWindow.getComputedStyle(div).height; |
| 11 frame.style.height = height; |
| 12 } |
| 13 |
| 14 function AppendFrame(testcase, i) { |
| 15 var p = document.createElement("P"); |
| 16 p.setAttribute("class", "frame-container"); |
| 17 |
| 18 var title = document.createElement("H2"); |
| 19 title.appendChild(document.createTextNode(testcase)); |
| 20 p.appendChild(title); |
| 21 |
| 22 var frame = document.createElement("IFRAME"); |
| 23 frame.setAttribute("src", "?" + testcase); |
| 24 frame.setAttribute("onload", "AdjustHeight(); LoadNext(" + (i + 1) + ")"); |
| 25 p.appendChild(frame); |
| 26 |
| 27 document.body.appendChild(p); |
| 28 } |
| 29 |
| 30 function LoadNext(i) { |
| 31 var links = document.links; |
| 32 if (links.length > i) |
| 33 AppendFrame(links[i].firstChild.nodeValue, i); |
| 34 } |
| 35 |
| 36 function RunAll() { |
| 37 // Remove any existing frames. |
| 38 var existing = document.getElementsByClassName("frame-container"); |
| 39 while (existing.length) |
| 40 existing[0].parentNode.removeChild(existing[0]); |
| 41 |
| 42 // Add new frames for each test, but do so one frame at a time. |
| 43 LoadNext(0); |
| 44 } |
| 45 |
4 onload = function() { | 46 onload = function() { |
5 var mimeType = "application/x-ppapi-tests"; | 47 var mimeType = "application/x-ppapi-tests"; |
6 if (mimeType in navigator.mimeTypes) { | 48 if (mimeType in navigator.mimeTypes) { |
7 var testcase = location.search.substring(1); | 49 var testcase = location.search.substring(1); |
8 document.title = 'Test PPAPI ' + testcase; | 50 document.title = 'Test ' + testcase; |
9 | 51 |
10 var obj = document.createElement("OBJECT"); | 52 var obj = document.createElement("OBJECT"); |
11 obj.setAttribute("id", "plugin"); | 53 obj.setAttribute("id", "plugin"); |
12 obj.setAttribute("type", mimeType); | 54 obj.setAttribute("type", mimeType); |
13 obj.setAttribute("testcase", testcase); | 55 obj.setAttribute("testcase", testcase); |
14 document.getElementById("container").appendChild(obj); | 56 document.getElementById("container").appendChild(obj); |
15 } else { | 57 } else { |
16 document.getElementById("console").innerHTML = | 58 document.getElementById("console").innerHTML = |
17 '<span class="fail">FAIL</span>: ' + | 59 '<span class="fail">FAIL</span>: ' + |
18 '<span class="err_msg">Test plug-in is not registered.</span>'; | 60 '<span class="err_msg">Test plug-in is not registered.</span>'; |
19 } | 61 } |
20 } | 62 } |
21 </script> | 63 </script> |
22 </head><body> | 64 </head><body> |
23 <div id="container"></div> | 65 <div> |
24 <div id="console" /><span class="load_msg">loading...</span></div> | 66 <div id="container"></div> |
| 67 <div id="console" /><span class="load_msg">loading...</span></div> |
| 68 </div> |
25 </body></html> | 69 </body></html> |
OLD | NEW |