Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediastream / RTCPeerConnection-remotestreams.html
blobc1616468e5fc9426b773f8b41d98f811b684ad65
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.");
10 var pc = null;
11 var local_stream = null;
13 function error() {
14 testFailed('Stream generation failed.');
15 finishJSTest();
18 function getUserMedia(dictionary, callback) {
19 try {
20 navigator.webkitGetUserMedia(dictionary, callback, error);
21 } catch (e) {
22 testFailed('webkitGetUserMedia threw exception :' + e);
23 finishJSTest();
27 function requestSucceeded2()
29 testPassed('requestSucceeded was called.');
30 shouldBeEqualToNumber('pc.getRemoteStreams().length', 0);
31 finishJSTest();
34 function requestSucceeded1()
36 testPassed('requestSucceeded was called.');
37 shouldBeEqualToNumber('pc.getRemoteStreams().length', 1);
39 sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
40 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailedUnexpectedly);');
43 function requestFailedUnexpectedly()
45 testFailed('requestFailed was called.');
46 finishJSTest();
49 function gotStream(stream) {
50 local_stream = stream;
51 pc.addStream(local_stream);
53 sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"});
54 shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailedUnexpectedly);');
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 shouldBeTrue('event.stream.active')
62 pc.removeStream(local_stream);
65 function onRemoveStream(event) {
66 testPassed('remote stream was removed');
67 shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0);
68 shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0);
69 shouldBeFalse('event.stream.active')
72 pc = new webkitRTCPeerConnection(null, null);
73 pc.onaddstream = onAddStream;
74 pc.onremovestream = onRemoveStream;
75 getUserMedia({audio:true, video:true}, gotStream);
78 window.jsTestIsAsync = true;
79 window.successfullyParsed = true;
80 </script>
81 </body>
82 </html>