OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>media controls overlay play button narrow</title> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script src="../media-file.js"></script> |
| 6 <script src="../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 enableOverlayPlayButtonForTest(t); |
| 14 |
| 15 var video = document.createElement('video'); |
| 16 video.src = findMediaFile("video", "../content/test"); |
| 17 video.width = NORMAL_VIDEO_WIDTH; |
| 18 video.height = NORMAL_VIDEO_HEIGHT; |
| 19 video.controls = true; |
| 20 document.body.appendChild(video); |
| 21 |
| 22 video.onloadedmetadata = t.step_func(function() { |
| 23 // Large-enough video should have an overlay play button. |
| 24 assertOverlayPlayButtonVisible(video); |
| 25 |
| 26 // If the width goes under the minimum, the button should be hidden. |
| 27 video.width = NARROW_VIDEO_WIDTH; |
| 28 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { |
| 29 assertOverlayPlayButtonNotVisible(video); |
| 30 |
| 31 // Re-widening the video should display the button. |
| 32 video.width = NORMAL_VIDEO_WIDTH; |
| 33 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { |
| 34 assertOverlayPlayButtonVisible(video); |
| 35 |
| 36 // If the height goes under the minimum, the button should be hidden. |
| 37 video.height = NARROW_VIDEO_HEIGHT; |
| 38 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { |
| 39 assertOverlayPlayButtonNotVisible(video); |
| 40 |
| 41 // Re-heightening the video should display the button. |
| 42 video.height = NORMAL_VIDEO_HEIGHT; |
| 43 testRunner.layoutAndPaintAsyncThen(t.step_func_done(function() { |
| 44 assertOverlayPlayButtonVisible(video); |
| 45 })); |
| 46 })); |
| 47 })); |
| 48 })); |
| 49 }); |
| 50 }); |
| 51 </script> |
| 52 </body> |
OLD | NEW |