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

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

Issue 966663002: Fixing misnamed variables, re-enabling CallAndModifyStream test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months 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" 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(errorMsg, url, lineNumber, column, errorObj) { 10 window.onerror = function(errorMsg, url, lineNumber, column, errorObj) {
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 navigator.webkitGetUserMedia({audio: true, video: true}, 526 navigator.webkitGetUserMedia({audio: true, video: true},
527 createNewVideoStreamAndAddToBothConnections, printGetUserMediaError); 527 createNewVideoStreamAndAddToBothConnections, printGetUserMediaError);
528 528
529 waitForVideo('remote-view-1'); 529 waitForVideo('remote-view-1');
530 waitForVideo('remote-view-2'); 530 waitForVideo('remote-view-2');
531 531
532 // Set an event handler for when video is playing. 532 // Set an event handler for when video is playing.
533 setAllEventsOccuredHandler(function() { 533 setAllEventsOccuredHandler(function() {
534 // Add an audio track to the local stream and remove the video track and 534 // Add an audio track to the local stream and remove the video track and
535 // then renegotiate. But first - setup the expectations. 535 // then renegotiate. But first - setup the expectations.
536 local_stream = gFirstConnection.getLocalStreams()[0]; 536 var localStream = gFirstConnection.getLocalStreams()[0];
537 var remoteStream1 = gFirstConnection.getRemoteStreams()[0];
537 538
538 remote_stream_1 = gFirstConnection.getRemoteStreams()[0];
539 // Add an expected event that onaddtrack will be called on the remote 539 // Add an expected event that onaddtrack will be called on the remote
540 // mediastream received on gFirstConnection when the audio track is 540 // mediastream received on gFirstConnection when the audio track is
541 // received. 541 // received.
542 addExpectedEvent(); 542 addExpectedEvent();
543 remote_stream_1.onaddtrack = function(){ 543 remoteStream1.onaddtrack = function(){
544 assertEquals(remote_stream_1.getAudioTracks()[0].id, 544 assertEquals(remoteStream1.getAudioTracks()[0].id,
545 local_stream.getAudioTracks()[0].id); 545 localStream.getAudioTracks()[0].id);
546 eventOccured(); 546 eventOccured();
547 } 547 }
548 548
549 // Add an expectation that the received video track is removed from 549 // Add an expectation that the received video track is removed from
550 // gFirstConnection. 550 // gFirstConnection.
551 addExpectedEvent(); 551 addExpectedEvent();
552 remote_stream_1.onremovetrack = function() { 552 remoteStream1.onremovetrack = function() {
553 eventOccured(); 553 eventOccured();
554 } 554 }
555 555
556 // Add an expected event that onaddtrack will be called on the remote 556 // Add an expected event that onaddtrack will be called on the remote
557 // mediastream received on gSecondConnection when the audio track is 557 // mediastream received on gSecondConnection when the audio track is
558 // received. 558 // received.
559 remote_stream_2 = gSecondConnection.getRemoteStreams()[0]; 559 remoteStream2 = gSecondConnection.getRemoteStreams()[0];
560 addExpectedEvent(); 560 addExpectedEvent();
561 remote_stream_2.onaddtrack = function() { 561 remoteStream2.onaddtrack = function() {
562 assertEquals(remote_stream_2.getAudioTracks()[0].id, 562 assertEquals(remoteStream2.getAudioTracks()[0].id,
563 local_stream.getAudioTracks()[0].id); 563 localStream.getAudioTracks()[0].id);
564 eventOccured(); 564 eventOccured();
565 } 565 }
566 566
567 // Add an expectation that the received video track is removed from 567 // Add an expectation that the received video track is removed from
568 // gSecondConnection. 568 // gSecondConnection.
569 addExpectedEvent(); 569 addExpectedEvent();
570 remote_stream_2.onremovetrack = function() { 570 remoteStream2.onremovetrack = function() {
571 eventOccured(); 571 eventOccured();
572 } 572 }
573 // When all the above events have occurred- the test pass. 573 // When all the above events have occurred- the test pass.
574 setAllEventsOccuredHandler(reportTestSuccess); 574 setAllEventsOccuredHandler(reportTestSuccess);
575 575
576 local_stream.addTrack(gLocalStream.getAudioTracks()[0]); 576 localStream.addTrack(gLocalStream.getAudioTracks()[0]);
577 local_stream.removeTrack(local_stream.getVideoTracks()[0]); 577 localStream.removeTrack(localStream.getVideoTracks()[0]);
578 negotiate(); 578 negotiate();
579 }); 579 });
580 } 580 }
581 581
582 // This function is used for setting up a test that: 582 // This function is used for setting up a test that:
583 // 1. Creates a data channel on |gFirstConnection| and sends data to 583 // 1. Creates a data channel on |gFirstConnection| and sends data to
584 // |gSecondConnection|. 584 // |gSecondConnection|.
585 // 2. When data is received on |gSecondConnection| a message 585 // 2. When data is received on |gSecondConnection| a message
586 // is sent to |gFirstConnection|. 586 // is sent to |gFirstConnection|.
587 // 3. When data is received on |gFirstConnection|, the data 587 // 3. When data is received on |gFirstConnection|, the data
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 eventOccured(); 674 eventOccured();
675 } 675 }
676 } 676 }
677 } 677 }
678 678
679 // Test call with a stream that has been created by getUserMedia, clone 679 // Test call with a stream that has been created by getUserMedia, clone
680 // the stream to a cloned stream, send them via the same peer connection. 680 // the stream to a cloned stream, send them via the same peer connection.
681 function addTwoMediaStreamsToOneConnection() { 681 function addTwoMediaStreamsToOneConnection() {
682 createConnections(null); 682 createConnections(null);
683 navigator.webkitGetUserMedia({audio: true, video: true}, 683 navigator.webkitGetUserMedia({audio: true, video: true},
684 CloneStreamAndAddTwoStreamstoOneConnection, printGetUserMediaError); 684 cloneStreamAndAddTwoStreamsToOneConnection, printGetUserMediaError);
685 } 685 }
686 686
687 function onToneChange(tone) { 687 function onToneChange(tone) {
688 gSentTones += tone.tone; 688 gSentTones += tone.tone;
689 } 689 }
690 690
691 function createConnections(constraints) { 691 function createConnections(constraints) {
692 gFirstConnection = createConnection(constraints, 'remote-view-1'); 692 gFirstConnection = createConnection(constraints, 'remote-view-1');
693 assertEquals('stable', gFirstConnection.signalingState); 693 assertEquals('stable', gFirstConnection.signalingState);
694 694
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 negotiate(); 736 negotiate();
737 } 737 }
738 738
739 function verifyHasOneAudioAndVideoTrack(stream) { 739 function verifyHasOneAudioAndVideoTrack(stream) {
740 assertEquals(1, stream.getAudioTracks().length); 740 assertEquals(1, stream.getAudioTracks().length);
741 assertEquals(1, stream.getVideoTracks().length); 741 assertEquals(1, stream.getVideoTracks().length);
742 } 742 }
743 743
744 // Called if getUserMedia succeeds, then clone the stream, send two streams 744 // Called if getUserMedia succeeds, then clone the stream, send two streams
745 // from one peer connection. 745 // from one peer connection.
746 function CloneStreamAndAddTwoStreamstoOneConnection(localStream) { 746 function cloneStreamAndAddTwoStreamsToOneConnection(localStream) {
747 displayAndRemember(localStream); 747 displayAndRemember(localStream);
748 748
749 var clonedStream = null; 749 var clonedStream = null;
750 if (typeof localStream.clone === "function") { 750 if (typeof localStream.clone === "function") {
751 clonedStream = localStream.clone(); 751 clonedStream = localStream.clone();
752 } else { 752 } else {
753 clonedStream = new webkitMediaStream(localStream); 753 clonedStream = new webkitMediaStream(localStream);
754 } 754 }
755 755
756 gFirstConnection.addStream(localStream); 756 gFirstConnection.addStream(localStream);
(...skipping 16 matching lines...) Expand all
773 assertEquals(2, gSecondConnection.getRemoteStreams().length); 773 assertEquals(2, gSecondConnection.getRemoteStreams().length);
774 verifyHasOneAudioAndVideoTrack(gSecondConnection.getRemoteStreams()[0]); 774 verifyHasOneAudioAndVideoTrack(gSecondConnection.getRemoteStreams()[0]);
775 verifyHasOneAudioAndVideoTrack(gSecondConnection.getRemoteStreams()[1]); 775 verifyHasOneAudioAndVideoTrack(gSecondConnection.getRemoteStreams()[1]);
776 776
777 reportTestSuccess(); 777 reportTestSuccess();
778 }); 778 });
779 779
780 negotiate(); 780 negotiate();
781 } 781 }
782 782
783 // Called if getUserMedia succeeds when we want to send a modified 783 // A new MediaStream is created with video track from |localStream| and is
784 // MediaStream. A new MediaStream is created and the video track from 784 // added to both peer connections.
785 // |localStream| is added.
786 function createNewVideoStreamAndAddToBothConnections(localStream) { 785 function createNewVideoStreamAndAddToBothConnections(localStream) {
787 displayAndRemember(localStream); 786 displayAndRemember(localStream);
788 var new_stream = new webkitMediaStream(); 787 var newStream = new webkitMediaStream();
789 new_stream.addTrack(localStream.getVideoTracks()[0]); 788 newStream.addTrack(localStream.getVideoTracks()[0]);
790 gFirstConnection.addStream(new_stream); 789 gFirstConnection.addStream(newStream);
791 gSecondConnection.addStream(new_stream); 790 gSecondConnection.addStream(newStream);
792 negotiate(); 791 negotiate();
793 } 792 }
794 793
795 function negotiate() { 794 function negotiate() {
796 negotiateBetween(gFirstConnection, gSecondConnection); 795 negotiateBetween(gFirstConnection, gSecondConnection);
797 } 796 }
798 797
799 function negotiateBetween(caller, callee) { 798 function negotiateBetween(caller, callee) {
800 console.log("Negotiating call..."); 799 console.log("Negotiating call...");
801 // Not stable = negotiation is ongoing. The behavior of re-negotiating while 800 // Not stable = negotiation is ongoing. The behavior of re-negotiating while
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 <td><canvas width="320" height="240" id="remote-view-2-canvas" 953 <td><canvas width="320" height="240" id="remote-view-2-canvas"
955 style="display:none"></canvas></td> 954 style="display:none"></canvas></td>
956 <td><canvas width="320" height="240" id="remote-view-3-canvas" 955 <td><canvas width="320" height="240" id="remote-view-3-canvas"
957 style="display:none"></canvas></td> 956 style="display:none"></canvas></td>
958 <td><canvas width="320" height="240" id="remote-view-4-canvas" 957 <td><canvas width="320" height="240" id="remote-view-4-canvas"
959 style="display:none"></canvas></td> 958 style="display:none"></canvas></td>
960 </tr> 959 </tr>
961 </table> 960 </table>
962 </body> 961 </body>
963 </html> 962 </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