OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>media controls overlay play button document move</title> |
| 3 <script src="../../../../resources/testharness.js"></script> |
| 4 <script src="../../../../resources/testharnessreport.js"></script> |
| 5 <script src="../../../../media/media-file.js"></script> |
| 6 <script src="../../../../media/media-controls.js"></script> |
| 7 <script src="overlay-play-button.js"></script> |
| 8 <body> |
| 9 <script> |
| 10 async_test(function(t) { |
| 11 // Make sure the overlay play button is turned on, as it's typically off |
| 12 // unless we're dealing with Android. |
| 13 internals.settings.setMediaControlsOverlayPlayButtonEnabled(true); |
| 14 var video = createAndMoveVideo(); |
| 15 |
| 16 video.onloadedmetadata = t.step_func(function() { |
| 17 // Large-enough video should have an overlay play button. |
| 18 assertOverlayPlayButtonVisible(video); |
| 19 |
| 20 // If the width goes under the minimum, the button should be hidden. |
| 21 video.width = MIN_VIDEO_WIDTH - 10; |
| 22 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { |
| 23 assertOverlayPlayButtonNotVisible(video); |
| 24 |
| 25 // Re-widening the video should display the button. |
| 26 video.width = MIN_VIDEO_WIDTH; |
| 27 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { |
| 28 assertOverlayPlayButtonVisible(video); |
| 29 |
| 30 // If the height goes under the minimum, the button should be hidden. |
| 31 video.height = MIN_VIDEO_HEIGHT - 10; |
| 32 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { |
| 33 assertOverlayPlayButtonNotVisible(video); |
| 34 |
| 35 // Re-heightening the video should display the button. |
| 36 video.height = MIN_VIDEO_HEIGHT; |
| 37 testRunner.layoutAndPaintAsyncThen(t.step_func_done(function() { |
| 38 assertOverlayPlayButtonVisible(video); |
| 39 })); |
| 40 })); |
| 41 })); |
| 42 })); |
| 43 }); |
| 44 |
| 45 function createAndMoveVideo() { |
| 46 var doc = document.implementation.createHTMLDocument(); |
| 47 var v = doc.createElement('video'); |
| 48 v.src = findMediaFile('video', '../../../../media/content/test'); |
| 49 v.width = 200; |
| 50 v.height = 200; |
| 51 v.controls = true; |
| 52 doc.body.appendChild(v); |
| 53 doc.body.removeChild(v); |
| 54 document.body.appendChild(v); |
| 55 return v; |
| 56 } |
| 57 }); |
| 58 </script> |
| 59 </body> |
OLD | NEW |