Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediastream / RTCPeerConnection-AddRemoveStream.html
blob6e8564a6386d135c43a74b532c430d7641274379
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 RTCPeerConnection [add|remove]Stream.");
10 var stream = null;
11 var stream2 = null;
12 var pc = null;
14 function error() {
15 testFailed('Stream generation failed.');
16 finishJSTest();
19 function getUserMedia(dictionary, callback) {
20 try {
21 navigator.webkitGetUserMedia(dictionary, callback, error);
22 } catch (e) {
23 testFailed('webkitGetUserMedia threw exception :' + e);
24 finishJSTest();
28 function onErroneousNegotiationNeeded() {
29 testFailed('onErroneousNegotiationNeeded was called.');
30 finishJSTest();
33 function onRemoveStream(event) {
34 testPassed('onRemoveStream was called.');
36 shouldBe('pc.getLocalStreams().length', '0');
38 finishJSTest();
41 function onAddStream(event) {
42 testPassed('onAddStream was called.');
44 shouldBe('pc.getStreamById(stream.id)', 'stream');
45 shouldBe('pc.getStreamById(stream2.id)', 'null');
47 pc.onnegotiationneeded = onErroneousNegotiationNeeded;
48 pc.addStream(stream);
49 shouldBe('pc.getLocalStreams().length', '1');
50 pc.removeStream(stream2);
51 shouldBe('pc.getLocalStreams().length', '1');
53 pc.onnegotiationneeded = onRemoveStream;
54 pc.removeStream(stream);
57 function gotStream2(s) {
58 testPassed('Got another stream.');
59 stream2 = s;
61 shouldBeFalse("stream.id === stream2.id");
63 pc = new webkitRTCPeerConnection(null, null);
64 pc.onnegotiationneeded = onAddStream;
65 pc.addStream(stream);
68 function gotStream1(s) {
69 testPassed('Got a stream.');
70 stream = s;
72 getUserMedia({audio:true, video:true}, gotStream2);
75 getUserMedia({audio:true, video:true}, gotStream1);
77 window.jsTestIsAsync = true;
78 window.successfullyParsed = true;
79 </script>
80 </body>
81 </html>