Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediastream / MediaStream-stop.html
blob90fbf07781ff0343f96e371fac768d413f0e9b5b
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("Test cloning mediastreams onactive/oninactive callbacks.");
10 var cloned_stream;
12 function error() {
13 testFailed('Stream generation failed.');
14 finishJSTest();
17 function getUserMedia(dictionary, callback) {
18 try {
19 navigator.webkitGetUserMedia(dictionary, callback, error);
20 } catch (e) {
21 testFailed('webkitGetUserMedia threw exception :' + e);
22 finishJSTest();
26 function onStreamActive() {
27 testPassed('Clone stream active.');
28 shouldBeTrue('cloned_stream.active');
29 finishJSTest();
32 function gotStream2(s) {
33 cloned_stream.onactive = onStreamActive;
34 cloned_stream.addTrack(s.getVideoTracks()[0]);
37 function onStreamInactive() {
38 testPassed('Clone stream inactive.');
39 shouldBeFalse('cloned_stream.active');
41 getUserMedia({audio:true, video:true}, gotStream2);
44 function gotStream(s) {
45 var stream = s;
47 cloned_stream = stream.clone();
48 cloned_stream.oninactive = onStreamInactive;
49 shouldBeTrue('cloned_stream.active');
50 shouldBe('cloned_stream.getVideoTracks().length', '1');
51 shouldBe('cloned_stream.getAudioTracks().length', '1');
52 cloned_stream.getVideoTracks()[0].stop();
53 cloned_stream.getAudioTracks()[0].stop();
56 getUserMedia({audio:true, video:true}, gotStream);
58 window.jsTestIsAsync = true;
59 window.successfullyParsed = true;
60 </script>
61 </body>
62 </html>