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

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: 3 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 var gTestNonCrypto = false;
phoglund_chromium 2013/11/08 09:29:26 I still think you can get rid of these. See more b
elham 2013/11/08 23:30:40 Done.
13 var gTestUnsupportedVideoCodec = false;
12 14
13 var gLocalStream = null; 15 var gLocalStream = null;
14 var gSentTones = ''; 16 var gSentTones = '';
15 17
16 var gRemoteStreams = {}; 18 var gRemoteStreams = {};
17 19
18 // Default transform functions, overridden by some test cases. 20 // Default transform functions, overridden by some test cases.
19 var transformSdp = function(sdp) { return sdp; }; 21 var transformSdp = function(sdp) { return sdp; };
20 var transformRemoteSdp = function(sdp) { return sdp; }; 22 var transformRemoteSdp = function(sdp) { return sdp; };
21 var transformCandidate = function(candidate) { return candidate; }; 23 var transformCandidate = function(candidate) { return candidate; };
phoglund_chromium 2013/11/08 09:29:26 Introduce a new "transform" function here called o
elham 2013/11/08 23:30:40 Done.
22 24
23 // When using external SDES, the crypto key is chosen by javascript. 25 // When using external SDES, the crypto key is chosen by javascript.
24 var EXTERNAL_SDES_LINES = { 26 var EXTERNAL_SDES_LINES = {
25 'audio': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 27 'audio': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
26 'inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR', 28 'inline:PS1uQCVeeCFCanVmcjkpPywjNWhcYD0mXXtxaVBR',
27 'video': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 29 'video': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
28 'inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj', 30 'inline:d0RmdmcmVCspeEc3QGZiNWpVLFJhQX1cfHAwJSoj',
29 'data': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' + 31 'data': 'a=crypto:1 AES_CM_128_HMAC_SHA1_80 ' +
30 'inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj' 32 'inline:NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj'
31 }; 33 };
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 createConnections(null); 114 createConnections(null);
113 transformSdp = removeBundle; 115 transformSdp = removeBundle;
114 transformRemoteSdp = removeMsid; 116 transformRemoteSdp = removeMsid;
115 gTestWithoutMsid = true; 117 gTestWithoutMsid = true;
116 navigator.webkitGetUserMedia({audio: true, video: true}, 118 navigator.webkitGetUserMedia({audio: true, video: true},
117 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError); 119 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
118 waitForVideo('remote-view-1'); 120 waitForVideo('remote-view-1');
119 waitForVideo('remote-view-2'); 121 waitForVideo('remote-view-2');
120 } 122 }
121 123
124 // Test that we can't setup a call with an unsupported video codec
125 function negotiateUnsupportedVideoCodec() {
126 createConnections(null);
127 gTestUnsupportedVideoCodec = true;
128 transformSdp = removeVideoCodec;
phoglund_chromium 2013/11/08 09:29:26 Here you'll have something like onLocalDescriptio
elham 2013/11/08 23:30:40 Done.
129 navigator.webkitGetUserMedia({audio: true, video: true},
130 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
phoglund_chromium 2013/11/08 09:29:26 Nit: should be indented four spaces (this is wrong
elham 2013/11/08 23:30:40 Done.
131 }
132
133 // Test that we can't setup a call if one peer does not support encryption
134 function negotiateNonCryptoCall() {
135 createConnections(null);
136 gTestNonCrypto = true;
137 transformSdp = removeCrypto;
138 navigator.webkitGetUserMedia({audio: true, video: true},
139 addStreamToBothConnectionsAndNegotiate, printGetUserMediaError);
140 }
141
122 // Test that we can setup call with legacy settings. 142 // Test that we can setup call with legacy settings.
123 function callWithLegacySdp() { 143 function callWithLegacySdp() {
124 transformSdp = function(sdp) { 144 transformSdp = function(sdp) {
125 return removeBundle(useGice(useExternalSdes(sdp))); 145 return removeBundle(useGice(useExternalSdes(sdp)));
126 }; 146 };
127 transformCandidate = addGiceCredsToCandidate; 147 transformCandidate = addGiceCredsToCandidate;
128 createConnections({ 148 createConnections({
129 'mandatory': {'RtpDataChannels': true, 'DtlsSrtpKeyAgreement': false} 149 'mandatory': {'RtpDataChannels': true, 'DtlsSrtpKeyAgreement': false}
130 }); 150 });
131 setupDataChannel({reliable: false}); 151 setupDataChannel({reliable: false});
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 433 }
414 434
415 function displayAndRemember(localStream) { 435 function displayAndRemember(localStream) {
416 var localStreamUrl = webkitURL.createObjectURL(localStream); 436 var localStreamUrl = webkitURL.createObjectURL(localStream);
417 $('local-view').src = localStreamUrl; 437 $('local-view').src = localStreamUrl;
418 438
419 gLocalStream = localStream; 439 gLocalStream = localStream;
420 } 440 }
421 441
422 // Called if getUserMedia fails. 442 // Called if getUserMedia fails.
423 function printGetUserMediaError(error) { 443 function printGetUserMediaError(error) {
424 document.title = 'getUserMedia request failed with code ' + error.code; 444 document.title = 'getUserMedia request failed with code ' + error.code;
425 } 445 }
446
447 function printLocalDescriptionError(error) {
448 if ((gTestUnsupportedVideoCodec == true) &&
449 (error=='SetLocalDescription failed: Failed to update session state:'
450 +'ERROR_CONTENT', error)) {
451 document.title = 'OK';
452 gTestUnsupportedVideoCodec = false;
453 }
454 if ((gTestNonCrypto == true) &&
455 (error=='SetLocalDescription failed: Called with a SDP without crypto'
456 +'enabled', error)) {
457 document.title = 'OK';
458 gTestNonCrypto = false;
459 }
460 }
461
462 function printLocalDescriptionSuccess() {
463 document.title = 'setLocalDescription Success'
464 }
426 465
427 // Called if getUserMedia succeeds and we want to send from both connections. 466 // Called if getUserMedia succeeds and we want to send from both connections.
428 function addStreamToBothConnectionsAndNegotiate(localStream) { 467 function addStreamToBothConnectionsAndNegotiate(localStream) {
429 displayAndRemember(localStream); 468 displayAndRemember(localStream);
430 gFirstConnection.addStream(localStream); 469 gFirstConnection.addStream(localStream);
431 gSecondConnection.addStream(localStream); 470 gSecondConnection.addStream(localStream);
432 negotiate(); 471 negotiate();
433 } 472 }
434 473
435 // Called if getUserMedia succeeds when we want to send from one connection. 474 // Called if getUserMedia succeeds when we want to send from one connection.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 connectOnIceCandidate(caller, callee); 542 connectOnIceCandidate(caller, callee);
504 543
505 caller.createOffer( 544 caller.createOffer(
506 function (offer) { 545 function (offer) {
507 onOfferCreated(offer, caller, callee); 546 onOfferCreated(offer, caller, callee);
508 }); 547 });
509 } 548 }
510 549
511 function onOfferCreated(offer, caller, callee) { 550 function onOfferCreated(offer, caller, callee) {
512 offer.sdp = transformSdp(offer.sdp); 551 offer.sdp = transformSdp(offer.sdp);
513 caller.setLocalDescription(offer); 552 caller.setLocalDescription(offer, printLocalDescriptionError,
phoglund_chromium 2013/11/08 09:29:26 Pass in an empty function which does nothing as th
elham 2013/11/08 23:30:40 Done.
553 printLocalDescriptionError);
514 expectEquals('have-local-offer', caller.signalingState); 554 expectEquals('have-local-offer', caller.signalingState);
515 receiveOffer(offer.sdp, caller, callee); 555 receiveOffer(offer.sdp, caller, callee);
516 } 556 }
517 557
518 function receiveOffer(offerSdp, caller, callee) { 558 function receiveOffer(offerSdp, caller, callee) {
519 offerSdp = transformRemoteSdp(offerSdp); 559 offerSdp = transformRemoteSdp(offerSdp);
520 560
521 var parsedOffer = new RTCSessionDescription({ type: 'offer', 561 var parsedOffer = new RTCSessionDescription({ type: 'offer',
522 sdp: offerSdp }); 562 sdp: offerSdp });
523 callee.setRemoteDescription(parsedOffer); 563 callee.setRemoteDescription(parsedOffer);
524 callee.createAnswer(function (answer) { 564 callee.createAnswer(function (answer) {
525 onAnswerCreated(answer, caller, callee); 565 onAnswerCreated(answer, caller, callee);
526 }); 566 });
527 expectEquals('have-remote-offer', callee.signalingState); 567 expectEquals('have-remote-offer', callee.signalingState);
528 } 568 }
529 569
530 function removeMsid(offerSdp) { 570 function removeMsid(offerSdp) {
531 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, ''); 571 offerSdp = offerSdp.replace(/a=msid-semantic.*\r\n/g, '');
532 offerSdp = offerSdp.replace('a=mid:audio\r\n', ''); 572 offerSdp = offerSdp.replace('a=mid:audio\r\n', '');
533 offerSdp = offerSdp.replace('a=mid:video\r\n', ''); 573 offerSdp = offerSdp.replace('a=mid:video\r\n', '');
534 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, ''); 574 offerSdp = offerSdp.replace(/a=ssrc.*\r\n/g, '');
535 return offerSdp; 575 return offerSdp;
536 } 576 }
537 577
578 function removeVideoCodec(offerSdp) {
579 offerSdp= offerSdp.replace('a=rtpmap:100 VP8/90000\r\n',
580 'a=rtpmap:100 XVP8/90000\r\n');
581 return offerSdp;
582 }
583
584 function removeCrypto(offerSdp) {
585 offerSdp = offerSdp.replace(/a=crypto.*\r\n/g, 'a=Xcrypto\r\n');
586 offerSdp = offerSdp.replace(/a=fingerprint.*\r\n/g, '');
587 return offerSdp;
588 }
589
538 function removeBundle(sdp) { 590 function removeBundle(sdp) {
539 return sdp.replace(/a=group:BUNDLE .*\r\n/g, ''); 591 return sdp.replace(/a=group:BUNDLE .*\r\n/g, '');
540 } 592 }
541 593
542 function useGice(sdp) { 594 function useGice(sdp) {
543 sdp = sdp.replace(/t=.*\r\n/g, function(subString) { 595 sdp = sdp.replace(/t=.*\r\n/g, function(subString) {
544 return subString + 'a=ice-options:google-ice\r\n'; 596 return subString + 'a=ice-options:google-ice\r\n';
545 }); 597 });
546 sdp = sdp.replace(/a=ice-ufrag:.*\r\n/g, 598 sdp = sdp.replace(/a=ice-ufrag:.*\r\n/g,
547 'a=ice-ufrag:' + EXTERNAL_GICE_UFRAG + '\r\n'); 599 '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" 686 <td><canvas width="320" height="240" id="remote-view-2-canvas"
635 style="display:none"></canvas></td> 687 style="display:none"></canvas></td>
636 <td><canvas width="320" height="240" id="remote-view-3-canvas" 688 <td><canvas width="320" height="240" id="remote-view-3-canvas"
637 style="display:none"></canvas></td> 689 style="display:none"></canvas></td>
638 <td><canvas width="320" height="240" id="remote-view-4-canvas" 690 <td><canvas width="320" height="240" id="remote-view-4-canvas"
639 style="display:none"></canvas></td> 691 style="display:none"></canvas></td>
640 </tr> 692 </tr>
641 </table> 693 </table>
642 </body> 694 </body>
643 </html> 695 </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