summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_peerConnection_disabledVideoPreNegotiation.html
blob: 4c06de792eeb9003937625fcd0a99774eeea4edc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="pc.js"></script>
  <script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    bug: "1570673",
    title: "Sending an initially disabled video track should be playable remotely",
    visible: true,
  });

  var test;
  runNetworkTest(async (options) => {
    // [TODO] re-enable HW decoder after bug 1526207 is fixed.
    if (navigator.userAgent.includes("Android")) {
      await pushPrefs(["media.navigator.mediadatadecoder_vpx_enabled", false],
                      ["media.webrtc.hw.h264.enabled", false]);
    }

    test = new PeerConnectionTest(options);
    test.setMediaConstraints([{video: true}], []);
    test.chain.insertAfter("PC_LOCAL_GUM", function PC_LOCAL_DISABLE_VIDEO() {
      for (const {track} of test.pcLocal._pc.getSenders()) {
        if (track.kind == "video") {
          track.enabled = false;
        }
      }
    });
    test.chain.append(async function PC_REMOTE_RECEIVING_BLACK() {
      const v = test.pcRemote.remoteMediaElements[0];
      is(v.readyState, v.HAVE_ENOUGH_DATA, "video element should be playing");
      const h = new CaptureStreamTestHelper2D();
      await h.waitForPixel(test.pcRemote.remoteMediaElements[0],
        px => h.isPixel(px, h.black, 128));
    });
    await test.run();
  });
</script>
</pre>
</body>
</html>