Bug 1055378 - Tightened test of getStats w/track arg. r=drno
authorJan-Ivar Bruaroey <jib@mozilla.com>
Fri, 22 Aug 2014 12:21:45 -0400
changeset 223744 b337b2d0f24da5698f55bac92ba249b962bcf167
parent 223743 edfbcca4ef084b3a47bf10c80e3f44661e128637
child 223745 a4aa926f8518aaecc8cf732a076b5132de5630a4
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1055378
milestone34.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 1055378 - Tightened test of getStats w/track arg. r=drno
dom/media/tests/mochitest/templates.js
--- a/dom/media/tests/mochitest/templates.js
+++ b/dom/media/tests/mochitest/templates.js
@@ -416,146 +416,170 @@ var commandsPeerConnection = [
   ],
   [
     'PC_LOCAL_CHECK_GETSTATS_AUDIOTRACK_OUTBOUND',
     function (test) {
       var pc = test.pcLocal;
       var stream = pc._pc.getLocalStreams()[0];
       var track = stream && stream.getAudioTracks()[0];
       if (track) {
+        var msg = "pcLocal.HasStat outbound audio rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"outboundrtp", isRemote:false, mediaType:"audio" }),
-             "pcLocal.HasStat outbound audio rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"inboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"video" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ],
   [
     'PC_LOCAL_CHECK_GETSTATS_VIDEOTRACK_OUTBOUND',
     function (test) {
       var pc = test.pcLocal;
       var stream = pc._pc.getLocalStreams()[0];
       var track = stream && stream.getVideoTracks()[0];
       if (track) {
+        var msg = "pcLocal.HasStat outbound video rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"outboundrtp", isRemote:false, mediaType:"video" }),
-             "pcLocal.HasStat outbound video rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"inboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"audio" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ],
   [
     'PC_LOCAL_CHECK_GETSTATS_AUDIOTRACK_INBOUND',
     function (test) {
       var pc = test.pcLocal;
       var stream = pc._pc.getRemoteStreams()[0];
       var track = stream && stream.getAudioTracks()[0];
       if (track) {
+        var msg = "pcLocal.HasStat inbound audio rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"inboundrtp", isRemote:false, mediaType:"audio" }),
-             "pcLocal.HasStat inbound audio rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"outboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"video" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ],
   [
     'PC_LOCAL_CHECK_GETSTATS_VIDEOTRACK_INBOUND',
     function (test) {
       var pc = test.pcLocal;
       var stream = pc._pc.getRemoteStreams()[0];
       var track = stream && stream.getVideoTracks()[0];
       if (track) {
+        var msg = "pcLocal.HasStat inbound video rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"inboundrtp", isRemote:false, mediaType:"video" }),
-             "pcLocal.HasStat inbound video rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"outboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"audio" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ],
   [
     'PC_REMOTE_CHECK_GETSTATS_AUDIOTRACK_OUTBOUND',
     function (test) {
       var pc = test.pcRemote;
       var stream = pc._pc.getLocalStreams()[0];
       var track = stream && stream.getAudioTracks()[0];
       if (track) {
+        var msg = "pcRemote.HasStat outbound audio rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"outboundrtp", isRemote:false, mediaType:"audio" }),
-             "pcRemote.HasStat outbound audio rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"inboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"video" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ],
   [
     'PC_REMOTE_CHECK_GETSTATS_VIDEOTRACK_OUTBOUND',
     function (test) {
       var pc = test.pcRemote;
       var stream = pc._pc.getLocalStreams()[0];
       var track = stream && stream.getVideoTracks()[0];
       if (track) {
+        var msg = "pcRemote.HasStat outbound audio rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"outboundrtp", isRemote:false, mediaType:"video" }),
-             "pcRemote.HasStat outbound audio rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"inboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"audio" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ],
   [
     'PC_REMOTE_CHECK_GETSTATS_AUDIOTRACK_INBOUND',
     function (test) {
       var pc = test.pcRemote;
       var stream = pc._pc.getRemoteStreams()[0];
       var track = stream && stream.getAudioTracks()[0];
       if (track) {
+        var msg = "pcRemote.HasStat inbound audio rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"inboundrtp", isRemote:false, mediaType:"audio" }),
-             "pcRemote.HasStat inbound audio rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"outboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"video" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ],
   [
     'PC_REMOTE_CHECK_GETSTATS_VIDEOTRACK_INBOUND',
     function (test) {
       var pc = test.pcRemote;
       var stream = pc._pc.getRemoteStreams()[0];
       var track = stream && stream.getVideoTracks()[0];
       if (track) {
+        var msg = "pcRemote.HasStat inbound video rtp ";
         pc.getStats(track, function(stats) {
           ok(pc.hasStat(stats,
                         { type:"inboundrtp", isRemote:false, mediaType:"video" }),
-             "pcRemote.HasStat inbound video rtp");
+             msg + "1");
+          ok(!pc.hasStat(stats, { type:"outboundrtp", isRemote:false }), msg + "2");
+          ok(!pc.hasStat(stats, { mediaType:"audio" }), msg + "3");
           test.next();
         });
       } else {
         test.next();
       }
     }
   ]
 ];