Bug 513162 - Add support for 'chromemargin' property on XUL windows. r=smaug.
[mozilla-central.git] / testing / mochitest / harness-overlay.xul
blob49bcd9904f06a1be505b9add26463ec1eb7c514d
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
4 <overlay id="browserTestOverlay"
5 xmlns:html="http://www.w3.org/1999/xhtml"
6 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
7 xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <window>
10 <script type="application/javascript"
11 src="chrome://mochikit/content/MochiKit/packed.js" />
12 <script type="text/javascript"
13 src="chrome://mochikit/content/tests/SimpleTest/TestRunner.js"/>
14 <script type="text/javascript"
15 src="chrome://mochikit/content/tests/SimpleTest/MozillaFileLogger.js"/>
16 <script type="text/javascript"
17 src="chrome://mochikit/content/tests/SimpleTest/quit.js" />
18 <script type="text/javascript"
19 src="chrome://mochikit/content/tests/SimpleTest/setup.js" />
20 <script type="application/javascript;version=1.7"><![CDATA[
21 function loadTests()
23 window.removeEventListener("load", loadTests, false);
25 var dir = document.documentElement.getAttribute('directory');
26 var url = "chrome://mochikit/content/" + dir + "/";
27 // Find our chrome dir
28 var ios = Cc["@mozilla.org/network/io-service;1"].
29 getService(Ci.nsIIOService);
30 var chromeURI = ios.newURI("chrome://mochikit/content/",
31 null, null);
32 var resolvedURI = Cc["@mozilla.org/chrome/chrome-registry;1"].
33 getService(Ci.nsIChromeRegistry).
34 convertChromeURL(chromeURI);
35 var fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
36 getService(Ci.nsIFileProtocolHandler);
37 var chromeDir = fileHandler.getFileFromURLSpec(resolvedURI.spec);
38 chromeDir = chromeDir.parent.QueryInterface(Ci.nsILocalFile);
39 chromeDir.appendRelativePath(dir);
41 var singleTestPath;
42 if ("testPath" in params && params.testPath) {
43 var extraPath = params.testPath;
44 var pathToCheck = chromeDir.clone().QueryInterface(Ci.nsILocalFile);
45 var pathIsFile = false;
46 try {
47 var pathParts = extraPath.toString().split("/");
48 for each (var part in pathParts) {
49 pathToCheck.append(part);
51 if (pathToCheck.isDirectory()) {
52 for each (var part in pathParts) {
53 chromeDir.append(part);
55 url += extraPath + "/";
57 else {
58 pathIsFile = true;
61 catch (e) {
62 pathIsFile = true;
64 if (pathIsFile) {
65 singleTestPath = url + params.testPath;
68 // load server.js in so we can share template functions
69 var scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
70 getService(Ci.mozIJSSubScriptLoader);
71 var srvScope = {};
72 scriptLoader.loadSubScript("chrome://mochikit/content/server.js",
73 srvScope);
75 // generate our test list
76 srvScope.makeTags();
77 var [links, count] = srvScope.list(url, chromeDir, true);
78 var tableContent = srvScope.linksToTableRows(links, 0);
79 function populate() {
80 $("test-table").innerHTML += tableContent;
82 gTestList = eval(srvScope.jsonArrayOfTestFiles(links));
83 populate();
84 hookup();
86 // if we got passed a test path, just run that single test
87 if (singleTestPath)
88 window.location.href = singleTestPath;
91 window.addEventListener("load", loadTests, false);
92 ]]>
93 </script>
95 <vbox>
96 <button label="Run Chrome Tests" id="runtests" flex="1"/>
98 <body xmlns="http://www.w3.org/1999/xhtml" id="xulharness">
99 <div class="container">
100 <p style="float:right;">
101 <small>Based on the MochiKit unit tests.</small>
102 </p>
103 <div class="status">
104 <h1 id="indicator">Status</h1>
105 <h2 id="pass">Passed: <span id="pass-count">0</span></h2>
106 <h2 id="fail">Failed: <span id="fail-count">0</span></h2>
107 <h2 id="fail">Todo: <span id="todo-count">0</span></h2>
108 </div>
109 <div class="clear"></div>
110 <div id="current-test">
111 <b>Currently Executing: <span id="current-test-path">_</span></b>
112 </div>
113 <div class="clear"></div>
114 <div class="frameholder">
115 <iframe scrolling="no" id="testframe" width="500"></iframe>
116 </div>
117 <div class="clear"></div>
118 <div class="toggle">
119 <a href="#" id="toggleNonTests">Show Non-Tests</a>
120 <br />
121 </div>
122 <div id="wrapper">
123 <table cellpadding="0" cellspacing="0">
124 <!-- tbody needed to avoid bug 494546 causing performance problems -->
125 <tbody id="test-table">
126 <tr>
127 <td>Passed</td>
128 <td>Failed</td>
129 <td>Todo</td>
130 <td>Test Files</td>
131 </tr>
132 </tbody>
133 </table>
134 </div>
135 </div>
136 </body>
137 </vbox>
138 </window>
140 </overlay>