upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / video-seek-by-small-increment.html
1 <!DOCTYPE HTML>
2 <html>
3     <head>
4         <script src=media-file.js></script>
5         <script src=video-test.js></script>
6
7         <script>
8             var seekedEventCount = 0;
9             var increment = 0;
10
11             function seekIncrement()
12             {
13                 // We want to verify that seeking by an increment smaller than the test movie's time scale
14                 // (the smallest unit of time in that file) succeeds. test.mp4 has a time scale of 2500, 
15                 // 0.0004 seconds, so start with that and decrease by half each time.
16                 if (!increment)
17                     increment = 0.0004;
18                 else
19                     increment /= 2;
20                 return increment;
21             }
22
23             function seeked()
24             {
25                 if (++seekedEventCount == 8) {
26                     consoleWrite("");
27                     endTest();
28                     return;
29                 }
30                 attemptSeek();
31             }
32
33             function attemptSeek()
34             {
35                 var increment = seekIncrement();
36                 consoleWrite("<br>** Seeking by " + increment);
37                 video.currentTime += increment;
38             }
39
40             function start()
41             {
42                 findMediaElement();
43                 video.src = findMediaFile("video", "content/test");
44
45                 waitForEvent('canplaythrough', attemptSeek);
46                 waitForEvent('seeked', seeked);
47                 waitForEvent('seeking');
48                 waitForEvent('play');
49                 waitForEvent('pause');
50             }
51         </script>
52     </head>
53     <body>
54         <video controls></video>
55         <p>Test seeking by very small increments.</p>
56         <script>start()</script>
57     </body>
58 </html>