Bug 1373015 - fix permafail mochitest for RTCIceCandPairStats changes in Bug 1339906. r=drno draft
authorMichael Froman <mfroman@mozilla.com>
Thu, 15 Jun 2017 12:17:43 -0500
changeset 594954 9e29f7604f6ae198cbaf792171db265612a574a6
parent 594702 035c25bef7b5e4175006e63eff10c61c2eef73f1
child 633586 a8555dc1fb45b3add7301781cbbaf15abd98ce10
push id64206
push userbmo:mfroman@nostrum.com
push dateThu, 15 Jun 2017 20:17:25 +0000
reviewersdrno
bugs1373015, 1339906
milestone56.0a1
Bug 1373015 - fix permafail mochitest for RTCIceCandPairStats changes in Bug 1339906. r=drno Something changed in the timing and we're getting more candidate pairs in the test now. I changed the test to only compare most of the details when the pair is in state succeeded. MozReview-Commit-ID: FaR00eZPJmI
dom/media/tests/mochitest/test_peerConnection_stats.html
--- a/dom/media/tests/mochitest/test_peerConnection_stats.html
+++ b/dom/media/tests/mochitest/test_peerConnection_stats.html
@@ -388,66 +388,73 @@ var pedanticChecks = report => {
         stat.type + ".localCandidateId has a value. value="
         + stat.localCandidateId);
 
       // remoteCandidateId
       ok(stat.remoteCandidateId,
         stat.type + ".remoteCandidateId has a value. value="
         + stat.remoteCandidateId);
 
-      // state
-      ok(stat.state == "succeeded",
-        stat.type + ".state is succeeded. value="
-        + stat.state);
-
       // priority
       ok(stat.priority,
         stat.type + ".priority has a value. value="
         + stat.priority);
 
-      // nominated
-      ok(stat.nominated,
-        stat.type + ".nominated is true. value="
-        + stat.nominated);
-
       // readable
       ok(stat.readable,
         stat.type + ".readable is true. value="
         + stat.readable);
 
       // writable
       ok(stat.writable,
         stat.type + ".writable is true. value="
         + stat.writable);
 
-      // bytesSent
-      ok(stat.bytesSent > 20000 && stat.bytesSent < 800000,
-        stat.type + ".bytesSent is a sane number (20,000<>800,000)for a short test. value="
-        + stat.bytesSent);
+      // state
+      if (stat.state == "succeeded") {
+        // nominated
+        ok(stat.nominated,
+          stat.type + ".nominated is true. value="
+          + stat.nominated);
 
-      // bytesReceived
-      ok(stat.bytesReceived > 20000 && stat.bytesReceived < 800000,
-        stat.type + ".bytesReceived is a sane number (20,000<>800,000) for a short test. value="
-        + stat.bytesReceived);
+        // bytesSent
+        ok(stat.bytesSent > 20000 && stat.bytesSent < 800000,
+          stat.type + ".bytesSent is a sane number (20,000<>800,000)for a short test. value="
+          + stat.bytesSent);
+
+        // bytesReceived
+        ok(stat.bytesReceived > 20000 && stat.bytesReceived < 800000,
+          stat.type + ".bytesReceived is a sane number (20,000<>800,000) for a short test. value="
+          + stat.bytesReceived);
 
-      // lastPacketSentTimestamp
-      ok(stat.lastPacketSentTimestamp,
-        stat.type + ".lastPacketSentTimestamp has a value. value="
-        + stat.lastPacketSentTimestamp);
+        // lastPacketSentTimestamp
+        ok(stat.lastPacketSentTimestamp,
+          stat.type + ".lastPacketSentTimestamp has a value. value="
+          + stat.lastPacketSentTimestamp);
 
-      // lastPacketReceivedTimestamp
-      ok(stat.lastPacketReceivedTimestamp,
-        stat.type + ".lastPacketReceivedTimestamp has a value. value="
-        + stat.lastPacketReceivedTimestamp);
+        // lastPacketReceivedTimestamp
+        ok(stat.lastPacketReceivedTimestamp,
+          stat.type + ".lastPacketReceivedTimestamp has a value. value="
+          + stat.lastPacketReceivedTimestamp);
+
+      } else {
+        // nominated
+        ok(!stat.nominated,
+          stat.type + ".nominated is false. value="
+          + stat.nominated);
+      }
+
 
       //
       // Optional fields
       //
       // selected
-      ok(stat.selected === undefined || stat.selected == true,
+      ok(stat.selected === undefined ||
+         ((stat.state == "succeeded" && stat.selected == true) ||
+          (stat.selected == false)),
         stat.type + ".selected is undefined or true. value="
         + stat.selected);
 
     }
 
     //
     // Ensure everything was tested
     //