Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / mediastream / MediaStreamTrack.html
blobd7c0f66cd146a6bebad407af8277800bd4be9c6d
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("Tests MediaStreamTrack callbacks.");
12 // Note that the below behaviour doesn't reflect how it works outside of LayoutTests.
13 // The underlying mock is modified to trigger the events when certain functions are called.
14 // This modified behaviour allows us to test the MediaStreamTrack class properly.
16 var track;
18 function error() {
19 testFailed('Stream generation failed.');
20 finishJSTest();
23 function getUserMedia(constraints, callback) {
24 try {
25 navigator.webkitGetUserMedia(constraints, callback, error);
26 } catch (e) {
27 testFailed('webkitGetUserMedia threw exception :' + e);
28 finishJSTest();
32 function onTrackEnded() {
33 testPassed('Track onended callback succeeded.');
35 shouldBeEqualToString('track.readyState', 'ended');
37 finishJSTest();
40 function onTrackUnmute() {
41 testPassed('Track onunmute callback succeeded.');
43 shouldBeEqualToString('track.readyState', 'live');
44 shouldBeFalse('track.muted');
46 track.stop();
49 function onTrackMute() {
50 testPassed('Track onmute callback succeeded.');
52 shouldBeEqualToString('track.readyState', 'muted');
53 shouldBeTrue('track.muted');
55 track.enabled = true;
58 function gotStream(stream) {
59 testPassed('getUserMedia succeeded.');
61 track = stream.getVideoTracks()[0];
63 shouldBeEqualToString('track.readyState', 'live');
65 track.onunmute = onTrackUnmute;
66 track.onmute = onTrackMute;
67 track.onended = onTrackEnded;
69 track.enabled = false;
72 getUserMedia({audio:true, video:true}, gotStream);
74 window.jsTestIsAsync = true;
75 window.successfullyParsed = true;
76 </script>
77 </body>
78 </html>