| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <title>Test rendering of volume slider of video tag</title> | |
| 4 <script src=media-file.js></script> | |
| 5 <script src=media-controls.js></script> | |
| 6 <script src=video-test.js></script> | |
| 7 <script> | |
| 8 var video; | |
| 9 var panel; | |
| 10 var threshold = 2; | |
| 11 | |
| 12 var muteButtonCoordinates; | |
| 13 var volumeSliderCoordinates; | |
| 14 | |
| 15 var volumeSliderElement; | |
| 16 var muteButtonElement; | |
| 17 | |
| 18 function init() | |
| 19 { | |
| 20 video = document.getElementsByTagName("video")[0]; | |
| 21 video.src = findMediaFile("video", "content/test"); | |
| 22 } | |
| 23 | |
| 24 function test() | |
| 25 { | |
| 26 if (window.eventSender) { | |
| 27 try { | |
| 28 muteButtonCoordinates = mediaControlsButtonCoordinates(video
, "mute-button"); | |
| 29 volumeSliderCoordinates = mediaControlsButtonCoordinates(vid
eo, "volume-slider-container"); | |
| 30 } catch (exception) { | |
| 31 testRunner.notifyDone(); | |
| 32 return; | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 panel = mediaControlsElement(internals.shadowRoot(video).firstChild,
"-webkit-media-controls-panel"); | |
| 37 volumeSliderElement = mediaControlsElement(internals.shadowRoot(vide
o).firstChild, "-webkit-media-controls-volume-slider-container"); | |
| 38 muteButtonElement = mediaControlsElement(internals.shadowRoot(video)
.firstChild, "-webkit-media-controls-mute-button"); | |
| 39 | |
| 40 // Ensure paint without controls. | |
| 41 video.controls = false; | |
| 42 document.body.offsetTop; | |
| 43 | |
| 44 // Ensure (re)paint with controls displayed. | |
| 45 video.controls = true; | |
| 46 document.body.offsetTop; | |
| 47 | |
| 48 // Move the mouse back over the mute button. | |
| 49 eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordina
tes[1]); | |
| 50 | |
| 51 // Test that the left offset of both controls is equal. | |
| 52 consoleWrite(""); | |
| 53 consoleWrite("** The volume slider should have almost the same left
offset as the mute button **"); | |
| 54 testExpected("volumeSliderElement.offsetLeft >= muteButtonElement.of
fsetLeft - threshold", true); | |
| 55 testExpected("volumeSliderElement.offsetLeft <= muteButtonElement.of
fsetLeft + threshold", true); | |
| 56 | |
| 57 consoleWrite(""); | |
| 58 consoleWrite("** The volume slider should be on top of the mute butt
on **"); | |
| 59 testExpected("volumeSliderElement.offsetTop < muteButtonElement.offs
etTop", true); | |
| 60 | |
| 61 testRunner.notifyDone(); | |
| 62 } | |
| 63 </script> | |
| 64 </head> | |
| 65 <body onload="init()"> | |
| 66 Tests that the video controls are properly rendered when the display none is
set and unset.<br> | |
| 67 | |
| 68 <video oncanplaythrough="test()" controls preload="true"></video> | |
| 69 </body> | |
| 70 </html> | |
| OLD | NEW |