Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <script> | |
| 8 description("Tests RTCPeerConnection remote MediaStreams."); | |
|
hta - Chromium
2014/10/09 08:07:33
How long should these descriptions be?
I would pr
perkj_chrome
2014/10/21 09:19:57
Done.
| |
| 9 | |
| 10 var pc = null; | |
| 11 var local_stream = null; | |
| 12 | |
| 13 function error() { | |
| 14 testFailed('Stream generation failed.'); | |
| 15 finishJSTest(); | |
| 16 } | |
| 17 | |
| 18 function getUserMedia(dictionary, callback) { | |
| 19 try { | |
| 20 navigator.webkitGetUserMedia(dictionary, callback, error); | |
| 21 } catch (e) { | |
| 22 testFailed('webkitGetUserMedia threw exception :' + e); | |
| 23 finishJSTest(); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 function requestSucceeded2() | |
| 28 { | |
| 29 testPassed('requestSucceeded was called.'); | |
| 30 shouldBeEqualToNumber('pc.getRemoteStreams().length', 0); | |
| 31 finishJSTest(); | |
| 32 } | |
| 33 | |
| 34 function requestSucceeded1() | |
| 35 { | |
| 36 testPassed('requestSucceeded was called.'); | |
| 37 shouldBeEqualToNumber('pc.getRemoteStreams().length', 1); | |
| 38 | |
| 39 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"}) ; | |
| 40 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 2, requestFailedUnexpected);'); | |
| 41 } | |
| 42 | |
| 43 function requestFailedUnexpected() | |
|
hta - Chromium
2014/10/09 08:07:33
English grammar: Unexpectedly
perkj_chrome
2014/10/21 09:19:57
Done.
| |
| 44 { | |
| 45 testFailed('requestFailed was called.'); | |
| 46 finishJSTest(); | |
| 47 } | |
| 48 | |
| 49 function gotStream(stream) { | |
| 50 local_stream = stream; | |
| 51 pc.addStream(local_stream); | |
| 52 | |
| 53 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} ); | |
| 54 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 1, requestFailedUnexpected);'); | |
| 55 } | |
| 56 | |
| 57 function onAddStream(event) { | |
| 58 testPassed('remote stream was added'); | |
| 59 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 1); | |
| 60 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 1); | |
| 61 pc.removeStream(local_stream); | |
| 62 } | |
| 63 | |
| 64 function onRemoveStream(event) { | |
| 65 testPassed('remote stream was removed'); | |
| 66 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0); | |
| 67 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0); | |
| 68 } | |
| 69 | |
| 70 pc = new webkitRTCPeerConnection(null, null); | |
| 71 pc.onaddstream = onAddStream; | |
| 72 pc.onremovestream = onRemoveStream; | |
| 73 getUserMedia({audio:true, video:true}, gotStream); | |
| 74 | |
| 75 | |
| 76 window.jsTestIsAsync = true; | |
| 77 window.successfullyParsed = true; | |
| 78 </script> | |
| 79 </body> | |
| 80 </html> | |
| OLD | NEW |