Bug 983000 - Call requestSockets only after successfully establishing a connection. r=mcmanus
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 13 Mar 2014 13:08:04 +0100
changeset 173376 5b84220fd9623c9df309006fe638f3c76eeb6b1c
parent 173375 ae03abb8673711010a37ad39b8a6a129ac976565
child 173377 32a5ae80bfc87476f88cade18622a029a31f5ee0
push id40985
push userryanvm@gmail.com
push dateThu, 13 Mar 2014 13:17:59 +0000
treeherdermozilla-inbound@5b84220fd962 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs983000
milestone30.0a1
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 983000 - Call requestSockets only after successfully establishing a connection. r=mcmanus
netwerk/test/unit/test_ping_aboutnetworking.js
--- a/netwerk/test/unit/test_ping_aboutnetworking.js
+++ b/netwerk/test/unit/test_ping_aboutnetworking.js
@@ -17,16 +17,36 @@ function connectionFailed(status) {
     if (status == status_ok[i]) {
       return false;
     }
   }
 
   return true;
 }
 
+function test_sockets() {
+  do_test_pending();
+  gDashboard.requestSockets(function(data) {
+    let index = -1;
+    for (let i = 0; i < data.sockets.length; i++) {
+      if (data.sockets[i].host == "127.0.0.1") {
+        index = i;
+        break;
+      }
+    }
+    do_check_neq(index, -1);
+    do_check_eq(data.sockets[index].port, serverSocket.port);
+    do_check_eq(data.sockets[index].tcp, 1);
+
+    serverSocket.close();
+
+    do_test_finished();
+  });
+}
+
 function run_test() {
   let serverSocket = Components.classes["@mozilla.org/network/server-socket;1"]
     .createInstance(Ci.nsIServerSocket);
 
   serverSocket.init(-1, true, -1);
 
   do_test_pending();
   gDashboard.requestConnection("localhost", serverSocket.port,
@@ -39,34 +59,18 @@ function run_test() {
           if (data.entries[i].hostname == "localhost") {
             found = true;
             break;
           }
         }
         do_check_eq(found, true);
 
         do_test_finished();
-      });
 
-      do_test_pending();
-      gDashboard.requestSockets(function(data) {
-        let index = -1;
-        for (let i = 0; i < data.sockets.length; i++) {
-          if (data.sockets[i].host == "127.0.0.1") {
-            index = i;
-            break;
-          }
-        }
-        do_check_neq(index, -1);
-        do_check_eq(data.sockets[index].port, serverSocket.port);
-        do_check_eq(data.sockets[index].tcp, 1);
-
-        serverSocket.close();
-
-        do_test_finished();
+        test_sockets();
       });
 
       do_test_finished();
     }
     if (connectionFailed(connInfo.status)) {
       do_throw(connInfo.status);
     }
   });