Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: content/test/data/media/peerconnection-call.html

Issue 47923023: Automate WebRTC-in-Chrome test cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable test on android Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/media/webrtc_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"> 4 <script type="text/javascript">
5 $ = function(id) { 5 $ = function(id) {
6 return document.getElementById(id); 6 return document.getElementById(id);
7 }; 7 };
8 8
9 var gFirstConnection = null; 9 var gFirstConnection = null;
10 var gSecondConnection = null; 10 var gSecondConnection = null;
11 var gTestWithoutMsid = false; 11 var gTestWithoutMsid = false;
12
13 var gLocalStream = null; 12 var gLocalStream = null;
14 var gSentTones = ''; 13 var gSentTones = '';
15 14
16 var gRemoteStreams = {}; 15 var gRemoteStreams = {};
17 16
18 // Default transform functions, overridden by some test cases. 17 // Default transform functions, overridden by some test cases.
19 var transformSdp = function(sdp) { return sdp; }; 18 var transformSdp = function(sdp) { return sdp; };
20 var transformRemoteSdp = function(sdp) { return sdp; }; 19 var transformRemoteSdp = function(sdp) { return sdp; };
21 var transformCandidate = function(candidate) { return candidate; }; 20 var transformCandidate = function(candidate) { return candidate; };
21 var onLocalDescriptionError = function(error) { };
22 22
23 // When using external SDES, the crypto key is chosen by javascript. 23 // When using external SDES, the crypto key is chosen by javascript.
24 var EXTERNAL_SDES_LINES = { 24 var EXTERNAL_SDES_LINES = {
25 'audio': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 25 'audio': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
26 'inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR', 26 'inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR',
27 'video': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 27 'video': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
28 'inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj', 28 'inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj',
29 'data': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 29 'data': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
30 'inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj' 30 'inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj'
31 }; 31 };
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 // Test that we can setup call with an audio and video track and 109 // Test that we can setup call with an audio and video track and
110 // simulate that the remote peer don't support MSID. 110 // simulate that the remote peer don't support MSID.
111 function callWithoutMsidAndBundle() { 111 function callWithoutMsidAndBundle() {
112 createConnections(null); 112 createConnections(null);
113 transformSdp = removeBundle; 113 transformSdp = removeBundle;
114 transformRemoteSdp = removeMsid; 114 transformRemoteSdp = removeMsid;
115 gTestWithoutMsid = true; 115 gTestWithoutMsid = true;
116 navigator.webkitGetUserMedia({audio: true, video: true}, 116 navigator.webkitGetUserMedia({audio: true, video: true},
117 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 117 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
118 waitForVideo('remote-view-1'); 118 waitForVideo('remote-view-1');
119 waitForVideo('remote-view-2'); 119 waitForVideo('remote-view-2');
120 } 120 }
121 121
122 // Test that we can't setup a call with an unsupported video codec
123 function negotiateUnsupportedVideoCodec() {
124 createConnections(null);
125 transformSdp = removeVideoCodec;
126 navigator.webkitGetUserMedia({audio: true, video: true},
127 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
128 onLocalDescriptionError = function(error) {
129 var expectedMsg = 'SetLocalDescription failed: Failed to' +
130 ' update session state: ERROR_CONTENT';
131 expectEquals(expectedMsg, error);
132
133 // Got the right message, test succeeded.
134 document.title = 'OK';
135 };
136 }
137
138 // Test that we can't setup a call if one peer does not support encryption
139 function negotiateNonCryptoCall() {
140 createConnections(null);
141 transformSdp = removeCrypto;
142 navigator.webkitGetUserMedia({audio: true, video: true},
143 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
144 onLocalDescriptionError = function(error) {
145 var expectedMsg = 'SetLocalDescription failed: Called with a SDP without'
146 + ' crypto enabled.';
147 expectEquals(expectedMsg, error);
148
149 // Got the right message, test succeeded.
150 document.title = 'OK';
151 };
152 }
153
122 // Test that we can setup call with legacy settings. 154 // Test that we can setup call with legacy settings.
123 function callWithLegacySdp() { 155 function callWithLegacySdp() {
124 transformSdp = function(sdp) { 156 transformSdp = function(sdp) {
125 return removeBundle(useGice(useExternalSdes(sdp))); 157 return removeBundle(useGice(useExternalSdes(sdp)));
126 }; 158 };
127 transformCandidate = addGiceCredsToCandidate; 159 transformCandidate = addGiceCredsToCandidate;
128 createConnections({ 160 createConnections({
129 'mandatory': {'RtpDataChannels': true, 'DtlsSrtpKeyAgreement': false} 161 'mandatory': {'RtpDataChannels': true, 'DtlsSrtpKeyAgreement': false}
130 }); 162 });
131 setupDataChannel({reliable: false}); 163 setupDataChannel({reliable: false});
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 443 }
412 return pc; 444 return pc;
413 } 445 }
414 446
415 function displayAndRemember(localStream) { 447 function displayAndRemember(localStream) {
416 var localStreamUrl = webkitURL.createObjectURL(localStream); 448 var localStreamUrl = webkitURL.createObjectURL(localStream);
417 $('local-view').src = localStreamUrl; 449 $('local-view').src = localStreamUrl;
418 450
419 gLocalStream = localStream; 451 gLocalStream = localStream;
420 } 452 }
421 453
422 // Called if getUserMedia fails. 454 // Called if getUserMedia fails.
423 function printGetUserMediaError(error) { 455 function printGetUserMediaError(error) {
424 document.title = 'getUserMedia request failed with code ' + error.code; 456 document.title = 'getUserMedia request failed with code ' + error.code;
425 } 457 }
426 458
427 // Called if getUserMedia succeeds and we want to send from both connections. 459 // Called if getUserMedia succeeds and we want to send from both connections.
428 function addStreamToBothConnectionsAndNegotiate(localStream) { 460 function addStreamToBothConnectionsAndNegotiate(localStream) {
429 displayAndRemember(localStream); 461 displayAndRemember(localStream);
430 gFirstConnection.addStream(localStream); 462 gFirstConnection.addStream(localStream);
431 gSecondConnection.addStream(localStream); 463 gSecondConnection.addStream(localStream);
432 negotiate(); 464 negotiate();
433 } 465 }
434 466
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 connectOnIceCandidate(caller, callee); 535 connectOnIceCandidate(caller, callee);
504 536
505 caller.createOffer( 537 caller.createOffer(
506 function (offer) { 538 function (offer) {
507 onOfferCreated(offer, caller, callee); 539 onOfferCreated(offer, caller, callee);
508 }); 540 });
509 } 541 }
510 542
511 function onOfferCreated(offer, caller, callee) { 543 function onOfferCreated(offer, caller, callee) {
512 offer.sdp = transformSdp(offer.sdp); 544 offer.sdp = transformSdp(offer.sdp);
513 caller.setLocalDescription(offer); 545 caller.setLocalDescription(offer, null, onLocalDescriptionError);
546
514 expectEquals('have-local-offer', caller.signalingState); 547 expectEquals('have-local-offer', caller.signalingState);
515 receiveOffer(offer.sdp, caller, callee); 548 receiveOffer(offer.sdp, caller, callee);
516 } 549 }
517 550
518 function receiveOffer(offerSdp, caller, callee) { 551 function receiveOffer(offerSdp, caller, callee) {
519 offerSdp = transformRemoteSdp(offerSdp); 552 offerSdp = transformRemoteSdp(offerSdp);
520 553
521 var parsedOffer = new RTCSessionDescription({ type: 'offer', 554 var parsedOffer = new RTCSessionDescription({ type: 'offer',
522 sdp: offerSdp }); 555 sdp: offerSdp });
523 callee.setRemoteDescription(parsedOffer); 556 callee.setRemoteDescription(parsedOffer);
524 callee.createAnswer(function (answer) { 557 callee.createAnswer(function (answer) {
525 onAnswerCreated(answer, caller, callee); 558 onAnswerCreated(answer, caller, callee);
526 }); 559 });
527 expectEquals('have-remote-offer', callee.signalingState); 560 expectEquals('have-remote-offer', callee.signalingState);
528 } 561 }
529 562
530 function removeMsid(offerSdp) { 563 function removeMsid(offerSdp) {
531 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, ''); 564 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, '');
532 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); 565 offerSdp = offerSdp.replace('a=mid:audio\r\n', '');
533 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); 566 offerSdp = offerSdp.replace('a=mid:video\r\n', '');
534 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); 567 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, '');
535 return offerSdp; 568 return offerSdp;
536 } 569 }
537 570
571 function removeVideoCodec(offerSdp) {
572 offerSdp = offerSdp.replace('a=rtpmap:100 VP8/90000\r\n',
573 'a=rtpmap:100 XVP8/90000\r\n');
574 return offerSdp;
575 }
576
577 function removeCrypto(offerSdp) {
578 offerSdp = offerSdp.replace(/a=crypto.*\r\n/g, 'a=Xcrypto\r\n');
579 offerSdp = offerSdp.replace(/a=fingerprint.*\r\n/g, '');
580 return offerSdp;
581 }
582
538 function removeBundle(sdp) { 583 function removeBundle(sdp) {
539 return sdp.replace(/a=group:BUNDLE .*\r\n/g, ''); 584 return sdp.replace(/a=group:BUNDLE .*\r\n/g, '');
540 } 585 }
541 586
542 function useGice(sdp) { 587 function useGice(sdp) {
543 sdp = sdp.replace(/t=.*\r\n/g, function(subString) { 588 sdp = sdp.replace(/t=.*\r\n/g, function(subString) {
544 return subString + 'a=ice-options:google-ice\r\n'; 589 return subString + 'a=ice-options:google-ice\r\n';
545 }); 590 });
546 sdp = sdp.replace(/a=ice-ufrag:.*\r\n/g, 591 sdp = sdp.replace(/a=ice-ufrag:.*\r\n/g,
547 'a=ice-ufrag:' + EXTERNAL_GICE_UFRAG + '\r\n'); 592 'a=ice-ufrag:' + EXTERNAL_GICE_UFRAG + '\r\n');
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 <td><canvas width="320" height="240" id="remote-view-2-canvas" 679 <td><canvas width="320" height="240" id="remote-view-2-canvas"
635 style="display:none"></canvas></td> 680 style="display:none"></canvas></td>
636 <td><canvas width="320" height="240" id="remote-view-3-canvas" 681 <td><canvas width="320" height="240" id="remote-view-3-canvas"
637 style="display:none"></canvas></td> 682 style="display:none"></canvas></td>
638 <td><canvas width="320" height="240" id="remote-view-4-canvas" 683 <td><canvas width="320" height="240" id="remote-view-4-canvas"
639 style="display:none"></canvas></td> 684 style="display:none"></canvas></td>
640 </tr> 685 </tr>
641 </table> 686 </table>
642 </body> 687 </body>
643 </html> 688 </html>
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698