OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Test that the overlay play button respects the controls attribute.</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 <body> |
| 8 <script> |
| 9 async_test(function(t) { |
| 10 var mediaControlsOverlayPlayButtonValue = |
| 11 internals.runtimeFlags.mediaControlsOverlayPlayButtonEnabled; |
| 12 internals.runtimeFlags.mediaControlsOverlayPlayButtonEnabled = true; |
| 13 |
| 14 t.add_cleanup(() => { |
| 15 internals.runtimeFlags.mediaControlsOverlayPlayButtonEnabled = |
| 16 mediaControlsOverlayPlayButtonValue; |
| 17 }); |
| 18 |
| 19 // Add video dynamically, since otherwise the controls are created, but |
| 20 // hidden, before the setting is set, causing the setting to be ignored. |
| 21 var video = document.createElement('video'); |
| 22 document.body.appendChild(video); |
| 23 |
| 24 video.controls = true; |
| 25 var button = mediaControlsButton(video, 'overlay-play-button') |
| 26 assert_equals(getComputedStyle(button).display, 'flex'); |
| 27 |
| 28 var watcher = new EventWatcher(t, video, ['loadeddata', 'play', 'pause']); |
| 29 watcher.wait_for('loadeddata').then(t.step_func(function() { |
| 30 video.play(); |
| 31 return watcher.wait_for('play'); |
| 32 })).then(t.step_func(function() { |
| 33 assert_equals(getComputedStyle(button).display, 'none'); |
| 34 video.pause(); |
| 35 return watcher.wait_for('pause'); |
| 36 })).then(t.step_func(function() { |
| 37 assert_equals(getComputedStyle(button).display, 'flex'); |
| 38 video.controls = false; |
| 39 assert_equals(getComputedStyle(button).display, 'none'); |
| 40 video.play(); |
| 41 return watcher.wait_for('play'); |
| 42 })).then(t.step_func(function() { |
| 43 assert_equals(getComputedStyle(button).display, 'none'); |
| 44 video.pause(); |
| 45 return watcher.wait_for('pause'); |
| 46 })).then(t.step_func_done(function() { |
| 47 assert_equals(getComputedStyle(button).display, 'none'); |
| 48 video.controls = true; |
| 49 assert_equals(getComputedStyle(button).display, 'flex'); |
| 50 })); |
| 51 |
| 52 video.src = findMediaFile('video', '../content/test'); |
| 53 }); |
| 54 </script> |
OLD | NEW |