| <!doctype html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <title>Testing basic video exchange from offerer to receiver</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <video id="video" autoplay=""></video> |
| <canvas id="canvas" width="640" height="480"></canvas> |
| <script src ="routines.js"></script> |
| <script> |
| |
| promise_test((test) => { |
| if (window.testRunner) |
| testRunner.setUserMediaPermission(true); |
| |
| return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => { |
| return new Promise((resolve, reject) => { |
| var pc = new RTCPeerConnection(); |
| var count = 0; |
| pc.onnegotiationneeded = () => { |
| assert_equals(count++, 0, "Should only be called once"); |
| setTimeout(resolve, 500); |
| }; |
| pc.addTrack(stream.getVideoTracks()[0], stream); |
| }); |
| }); |
| }, "on negotiation needed in case of adding a stream"); |
| |
| promise_test((test) => { |
| if (window.testRunner) |
| testRunner.setUserMediaPermission(true); |
| |
| return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => { |
| return new Promise((resolve, reject) => { |
| var pc = new RTCPeerConnection(); |
| pc.onnegotiationneeded = () => { reject(); }; |
| pc.addTrack(stream.getVideoTracks()[0], stream); |
| pc.close(); |
| setTimeout(resolve, 500); |
| }); |
| }); |
| }, "on negotiation needed not called if pc is closed"); |
| </script> |
| </body> |
| </html> |