4 <title>Media test: seek tests
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
7 <script type=
"text/javascript" src=
"manifest.js"></script>
8 <script type=
"text/javascript" src=
"seek_support.js"></script>
12 <script class=
"testbody" type=
"text/javascript">
14 // The data being used in these tests is specified in manifest.js.
15 // The functions to build the test array and to run a specific test are in
18 const SEEK_TEST_NUMBER =
1;
20 function test_seek1(v, seekTime, is, ok, finish) {
22 var startPassed = false;
23 var endPassed = false;
24 var seekFlagStart = false;
25 var seekFlagEnd = false;
27 var completed = false;
29 function startTest() {
30 ok(!completed,
"Should not be completed yet");
31 ok(!v.seeking,
"seeking should default to false");
34 readonly = v.seeking === false;
37 readonly =
"threw exception: " + e;
39 is(readonly, true,
"seeking should be readonly");
41 v.currentTime = seekTime;
42 seekFlagStart = v.seeking;
45 function seekStarted() {
46 ok(!completed,
"should not be completed yet");
47 ok(Math.abs(v.currentTime - seekTime) <
0.1,
48 "Video currentTime should be around " + seekTime +
": " + v.currentTime +
" (seeking)");
52 function seekEnded() {
53 ok(!completed,
"shuld not be completed yet");
54 ok(Math.abs(v.currentTime - seekTime) <
0.1,
55 "Video currentTime should be around " + seekTime +
": " + v.currentTime +
" (seeked)");
57 seekFlagEnd = v.seeking;
61 function playbackEnded() {
62 ok(!completed,
"should not be completed yet");
65 ok(startPassed,
"seeking event");
66 ok(endPassed,
"seeked event");
67 ok(seekFlagStart,
"seeking flag on start should be true");
68 ok(!seekFlagEnd,
"seeking flag on end should be false");
72 once(v,
"ended", playbackEnded);
73 once(v,
"loadedmetadata", startTest);
74 once(v,
"seeking", seekStarted);
75 once(v,
"seeked", seekEnded);
79 manager.runTests(createTestArray(), startTest);