Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> | 3 <script type="text/javascript" src="webrtc_test_utilities.js"></script> |
| 4 <script type="text/javascript" src="webrtc_test_audio.js"></script> | 4 <script type="text/javascript" src="webrtc_test_audio.js"></script> |
| 5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
| 6 $ = function(id) { | 6 $ = function(id) { |
| 7 return document.getElementById(id); | 7 return document.getElementById(id); |
| 8 }; | 8 }; |
| 9 | 9 |
| 10 window.onerror = function() { | |
|
phoglund_chromium
2014/10/27 17:28:17
This a good idea, but there is also a bunch of arg
| |
| 11 failTest("Error on page."); | |
| 12 } | |
| 13 | |
| 10 var gFirstConnection = null; | 14 var gFirstConnection = null; |
| 11 var gSecondConnection = null; | 15 var gSecondConnection = null; |
| 12 var gTestWithoutMsid = false; | 16 var gTestWithoutMsid = false; |
| 13 var gLocalStream = null; | 17 var gLocalStream = null; |
| 14 var gSentTones = ''; | 18 var gSentTones = ''; |
| 15 | 19 |
| 16 var gRemoteStreams = {}; | 20 var gRemoteStreams = {}; |
| 17 | 21 |
| 18 // Default transform functions, overridden by some test cases. | 22 // Default transform functions, overridden by some test cases. |
| 19 var transformSdp = function(sdp) { return sdp; }; | 23 var transformSdp = function(sdp) { return sdp; }; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 function callWithSctpDataAndMedia() { | 279 function callWithSctpDataAndMedia() { |
| 276 createConnections({optional: [{DtlsSrtpKeyAgreement: true}]}); | 280 createConnections({optional: [{DtlsSrtpKeyAgreement: true}]}); |
| 277 setupSctpDataChannel({reliable: true}); | 281 setupSctpDataChannel({reliable: true}); |
| 278 navigator.webkitGetUserMedia({audio: true, video: true}, | 282 navigator.webkitGetUserMedia({audio: true, video: true}, |
| 279 addStreamToBothConnectionsAndNegotiate, | 283 addStreamToBothConnectionsAndNegotiate, |
| 280 printGetUserMediaError); | 284 printGetUserMediaError); |
| 281 waitForVideo('remote-view-1'); | 285 waitForVideo('remote-view-1'); |
| 282 waitForVideo('remote-view-2'); | 286 waitForVideo('remote-view-2'); |
| 283 } | 287 } |
| 284 | 288 |
| 285 | |
| 286 // Test call with a data channel and later add audio and video. | 289 // Test call with a data channel and later add audio and video. |
| 287 function callWithDataAndLaterAddMedia() { | 290 function callWithDataAndLaterAddMedia() { |
| 288 createConnections({optional:[{RtpDataChannels: true}]}); | 291 createConnections({optional:[{RtpDataChannels: true}]}); |
| 289 setupDataChannel({reliable: false}); | 292 setupDataChannel({reliable: false}); |
| 290 negotiate(); | 293 negotiate(); |
| 291 | 294 |
| 292 // Set an event handler for when the data channel has been closed. | 295 // Set an event handler for when the data channel has been closed. |
| 293 setAllEventsOccuredHandler(function() { | 296 setAllEventsOccuredHandler(function() { |
| 294 // When the video is flowing the test is done. | 297 // When the video is flowing the test is done. |
| 295 setAllEventsOccuredHandler(reportTestSuccess); | 298 setAllEventsOccuredHandler(reportTestSuccess); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 621 } | 624 } |
| 622 | 625 |
| 623 // When |firstDataChannel| receive a message, send message back. | 626 // When |firstDataChannel| receive a message, send message back. |
| 624 // initiate a new offer/answer exchange to complete the closure. | 627 // initiate a new offer/answer exchange to complete the closure. |
| 625 firstDataChannel.onmessage = function(event) { | 628 firstDataChannel.onmessage = function(event) { |
| 626 assertEquals('open', firstDataChannel.readyState); | 629 assertEquals('open', firstDataChannel.readyState); |
| 627 assertEquals(event.data, sendDataString); | 630 assertEquals(event.data, sendDataString); |
| 628 firstDataChannel.send(sendDataString); | 631 firstDataChannel.send(sendDataString); |
| 629 } | 632 } |
| 630 | 633 |
| 631 | |
| 632 // Event handler for when |gSecondConnection| receive a new dataChannel. | 634 // Event handler for when |gSecondConnection| receive a new dataChannel. |
| 633 gSecondConnection.ondatachannel = function (event) { | 635 gSecondConnection.ondatachannel = function (event) { |
| 634 var secondDataChannel = event.channel; | 636 var secondDataChannel = event.channel; |
| 635 secondDataChannel.onopen = function() { | 637 secondDataChannel.onopen = function() { |
| 636 secondDataChannel.send(sendDataString); | 638 secondDataChannel.send(sendDataString); |
| 637 } | 639 } |
| 638 | 640 |
| 639 // When |secondDataChannel| receive a message, close the channel and | 641 // When |secondDataChannel| receive a message, close the channel and |
| 640 // initiate a new offer/answer exchange to complete the closure. | 642 // initiate a new offer/answer exchange to complete the closure. |
| 641 secondDataChannel.onmessage = function(event) { | 643 secondDataChannel.onmessage = function(event) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 receiveOffer(offer.sdp, caller, callee); | 798 receiveOffer(offer.sdp, caller, callee); |
| 797 }, onLocalDescriptionError); | 799 }, onLocalDescriptionError); |
| 798 } | 800 } |
| 799 | 801 |
| 800 function receiveOffer(offerSdp, caller, callee) { | 802 function receiveOffer(offerSdp, caller, callee) { |
| 801 console.log("Receiving offer..."); | 803 console.log("Receiving offer..."); |
| 802 offerSdp = transformRemoteSdp(offerSdp); | 804 offerSdp = transformRemoteSdp(offerSdp); |
| 803 | 805 |
| 804 var parsedOffer = new RTCSessionDescription({ type: 'offer', | 806 var parsedOffer = new RTCSessionDescription({ type: 'offer', |
| 805 sdp: offerSdp }); | 807 sdp: offerSdp }); |
| 806 callee.setRemoteDescription(parsedOffer, function() {}, | 808 callee.setRemoteDescription(parsedOffer, |
| 809 function() { | |
| 810 assertEquals('have-remote-offer', | |
| 811 callee.signalingState); | |
| 812 callee.createAnswer( | |
| 813 function (answer) { | |
| 814 onAnswerCreated(answer, caller, callee); | |
| 815 }); | |
| 816 }, | |
| 807 onRemoteDescriptionError); | 817 onRemoteDescriptionError); |
| 808 callee.createAnswer(function (answer) { | |
| 809 onAnswerCreated(answer, caller, callee); | |
| 810 }); | |
| 811 assertEquals('have-remote-offer', callee.signalingState); | |
| 812 } | 818 } |
| 813 | 819 |
| 814 function removeMsid(offerSdp) { | 820 function removeMsid(offerSdp) { |
| 815 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, ''); | 821 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, ''); |
| 816 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); | 822 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); |
| 817 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); | 823 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); |
| 818 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); | 824 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); |
| 819 return offerSdp; | 825 return offerSdp; |
| 820 } | 826 } |
| 821 | 827 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 928 <td><canvas width="320" height="240" id="remote-view-2-canvas" | 934 <td><canvas width="320" height="240" id="remote-view-2-canvas" |
| 929 style="display:none"></canvas></td> | 935 style="display:none"></canvas></td> |
| 930 <td><canvas width="320" height="240" id="remote-view-3-canvas" | 936 <td><canvas width="320" height="240" id="remote-view-3-canvas" |
| 931 style="display:none"></canvas></td> | 937 style="display:none"></canvas></td> |
| 932 <td><canvas width="320" height="240" id="remote-view-4-canvas" | 938 <td><canvas width="320" height="240" id="remote-view-4-canvas" |
| 933 style="display:none"></canvas></td> | 939 style="display:none"></canvas></td> |
| 934 </tr> | 940 </tr> |
| 935 </table> | 941 </table> |
| 936 </body> | 942 </body> |
| 937 </html> | 943 </html> |
| OLD | NEW |