Make mDNS ICE Candidate an experimental flag again
[WebKit-https.git] / LayoutTests / webrtc / negotiatedneeded-event-addStream.html
1 <!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
15 promise_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) => {
21             var pc = new RTCPeerConnection();
22             var count = 0;
23             pc.onnegotiationneeded = () => {
24                 assert_equals(count++, 0, "Should only be called once");
25                 setTimeout(resolve, 500);
26             };
27             pc.addTrack(stream.getVideoTracks()[0], stream);
28         });
29     });
30 }, "on negotiation needed in case of adding a stream");
31
32 promise_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) => {
38             var pc = new RTCPeerConnection();
39             pc.onnegotiationneeded = () => { reject(); };
40             pc.addTrack(stream.getVideoTracks()[0], stream);
41             pc.close();
42             setTimeout(resolve, 500);
43         });
44     });
45 }, "on negotiation needed not called if pc is closed");
46         </script>
47     </body>
48 </html>