Backing out bug 454781 to investigate mochitest leaks.
authorJustin Dolske <dolske@mozilla.com>
Wed, 24 Sep 2008 17:18:55 -0700
changeset 19649 987e53507e4c4758bdf6f72e83841faf26ecedeb
parent 19647 4c3dccca850591a87a32073294c572ed9c5d27ac (current diff)
parent 19648 04a7c91e0f31b21d076ac52037ad6313dbefe0bd (diff)
child 19668 1edb4c4fee545939a8e44b8f63503cc2f8881c35
push idunknown
push userunknown
push dateunknown
bugs454781
milestone1.9.1b1pre
Backing out bug 454781 to investigate mochitest leaks.
--- 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)
+  );
 }