bug 579913 - testNet does not work properly, r=mossop
authorMihai Sucan <robodesign@gmail.com>
Wed, 21 Jul 2010 12:24:12 -0300
changeset 48003 0ff1f958c76b9525c91b1287daef246aff8bf052
parent 48002 e1aff29b6fd9c658cd6e25260656037dce7f6050
child 48004 a90e16166da9d9acd2cacf739e07e4807fa5df6a
push id14531
push userrcampbell@mozilla.com
push dateWed, 21 Jul 2010 15:24:47 +0000
treeherdermozilla-central@a90e16166da9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs579913
milestone2.0b3pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 579913 - testNet does not work properly, r=mossop
toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
--- a/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
@@ -238,46 +238,50 @@ function testConsoleLoggingAPI(aMethod)
   let jsterm = HUD.jsterm;
   let outputLogNode = jsterm.outputNode;
   ok(/foo bar/.test(outputLogNode.childNodes[0].childNodes[0].nodeValue),
     "Emitted both console arguments");
 }
 
 function testLogEntry(aOutputNode, aMatchString, aSuccessErrObj)
 {
-  executeSoon(function (){
-                var msgs = aOutputNode.childNodes;
-                for (var i = 0; i < msgs.length; i++) {
-                  var message = msgs[i].innerHTML.indexOf(aMatchString);
-                  if (message > -1) {
-                    ok(true, aSuccessErrObj.success);
-                    return;
-                  }
-                  else {
-                    throw new Error(aSuccessErrObj.err);
-                  }
-                }
-              });
+  var msgs = aOutputNode.childNodes;
+  for (var i = 0; i < msgs.length; i++) {
+    var message = msgs[i].innerHTML.indexOf(aMatchString);
+    if (message > -1) {
+      ok(true, aSuccessErrObj.success);
+      return;
+    }
+  }
+  throw new Error(aSuccessErrObj.err);
 }
 
 // test network logging
 function testNet()
 {
-  HUDService.activateHUDForContext(tab);
-  content.location = TEST_NETWORK_URI;
-  executeSoon(function () {
-    HUDService.setFilterState(hudId, "network", true);
-    filterBox.value = "";
+  HUDService.setFilterState(hudId, "network", true);
+  filterBox.value = "";
+
+  browser.addEventListener("DOMContentLoaded", function onTestNetLoad () {
+    browser.removeEventListener("DOMContentLoaded", onTestNetLoad, false);
+
     var successMsg =
       "Found the loggged network message referencing a js file";
     var errMsg = "Could not get logged network message for js file";
-    testLogEntry(outputNode,
-                 "Network:", { success: successMsg, err: errMsg });
-                 content.location.href = noCacheUriSpec(TEST_NETWORK_URI);
-  });
+
+    var display = HUDService.getDisplayByURISpec(TEST_NETWORK_URI);
+    var outputNode = display.querySelectorAll(".hud-output-node")[0];
+
+    testLogEntry(outputNode, "Network:",
+      { success: successMsg, err: errMsg });
+
+    testPageReload();
+  }, false);
+
+  content.location = TEST_NETWORK_URI;
 }
 
 function testOutputOrder()
 {
   let HUD = HUDService.hudWeakReferences[hudId].get();
   let jsterm = HUD.jsterm;
   let outputNode = jsterm.outputNode;
 
@@ -626,25 +630,23 @@ function test() {
       content.location.href = TEST_FILTER_URI;
 
       testConsoleLoggingAPI("log");
       testConsoleLoggingAPI("info");
       testConsoleLoggingAPI("warn");
       testConsoleLoggingAPI("error");
       testConsoleLoggingAPI("exception");
 
-      testNet();
-
       // ConsoleStorageTests
       testCreateDisplay();
       testRecordEntry();
       testRecordManyEntries();
       testIteration();
       testConsoleHistory();
       testOutputOrder();
       testNullUndefinedOutput();
       testExecutionScope();
       testCompletion();
       testPropertyProvider();
-      testPageReload();
+      testNet();
     });
   }, false);
 }