upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / media / video-played-reset.html
1 <html>
2     <head>
3         <title>Test of 'played' attribute</title>
4         <script src=media-file.js></script>
5         <script src=video-test.js></script>
6         <script src=video-played.js></script>
7         <script>
8     
9             var testFunctions = 
10             [ 
11                 PlayWithNoRanges,
12                 ResetToAVideoSource,
13                 JumpAndPlayFwd,
14                 ResetToAnEmptyVideoSource
15             ];
16     
17             // NOTE: Result details are not printed for this test because time values are different from machine
18             // to machine and run to run. Commenting out the following line turns on detailed logging back on, which
19             // can be useful for debugging test failure.
20             disableFullTestDetailsPrinting(); 
21
22             function PlayWithNoRanges()
23             {
24                 consoleWrite("<br><b><em>Test playing when there are no ranges</em></b>");
25
26                 timeRangeCount = currentTimeRange = 0;
27                 willPauseInExistingRange = false;
28                 willExtendAnExistingRange = false;
29
30                 startPlayingInNewRange();
31             }
32         
33             function ResetToAVideoSource()
34             {
35                 consoleWrite("<br><b><em>Test to reset to non empty video source</em></b>");
36     
37                 timeRangeCount = currentTimeRange = 0;
38                 expectedStartTimes = new Array();
39                 expectedEndTimes = new Array();
40
41                 willPauseInExistingRange = false;
42                 willExtendAnExistingRange = false;
43
44                 var mediaFile = findMediaFile("video", "content/test");
45                 runSilently("video.src = \"" + mediaFile + "\"");
46                 run("video.load()"); // Triggers canplay()
47             }
48
49             function JumpAndPlayFwd()
50             {
51                 consoleWrite("<br><b><em>Test jumping forward into a new range and play</em></b>");
52
53                 var newTime = video.duration - 0.5;
54                 runSilently("video.currentTime = " + (newTime.toFixed(2)));
55
56                 willPauseInExistingRange = false;
57                 willExtendAnExistingRange = false;
58                 currentTimeRange = 1;
59
60                 startPlayingInNewRange();
61             }
62
63             function ResetToAnEmptyVideoSource()
64             {
65                 consoleWrite("<br><b><em>Test to reset to an empty video source</em></b>");
66     
67                 willPauseInExistingRange = false;
68                 willExtendAnExistingRange = false;
69                 timeRangeCount = currentTimeRange = 0;
70
71                 expectedStartTimes = new Array();
72                 expectedEndTimes = new Array();
73
74                 run("video.src = \"\"");
75                 waitForEvent("loadstart", function () { testRanges(); nextTest(); });
76                 run("video.load()"); // Triggers loadstart()
77             }
78         </script>
79      </head>
80
81 <body onload="videoPlayedMain()">
82
83     <video controls></video>
84     <p>Test of the media element 'played' attribute</p>
85
86 </body>
87 </html>