Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <title>media controls overlay play button document move</title> | |
|
mlamouri (slow - plz ping)
2017/03/08 19:13:04
Could you get these tests in media/controls/ but n
steimel
2017/03/09 16:42:23
Done.
| |
| 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 enableOverlayPlayButtonForTest(t); | |
| 14 | |
| 15 var video = createAndMoveVideo(); | |
| 16 | |
| 17 video.onloadedmetadata = t.step_func(function() { | |
| 18 // Large-enough video should have an overlay play button. | |
| 19 assertOverlayPlayButtonVisible(video); | |
| 20 | |
| 21 // If the width goes under the minimum, the button should be hidden. | |
| 22 video.width = NARROW_VIDEO_WIDTH; | |
| 23 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { | |
| 24 assertOverlayPlayButtonNotVisible(video); | |
| 25 | |
| 26 // Re-widening the video should display the button. | |
| 27 video.width = NORMAL_VIDEO_WIDTH; | |
| 28 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { | |
| 29 assertOverlayPlayButtonVisible(video); | |
| 30 | |
| 31 // If the height goes under the minimum, the button should be hidden. | |
| 32 video.height = NARROW_VIDEO_HEIGHT; | |
| 33 testRunner.layoutAndPaintAsyncThen(t.step_func(function() { | |
| 34 assertOverlayPlayButtonNotVisible(video); | |
| 35 | |
| 36 // Re-heightening the video should display the button. | |
| 37 video.height = NORMAL_VIDEO_HEIGHT; | |
| 38 testRunner.layoutAndPaintAsyncThen(t.step_func_done(function() { | |
| 39 assertOverlayPlayButtonVisible(video); | |
| 40 })); | |
| 41 })); | |
| 42 })); | |
| 43 })); | |
| 44 }); | |
| 45 | |
| 46 function createAndMoveVideo() { | |
| 47 var doc = document.implementation.createHTMLDocument(); | |
| 48 var v = doc.createElement('video'); | |
| 49 v.src = findMediaFile('video', '../../../../media/content/test'); | |
| 50 v.width = NORMAL_VIDEO_WIDTH; | |
| 51 v.height = NORMAL_VIDEO_HEIGHT; | |
| 52 v.controls = true; | |
| 53 doc.body.appendChild(v); | |
| 54 doc.body.removeChild(v); | |
| 55 document.body.appendChild(v); | |
| 56 return v; | |
| 57 } | |
| 58 }); | |
| 59 </script> | |
| 60 </body> | |
| OLD | NEW |