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

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

Issue 607523002: Added layouttests for checking that RTCPeerConnection.onaddstream (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed spelling in expected.txt 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-remotestreams-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
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description("Tests that an RTCPeerConnection can signal that remote streams are added and removed.");
9
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 requestSucceeded2()
28 {
29 testPassed('requestSucceeded was called.');
30 shouldBeEqualToNumber('pc.getRemoteStreams().length', 0);
31 finishJSTest();
32 }
33
34 function requestSucceeded1()
35 {
36 testPassed('requestSucceeded was called.');
37 shouldBeEqualToNumber('pc.getRemoteStreams().length', 1);
38
39 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"}) ;
40 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 2, requestFailedUnexpectedly);');
41 }
42
43 function requestFailedUnexpectedly()
44 {
45 testFailed('requestFailed was called.');
46 finishJSTest();
47 }
48
49 function gotStream(stream) {
50 local_stream = stream;
51 pc.addStream(local_stream);
52
53 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} );
54 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 1, requestFailedUnexpectedly);');
55 }
56
57 function onAddStream(event) {
58 testPassed('remote stream was added');
59 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 1);
60 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 1);
61 pc.removeStream(local_stream);
62 }
63
64 function onRemoveStream(event) {
65 testPassed('remote stream was removed');
66 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0);
67 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0);
68 }
69
70 pc = new webkitRTCPeerConnection(null, null);
71 pc.onaddstream = onAddStream;
72 pc.onremovestream = onRemoveStream;
73 getUserMedia({audio:true, video:true}, gotStream);
74
75
76 window.jsTestIsAsync = true;
77 window.successfullyParsed = true;
78 </script>
79 </body>
80 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/mediastream/RTCPeerConnection-remotestreams-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698