commit-queue@webkit.org | 1c6acce | 2017-02-15 01:23:39 +0000 | [diff] [blame] | 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) => { |
commit-queue@webkit.org | 1c6acce | 2017-02-15 01:23:39 +0000 | [diff] [blame] | 21 | var pc = new RTCPeerConnection(); |
commit-queue@webkit.org | 04d3301 | 2017-04-13 16:38:58 +0000 | [diff] [blame] | 22 | var count = 0; |
| 23 | pc.onnegotiationneeded = () => { |
| 24 | assert_equals(count++, 0, "Should only be called once"); |
| 25 | setTimeout(resolve, 500); |
| 26 | }; |
commit-queue@webkit.org | 362495d | 2017-04-11 22:47:26 +0000 | [diff] [blame] | 27 | pc.addTrack(stream.getVideoTracks()[0], stream); |
commit-queue@webkit.org | 1c6acce | 2017-02-15 01:23:39 +0000 | [diff] [blame] | 28 | }); |
| 29 | }); |
| 30 | }, "on negotiation needed in case of adding a stream"); |
commit-queue@webkit.org | cc41c90 | 2017-03-15 16:35:18 +0000 | [diff] [blame] | 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) => { |
commit-queue@webkit.org | cc41c90 | 2017-03-15 16:35:18 +0000 | [diff] [blame] | 38 | var pc = new RTCPeerConnection(); |
| 39 | pc.onnegotiationneeded = () => { reject(); }; |
commit-queue@webkit.org | 362495d | 2017-04-11 22:47:26 +0000 | [diff] [blame] | 40 | pc.addTrack(stream.getVideoTracks()[0], stream); |
commit-queue@webkit.org | cc41c90 | 2017-03-15 16:35:18 +0000 | [diff] [blame] | 41 | pc.close(); |
| 42 | setTimeout(resolve, 500); |
| 43 | }); |
| 44 | }); |
| 45 | }, "on negotiation needed not called if pc is closed"); |
commit-queue@webkit.org | 1c6acce | 2017-02-15 01:23:39 +0000 | [diff] [blame] | 46 | </script> |
| 47 | </body> |
| 48 | </html> |