| 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 internals.settings.setMediaControlsOverlayPlayButtonEnabled(true); | |
| 11 | |
| 12 // Add video dynamically, since otherwise the controls are created, but | |
| 13 // hidden, before the setting is set, causing the setting to be ignored. | |
| 14 var video = document.createElement("video"); | |
| 15 document.body.appendChild(video); | |
| 16 | |
| 17 video.controls = true; | |
| 18 var button = mediaControlsButton(video, "overlay-play-button") | |
| 19 assert_equals(getComputedStyle(button).display, "flex"); | |
| 20 | |
| 21 var watcher = new EventWatcher(t, video, ["loadeddata", "play", "pause"]); | |
| 22 watcher.wait_for("loadeddata").then(t.step_func(function() { | |
| 23 video.play(); | |
| 24 return watcher.wait_for("play"); | |
| 25 })).then(t.step_func(function() { | |
| 26 assert_equals(getComputedStyle(button).display, "none"); | |
| 27 video.pause(); | |
| 28 return watcher.wait_for("pause"); | |
| 29 })).then(t.step_func(function() { | |
| 30 assert_equals(getComputedStyle(button).display, "flex"); | |
| 31 video.controls = false; | |
| 32 assert_equals(getComputedStyle(button).display, "none"); | |
| 33 video.play(); | |
| 34 return watcher.wait_for("play"); | |
| 35 })).then(t.step_func(function() { | |
| 36 assert_equals(getComputedStyle(button).display, "none"); | |
| 37 video.pause(); | |
| 38 return watcher.wait_for("pause"); | |
| 39 })).then(t.step_func_done(function() { | |
| 40 assert_equals(getComputedStyle(button).display, "none"); | |
| 41 video.controls = true; | |
| 42 assert_equals(getComputedStyle(button).display, "flex"); | |
| 43 })); | |
| 44 | |
| 45 video.src = findMediaFile("video", "content/test"); | |
| 46 }); | |
| 47 </script> | |
| OLD | NEW |