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

Side by Side Diff: LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription.html

Issue 607523002: Added layouttests for checking that RTCPeerConnection.onaddstream (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 | « no previous file | LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description("Tests RTCPeerConnection remoteDescription."); 8 description("Tests RTCPeerConnection remoteDescription.");
9 9
10 var pc = null; 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 requestSucceeded3()
28 {
29 testPassed('requestSucceeded was called.');
30 shouldBeEqualToNumber('pc.getRemoteStreams().length', 0);
31
32 pc.close();
33 shouldBeEqualToString('pc.remoteDescription.type', "offer");
34 shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
35
36 finishJSTest();
37 }
11 38
12 function requestFailed2() 39 function requestFailed2()
hta - Chromium 2014/09/29 12:59:17 Nit: Can you rename this to requestFailedAsExpecte
perkj_chrome 2014/09/30 19:15:15 Removed from test. Forked test instead.
13 { 40 {
14 testPassed('requestFailed was called.'); 41 testPassed('requestFailed was called.');
15 42
16 shouldBeEqualToString('pc.remoteDescription.type', "answer"); 43 shouldBeEqualToString('pc.remoteDescription.type', "answer");
17 shouldBeEqualToString('pc.remoteDescription.sdp', "remote"); 44 shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
18 pc.close();
19 shouldBeEqualToString('pc.remoteDescription.type', "answer");
20 shouldBeEqualToString('pc.remoteDescription.sdp', "remote");
21 45
22 finishJSTest(); 46 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"}) ;
47 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 3, requestFailed1);');
23 } 48 }
24 49
25 function requestSucceeded2() 50 function requestSucceeded2()
hta - Chromium 2014/09/29 12:59:17 Same naming thing here....
26 { 51 {
27 testFailed('requestSucceeded was called.'); 52 testFailed('requestSucceeded was called.');
28 finishJSTest(); 53 finishJSTest();
29 } 54 }
30 55
31 function requestFailed1() 56 function requestFailed1()
32 { 57 {
33 testFailed('requestFailed was called.'); 58 testFailed('requestFailed was called.');
34 finishJSTest(); 59 finishJSTest();
35 } 60 }
36 61
37 function requestSucceeded1() 62 function requestSucceeded1()
38 { 63 {
39 testPassed('requestSucceeded was called.'); 64 testPassed('requestSucceeded was called.');
65 shouldBeEqualToNumber('pc.getRemoteStreams().length', 1);
40 66
41 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"}); 67 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"local"});
42 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 2, requestFailed2);'); 68 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 2, requestFailed2);');
43 } 69 }
44 70
71 function gotStream(stream) {
72 local_stream = stream;
73 pc.addStream(local_stream);
74
75 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} );
76 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 1, requestFailed1);');
77 }
78
79 function onAddStream(event) {
80 testPassed('remote stream was added');
81 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 1);
82 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 1);
83 pc.removeStream(local_stream);
84 }
85
86 function onRemoveStream(event) {
87 testPassed('remote stream was removed');
88 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0);
89 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0);
90 }
91
45 pc = new webkitRTCPeerConnection(null, null); 92 pc = new webkitRTCPeerConnection(null, null);
46 var sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} ); 93 pc.onaddstream = onAddStream;
47 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, r equestFailed1);'); 94 pc.onremovestream = onRemoveStream;
95 getUserMedia({audio:true, video:true}, gotStream);
hta - Chromium 2014/09/29 12:59:17 Nit: remember the error handler.
perkj_chrome 2014/09/30 19:15:14 getUserMedia is wrapper that handle that.
48 96
49 97
50 window.jsTestIsAsync = true; 98 window.jsTestIsAsync = true;
51 window.successfullyParsed = true; 99 window.successfullyParsed = true;
52 </script> 100 </script>
53 </body> 101 </body>
54 </html> 102 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/mediastream/RTCPeerConnection-remoteDescription-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698