Bug 1531094: Fix a couple of test-cases that want to see rtp stats before RTP has started. Update meta file to reflect what is still missing. r=jib
authorByron Campen [:bwc] <docfaraday@gmail.com>
Fri, 08 Mar 2019 04:15:35 +0000
changeset 521030 4e646efc209a
parent 521029 d689ce995f0a
child 521031 e1ba6af4a982
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib
bugs1531094
milestone67.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 1531094: Fix a couple of test-cases that want to see rtp stats before RTP has started. Update meta file to reflect what is still missing. r=jib Depends on D21557 Differential Revision: https://phabricator.services.mozilla.com/D21986
testing/web-platform/meta/webrtc/RTCPeerConnection-getStats.https.html.ini
testing/web-platform/tests/webrtc/RTCPeerConnection-getStats.https.html
--- a/testing/web-platform/meta/webrtc/RTCPeerConnection-getStats.https.html.ini
+++ b/testing/web-platform/meta/webrtc/RTCPeerConnection-getStats.https.html.ini
@@ -20,18 +20,18 @@
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1225720
 
   [getStats() with no argument should return stats for no-stream tracks]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1225720
 
   [getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats]
     expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1225720, https://bugzilla.mozilla.org/show_bug.cgi?id=1531094
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1225720
 
   [getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats]
     expected: FAIL
-    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1531094
+    bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1225723
 
   [getStats() with connected peer connections having tracks and data channel should return all mandatory to implement stats]
     expected: FAIL
     bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1225720
 
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-getStats.https.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-getStats.https.html
@@ -168,50 +168,53 @@
   /*
     8.5.  The stats selection algorithm
       3.  If selector is an RTCRtpSender, gather stats for and add the following objects
           to result:
         - All RTCOutboundRTPStreamStats objects corresponding to selector.
         - All stats objects referenced directly or indirectly by the RTCOutboundRTPStreamStats
           objects added.
    */
-  promise_test(t => {
-    const pc = new RTCPeerConnection();
-    t.add_cleanup(() => pc.close());
-    return getTrackFromUserMedia('audio')
-    .then(([track, mediaStream]) => {
-      pc.addTrack(track, mediaStream);
+  promise_test(async t => {
+    const pc = createPeerConnectionWithCleanup(t);
+    const pc2 = createPeerConnectionWithCleanup(t);
 
-      return pc.getStats(track)
-      .then(statsReport => {
-        validateStatsReport(statsReport);
-        assert_stats_report_has_stats(statsReport, ['outbound-rtp']);
-      });
-    });
+    let [track, mediaStream] = await getTrackFromUserMedia('audio');
+    pc.addTrack(track, mediaStream);
+    exchangeIceCandidates(pc, pc2);
+    await doSignalingHandshake(pc, pc2);
+    await listenToIceConnected(pc);
+    const stats = await pc.getStats(track);
+    validateStatsReport(stats);
+    assert_stats_report_has_stats(stats, ['outbound-rtp']);
   }, `getStats() on track associated with RtpSender should return stats report containing outbound-rtp stats`);
 
 
   /*
     8.5.  The stats selection algorithm
       4.  If selector is an RTCRtpReceiver, gather stats for and add the following objects
           to result:
         - All RTCInboundRTPStreamStats objects corresponding to selector.
         - All stats objects referenced directly or indirectly by the RTCInboundRTPStreamStats
           added.
    */
-  promise_test(t => {
-    const pc = new RTCPeerConnection();
-    t.add_cleanup(() => pc.close());
-    const transceiver = pc.addTransceiver('audio');
+  promise_test(async t => {
+    const pc = createPeerConnectionWithCleanup(t);
+    const pc2 = createPeerConnectionWithCleanup(t);
 
-    return pc.getStats(transceiver.receiver.track)
-    .then(statsReport => {
-      validateStatsReport(statsReport);
-      assert_stats_report_has_stats(statsReport, ['inbound-rtp']);
+    let [track, mediaStream] = await getTrackFromUserMedia('audio');
+    pc.addTrack(track, mediaStream);
+    exchangeIceCandidates(pc, pc2);
+    await doSignalingHandshake(pc, pc2);
+    await new Promise(resolve => {
+      pc2.getReceivers()[0].track.addEventListener('unmute', resolve);
     });
+    const stats = await pc2.getStats(track);
+    validateStatsReport(stats);
+    assert_stats_report_has_stats(stats, ['inbound-rtp']);
   }, `getStats() on track associated with RtpReceiver should return stats report containing inbound-rtp stats`);
 
   /*
     8.6   Mandatory To Implement Stats
       An implementation MUST support generating statistics of the following types
       when the corresponding objects exist on a PeerConnection, with the attributes
       that are listed when they are valid for that object.
    */