[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / video-playbackrate.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <title>test playbackRate and defaultPlaybackRate</title>
5         <script src=media-file.js></script>
6         <script src=video-test.js></script>
7         <script>
8             var rateChangeCount = 0;
9
10             function ratechange()
11             {
12                 consoleWrite("*** checking rates after event");
13                 switch (++rateChangeCount)
14                 {
15                     case 1:
16                         testExpected("video.playbackRate", 1);
17                         testExpected("video.defaultPlaybackRate", 2);
18
19                         consoleWrite("<br>*** setting playbackRate");
20                         run("video.playbackRate = 2");
21                         testExpected("video.playbackRate", 2);
22                         testExpected("video.defaultPlaybackRate", 2);
23                         consoleWrite("");
24                         break;
25                     case 2:
26                         testExpected("video.playbackRate", 2);
27                         testExpected("video.defaultPlaybackRate", 2);
28
29                         consoleWrite("<br>*** beginning playback");
30                         video.currentTime = video.duration - 0.2;
31                         run("video.playbackRate = 1");
32                         testExpected("video.playbackRate", 1);
33                         testExpected("video.defaultPlaybackRate", 2);
34                         run("video.play()");
35                         consoleWrite("");
36                         break;
37                     case 3:
38                         testExpected("video.playbackRate", 1);
39                         testExpected("video.defaultPlaybackRate", 2);
40                         consoleWrite("");
41                         break;
42                     default:
43                         break;
44                 }
45             }
46
47             function canplaythrough()
48             {
49                 consoleWrite("<br>*** checking defaults");
50                 testExpected("video.playbackRate", 1);
51                 testExpected("video.defaultPlaybackRate", 1);
52
53                 consoleWrite("<br>*** setting defaultPlaybackRate");
54                 run("video.defaultPlaybackRate = 2");
55                 testExpected("video.playbackRate", 1);
56                 testExpected("video.defaultPlaybackRate", 2);
57                 consoleWrite("");
58             }
59
60             function ended()
61             {
62                 testExpected("video.playbackRate", 1);
63                 testExpected("video.defaultPlaybackRate", 2);
64                 consoleWrite("");
65                 endTest();
66             }
67
68             function start()
69             {
70                 findMediaElement();
71                 waitForEvent('canplaythrough', canplaythrough);
72                 waitForEvent('ended', ended);
73                 waitForEvent('ratechange', ratechange);
74
75                 consoleWrite("*** setting src");
76                 setSrcByTagName("video", findMediaFile("video", "content/test"));
77             }
78
79         </script>
80     </head>
81
82     <body onload="start()">
83         
84         <video controls > </video>
85         <ol>
86             <li>'playbackRate' should not change when play() is called.</li>
87             <li>'playbackRate' and 'defaultPlaybackRate' should always return the last value set.</li>
88         </ol>
89     </body>
90 </html>