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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html

Issue 2425703002: Remove |remote| and |readonly| members of MediaStreamTrack (Closed)
Patch Set: Fixed webkit_tests Created 3 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
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 shouldBeFalse('local_stream.getAudioTracks()[0].remote');
52 shouldBeFalse('local_stream.getVideoTracks()[0].remote');
53 pc.addStream(local_stream);
54
55 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"} );
56 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded 1, requestFailedUnexpectedly);');
57 }
58
59 function onAddStream(event) {
60 testPassed('remote stream was added');
61 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 1);
62 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 1);
63 shouldBeTrue('event.stream.active')
64 shouldBeTrue('event.stream.getAudioTracks()[0].remote');
65 shouldBeTrue('event.stream.getVideoTracks()[0].remote');
66 pc.removeStream(local_stream);
67 }
68
69 function onRemoveStream(event) {
70 testPassed('remote stream was removed');
71 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0);
72 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0);
73 shouldBeFalse('event.stream.active')
74 }
75
76 pc = new RTCPeerConnection();
77 pc.onaddstream = onAddStream;
78 pc.onremovestream = onRemoveStream;
79 getUserMedia({audio:true, video:true}, gotStream);
80
81
82 window.jsTestIsAsync = true;
83 window.successfullyParsed = true;
84 </script>
85 </body>
86 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698