Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / controls-drag-timebar.html
blobd2f546b09e9134f256ab39ce9a7c12fd6625400b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>drag timebar test</title>
5 <script src=media-controls.js></script>
6 <script src=media-file.js></script>
7 <script src=video-test.js></script>
8 <script>
9 var x;
10 var y;
11 var seekCount;
12 var moveCount;
14 if (window.testRunner)
15 testRunner.dumpAsText();
17 function test()
19 seekCount = 0;
20 moveCount = 0;
22 testExpected("video.paused", false);
24 if (window.eventSender) {
25 var seekCoords;
26 try {
27 seekCoords = mediaControlsButtonCoordinates(video, "timeline");
28 } catch (exception) {
29 failTest(exception.description);
30 return;
32 x = seekCoords[0];
33 y = seekCoords[1];
35 eventSender.dragMode = false;
36 eventSender.mouseMoveTo(x, y);
37 eventSender.mouseDown();
39 testExpected("video.paused", true);
41 // Drag mouse off of the slider thumb to make sure it continues to track
42 y += 100;
43 eventSender.mouseMoveTo(x, y);
45 window.setTimeout("move()", 100);
48 function move()
50 ++moveCount;
52 var delta = (10 + moveCount * 2) * (moveCount % 2 ? 1 : -1);
54 if (window.eventSender) {
55 x += delta;
56 eventSender.mouseMoveTo(x, y);
60 function seeked()
63 ++seekCount;
64 if (seekCount < 6) {
65 window.setTimeout("move()", 100);
66 return;
69 if (window.eventSender) {
70 testExpected("video.paused", true);
71 eventSender.mouseUp();
74 testExpected("video.paused", false);
76 endTest();
79 function start()
81 findMediaElement();
82 waitForEventOnce('playing', test);
83 waitForEvent('seeked', seeked);
84 video.src = findMediaFile("video", "content/test");
85 video.play();
87 </script>
88 </head>
90 <body onload="start()">
91 <p>Test that dragging the timebar thumb causes seeks.</p>
92 <video controls></video>
93 </body>
94 </html>