| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>drag timebar test</title> | 4 <title>drag timebar test</title> |
| 5 <script src=media-controls.js></script> | 5 <script src=media-controls.js></script> |
| 6 <script src=media-file.js></script> | 6 <script src=media-file.js></script> |
| 7 <script src=video-test.js></script> | 7 <script src=video-test.js></script> |
| 8 <script> | 8 <script> |
| 9 var x; | 9 var x; |
| 10 var y; | 10 var y; |
| 11 var seekCount; | 11 var seekCount; |
| 12 var moveCount; | 12 var moveCount; |
| 13 | 13 |
| 14 if (window.testRunner) | 14 if (window.testRunner) |
| 15 testRunner.dumpAsText(); | 15 testRunner.dumpAsText(); |
| 16 | 16 |
| 17 function test() | 17 function test() |
| 18 { | 18 { |
| 19 seekCount = 0; | 19 seekCount = 0; |
| 20 moveCount = 0; | 20 moveCount = 0; |
| 21 | 21 |
| 22 testExpected("video.paused", false); |
| 23 |
| 22 if (window.eventSender) { | 24 if (window.eventSender) { |
| 23 | |
| 24 var seekCoords; | 25 var seekCoords; |
| 25 try { | 26 try { |
| 26 seekCoords = mediaControlsButtonCoordinates(video, "time
line"); | 27 seekCoords = mediaControlsButtonCoordinates(video, "time
line"); |
| 27 } catch (exception) { | 28 } catch (exception) { |
| 28 failTest(exception.description); | 29 failTest(exception.description); |
| 29 return; | 30 return; |
| 30 } | 31 } |
| 31 x = seekCoords[0]; | 32 x = seekCoords[0]; |
| 32 y = seekCoords[1]; | 33 y = seekCoords[1]; |
| 33 | 34 |
| 34 eventSender.dragMode = false; | 35 eventSender.dragMode = false; |
| 35 eventSender.mouseMoveTo(x, y); | 36 eventSender.mouseMoveTo(x, y); |
| 36 eventSender.mouseDown(); | 37 eventSender.mouseDown(); |
| 37 | 38 |
| 39 testExpected("video.paused", true); |
| 40 |
| 38 // Drag mouse off of the slider thumb to make sure it contin
ues to track | 41 // Drag mouse off of the slider thumb to make sure it contin
ues to track |
| 39 y += 100; | 42 y += 100; |
| 40 eventSender.mouseMoveTo(x, y); | 43 eventSender.mouseMoveTo(x, y); |
| 41 } | 44 } |
| 42 window.setTimeout("move()", 100); | 45 window.setTimeout("move()", 100); |
| 43 } | 46 } |
| 44 | 47 |
| 45 function move() | 48 function move() |
| 46 { | 49 { |
| 47 ++moveCount; | 50 ++moveCount; |
| 48 | 51 |
| 49 var delta = (10 + moveCount * 2) * (moveCount % 2 ? 1 : -1); | 52 var delta = (10 + moveCount * 2) * (moveCount % 2 ? 1 : -1); |
| 50 | 53 |
| 51 if (window.eventSender) { | 54 if (window.eventSender) { |
| 52 x += delta; | 55 x += delta; |
| 53 eventSender.mouseMoveTo(x, y); | 56 eventSender.mouseMoveTo(x, y); |
| 54 } | 57 } |
| 55 } | 58 } |
| 56 | 59 |
| 57 function seeked() | 60 function seeked() |
| 58 { | 61 { |
| 62 |
| 59 ++seekCount; | 63 ++seekCount; |
| 60 if (seekCount < 6) { | 64 if (seekCount < 6) { |
| 61 window.setTimeout("move()", 100); | 65 window.setTimeout("move()", 100); |
| 62 return; | 66 return; |
| 63 } | 67 } |
| 64 | 68 |
| 65 if (window.eventSender) | 69 if (window.eventSender) { |
| 70 testExpected("video.paused", true); |
| 66 eventSender.mouseUp(); | 71 eventSender.mouseUp(); |
| 72 } |
| 73 |
| 74 testExpected("video.paused", false); |
| 75 |
| 67 endTest(); | 76 endTest(); |
| 68 } | 77 } |
| 69 | 78 |
| 70 function start() | 79 function start() |
| 71 { | 80 { |
| 72 findMediaElement(); | 81 findMediaElement(); |
| 73 waitForEventOnce('canplaythrough', test); | 82 waitForEventOnce('playing', test); |
| 74 waitForEvent('seeked', seeked); | 83 waitForEvent('seeked', seeked); |
| 75 video.src = findMediaFile("video", "content/test"); | 84 video.src = findMediaFile("video", "content/test"); |
| 76 } | 85 video.play(); |
| 86 } |
| 77 </script> | 87 </script> |
| 78 </head> | 88 </head> |
| 79 | 89 |
| 80 <body onload="start()"> | 90 <body onload="start()"> |
| 81 <p>Test that dragging the timebar thumb causes seeks.</p> | 91 <p>Test that dragging the timebar thumb causes seeks.</p> |
| 82 <video controls></video> | 92 <video controls></video> |
| 83 </body> | 93 </body> |
| 84 </html> | 94 </html> |
| OLD | NEW |