Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediastream / MediaStream-onactive-oninactive.html
blob0abcbb4a1d463999a23022b23ec737667931816e
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 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description("Test onactive/oninactive callback.");
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 var stream;
28 function streamActive() {
29 testPassed('streamActive was called.');
30 shouldBeTrue('stream.active');
31 finishJSTest();
34 function gotStream2(s) {
35 stream = new webkitMediaStream();
36 shouldBeFalse('stream.active');
37 stream.onactive = streamActive;
38 stream.addTrack(s.getAudioTracks()[0]);
41 function streamInactive() {
42 testPassed('streamInactive was called.');
43 shouldBeFalse('stream.active');
45 getUserMedia({audio:true, video:true}, gotStream2);
48 function gotStream(s) {
49 stream = s;
50 shouldBeTrue('stream.active');
51 stream.oninactive = streamInactive;
52 shouldBe('stream.getAudioTracks().length', '1');
53 shouldBe('stream.getVideoTracks().length', '1');
54 stream.removeTrack(stream.getAudioTracks()[0]);
55 stream.removeTrack(stream.getVideoTracks()[0]);
58 getUserMedia({audio:true, video:true}, gotStream);
60 window.jsTestIsAsync = true;
61 window.successfullyParsed = true;
62 </script>
63 </body>
64 </html>