Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / ManualTests / media-default-playback-rate.html
blobb980edc13c3addf20c320184aaecdf0af3e52f1d
2 <html>
3 <head>
4 <!-- LayoutTests location is hard-coded to avoid duplication of code. -->
5 <script src="http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/media-file.js"></script>
6 <script src="http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/video-test.js"></script>
8 <script>
9 var expectedRates = { "defaultPlaybackRate" : 1, "playbackRate" : 1};
10 var playingFromScript = false;
11 var changedRate = false;
13 function absoluteUrl(url)
15 var a = document.createElement('a');
16 a.href = url;
17 return a.href;
20 function testRates()
22 consoleWrite("");
23 var playWithControllerButton = !changedRate && !playingFromScript;
24 testExpected("video.playbackRate", playWithControllerButton ? expectedRates['defaultPlaybackRate'] : expectedRates['playbackRate']);
25 testExpected("video.defaultPlaybackRate", expectedRates['defaultPlaybackRate']);
26 changedRate = false;
29 function playing()
31 consoleWrite("<br>'playing' event");
32 expectedRates['playbackRate'] = playingFromScript ? video.playbackRate : video.defaultPlaybackRate;
33 testRates();
34 playingFromScript = false;
37 function ratechange()
39 consoleWrite("<br>'ratechange' event");
40 testRates();
43 function start()
45 findMediaElement();
46 video.addEventListener('ratechange', ratechange);
47 video.addEventListener('playing', playing);
49 // Use the video file from the svn repository to avoid duplicating the file.
50 video.src = absoluteUrl(findMediaFile('video', 'http://svn.webkit.org/repository/webkit/trunk/LayoutTests/media/content/test'));
51 testRates();
54 function play()
56 playingFromScript = true;
57 video.play();
60 function setRate(which, rate)
62 changedRate = true;
63 video[which] = rate;
64 expectedRates[which] = rate;
67 </script>
68 </head>
70 <body onload="start()">
72 <video controls > </video>
73 <ul>
74 <li>The current 'playbackRate' and 'defaultPlaybackRate' should be logged every time either changes.</li>
75 <li>'playbackRate' should be set to 'defaultPlaybackRate' when the Play button in the built-in controls is pressed</li>
76 <li>'playbackRate' should NOT when play() is called from script.</li>
77 </ul>
78 <div>
79 <button id="controls" onclick="setRate('defaultPlaybackRate', 2)">defaultPlaybackRate = 2</button>
80 <button id="controls" onclick="setRate('defaultPlaybackRate', 1)">defaultPlaybackRate = 1</button>
81 <button id="controls" onclick="setRate('playbackRate', 2)">playbackRate = 2</button>
82 <button id="controls" onclick="setRate('playbackRate', 1)">playbackRate = 1</button>
83 </div>
84 <div>
85 <button id="controls" onclick="play()">play()</button>
86 <button id="controls" onclick="video.pause()">pause()</button>
87 </div>
88 <br>
89 </body>
90 </html>