blob: e2badc080076fb1edf67530920f68c16ef57c598 [file] [log] [blame]
commit-queue@webkit.org1c6acce2017-02-15 01:23:39 +00001<!doctype html>
2<html>
3 <head>
4 <meta charset="utf-8">
5 <title>Testing basic video exchange from offerer to receiver</title>
6 <script src="../resources/testharness.js"></script>
7 <script src="../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10 <video id="video" autoplay=""></video>
11 <canvas id="canvas" width="640" height="480"></canvas>
12 <script src ="routines.js"></script>
13 <script>
14
15promise_test((test) => {
16 if (window.testRunner)
17 testRunner.setUserMediaPermission(true);
18
19 return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
20 return new Promise((resolve, reject) => {
commit-queue@webkit.org1c6acce2017-02-15 01:23:39 +000021 var pc = new RTCPeerConnection();
commit-queue@webkit.org04d33012017-04-13 16:38:58 +000022 var count = 0;
23 pc.onnegotiationneeded = () => {
24 assert_equals(count++, 0, "Should only be called once");
25 setTimeout(resolve, 500);
26 };
commit-queue@webkit.org362495d2017-04-11 22:47:26 +000027 pc.addTrack(stream.getVideoTracks()[0], stream);
commit-queue@webkit.org1c6acce2017-02-15 01:23:39 +000028 });
29 });
30}, "on negotiation needed in case of adding a stream");
commit-queue@webkit.orgcc41c902017-03-15 16:35:18 +000031
32promise_test((test) => {
33 if (window.testRunner)
34 testRunner.setUserMediaPermission(true);
35
36 return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
37 return new Promise((resolve, reject) => {
commit-queue@webkit.orgcc41c902017-03-15 16:35:18 +000038 var pc = new RTCPeerConnection();
39 pc.onnegotiationneeded = () => { reject(); };
commit-queue@webkit.org362495d2017-04-11 22:47:26 +000040 pc.addTrack(stream.getVideoTracks()[0], stream);
commit-queue@webkit.orgcc41c902017-03-15 16:35:18 +000041 pc.close();
42 setTimeout(resolve, 500);
43 });
44 });
45}, "on negotiation needed not called if pc is closed");
commit-queue@webkit.org1c6acce2017-02-15 01:23:39 +000046 </script>
47 </body>
48</html>