Backout Bug 454781
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Fri, 31 Oct 2008 15:26:17 +0200
changeset 21145 94209029c870e6d7293cc4cdd44112fd71e88c55
parent 21144 f1bb0f862b5b6b7afb3988df60affc5f8be23c71
child 21146 4c45de52678232061c68812946ef4baf12081b2a
push id3352
push useropettay@mozilla.com
push dateFri, 31 Oct 2008 13:26:30 +0000
treeherdermozilla-central@94209029c870 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs454781
milestone1.9.1b2pre
Backout Bug 454781
testing/mochitest/harness-overlay.xul
testing/mochitest/server.js
testing/mochitest/tests/SimpleTest/TestRunner.js
--- a/testing/mochitest/harness-overlay.xul
+++ b/testing/mochitest/harness-overlay.xul
@@ -41,18 +41,21 @@
       var srvScope = {};
       scriptLoader.loadSubScript("chrome://mochikit/content/server.js",
                                  srvScope);
 
       // generate our test list
       srvScope.makeTags();
       var url = "chrome://mochikit/content/" + dir + "/";
       var [links, count] = srvScope.list(url, chromeDir, true);
-      var tableContent = srvScope.linksToTableRows(links, 0);
+      var listContent = srvScope.linksToListItems(links);
+      var tableContent = srvScope.linksToTableRows(links);
       function populate() {
+        $("list-holder").setAttribute("rowspan", 1 + count);
+        $("test-list").innerHTML += listContent;
         $("test-table").innerHTML += tableContent;
         $("wrapper").innerHTML += " "; // redraw the table
       }
       gTestList = eval(srvScope.jsonArrayOfTestFiles(links));
       populate();
       hookup();
 
       // if we got passed a test path, just run that single test
@@ -91,17 +94,19 @@
           <br />
         </div>
         <div id="wrapper">
           <table cellpadding="0" cellspacing="0" id="test-table">
             <tr>
               <td>Passed</td>
               <td>Failed</td>
               <td>Todo</td>
-              <td>Test Files</td>
+              <td id="list-holder">
+                <ul class="top" id="test-list"><li><b>Test Files</b></li></ul>
+              </td>
             </tr>
           </table>
         </div>
       </div>
     </body>
   </vbox>
 </window>
 
--- a/testing/mochitest/server.js
+++ b/testing/mochitest/server.js
@@ -394,55 +394,30 @@ function linksToListItems(links)
 
   }
   return response;
 }
 
 /**
  * Transform nested hashtables of paths to a flat table rows.
  */
-function linksToTableRows(links, recursionLevel)
+function linksToTableRows(links)
 {
   var response = "";
   for (var [link, value] in links) {
     var classVal = (!isTest(link) && !(value instanceof Object))
       ? "non-test invisible"
       : "";
-
-    spacer = "padding-left: " + (10 * recursionLevel) + "px";
-
     if (value instanceof Object) {
       response += TR({class: "dir", id: "tr-" + link },
-                     TD({colspan: "3"}, "&#160;"),
-                     TD({style: spacer},
-                        A({href: link}, link)));
-      response += linksToTableRows(value, recursionLevel + 1);
+                     TD({colspan: "3"},"&#160;"));
+      response += linksToTableRows(value);
     } else {
-      var bug_title = link.match(/test_bug\S+/);
-      var bug_num = null;
-      if (bug_title != null) {
-          bug_num = bug_title[0].match(/\d+/);
-      }
-      if ((bug_title == null) || (bug_num == null)) {
-        response += TR({class: classVal, id: "tr-" + link },
-                       TD("0"),
-                       TD("0"),
-                       TD("0"),
-                       TD({style: spacer},
-                          A({href: link}, link)));
-      } else {
-        var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bug_num;
-        response += TR({class: classVal, id: "tr-" + link },
-                       TD("0"),
-                       TD("0"),
-                       TD("0"),
-                       TD({style: spacer},
-                          A({href: link}, link), " - ",
-                          A({href: bug_url}, "Bug " + bug_num)));
-      }
+      response += TR({class: classVal, id: "tr-" + link},
+                     TD("0"), TD("0"), TD("0"));
     }
   }
   return response;
 }
 
 function arrayOfTestFiles(linkArray, fileArray, testPattern) {
   for (var [link, value] in linkArray) {
     if (value instanceof Object) {
@@ -544,18 +519,25 @@ function testListing(metadata, response)
           ),
           DIV({class: "clear"}),
           DIV({class: "toggle"},
             A({href: "#", id: "toggleNonTests"}, "Show Non-Tests"),
             BR()
           ),
     
           TABLE({cellpadding: 0, cellspacing: 0, id: "test-table"},
-            TR(TD("Passed"), TD("Failed"), TD("Todo"), TD("Test Files")),
-            linksToTableRows(links, 0)
+            TR(TD("Passed"), TD("Failed"), TD("Todo"), 
+                TD({rowspan: count+1},
+                   UL({class: "top"},
+                      LI(B("Test Files")),        
+                      linksToListItems(links)
+                      )
+                )
+            ),
+            linksToTableRows(links)
           ),
           DIV({class: "clear"})
         )
       )
     )
   );
 }
 
--- a/testing/mochitest/tests/SimpleTest/TestRunner.js
+++ b/testing/mochitest/tests/SimpleTest/TestRunner.js
@@ -192,16 +192,17 @@ TestRunner.updateUI = function() {
   } else if (passCount > 0) {
     indicator.innerHTML = "Status: Pass";
     indicator.style.backgroundColor = "green";
   }
 
   // Set the table values
   var trID = "tr-" + $('current-test-path').innerHTML;
   var row = $(trID);
-  var tds = row.getElementsByTagName("td");
-  tds[0].style.backgroundColor = results.notOK > 0 ? "#f00" : "#0d0";
-  tds[0].textContent = results.OK;
-  tds[1].style.backgroundColor = results.notOK > 0 ? "#f00" : "#0d0";
-  tds[1].textContent = results.notOK;
-  tds[2].style.backgroundColor = results.todo > 0 ? "orange" : "#0d0";
-  tds[2].textContent = results.todo;
+  replaceChildNodes(row,
+    TD({'style':
+        {'backgroundColor': results.notOK > 0 ? "#f00":"#0d0"}}, results.OK),
+    TD({'style':
+        {'backgroundColor': results.notOK > 0 ? "#f00":"#0d0"}}, results.notOK),
+    TD({'style': {'backgroundColor':
+                   results.todo > 0 ? "orange":"#0d0"}}, results.todo)
+  );
 }