Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html b/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html |
| index fda0149e52af01b4c488e19ceff73b24dab14e4f..c6518f1157b2d176b2dde5e5f3f8e352d280a908 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html |
| +++ b/third_party/WebKit/LayoutTests/http/tests/media/reload-after-dialog.html |
| @@ -1,66 +1,27 @@ |
| <!DOCTYPE html> |
| -<html> |
| - <head> |
| - <script src=../../media-resources/media-file.js></script> |
| - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
| - (Please avoid writing new tests using video-test.js) --> |
| - <script src=../../media-resources/video-test.js></script> |
| - <script> |
| - var loadCount = 0; |
| - |
| - if (window.testRunner) { |
| - testRunner.dumpAsText(); |
| - testRunner.waitUntilDone(); |
| - } |
| - |
| - function logEvent(event) |
| - { |
| - consoleWrite("<br><b><em>'" + event.type + "'<" + "/em> event<" + "/b>"); |
| - } |
| - |
| - function loadstart() |
| - { |
| - logEvent(event); |
| - |
| - if (++loadCount > 1) { |
| - consoleWrite('FAIL: loadstart fired more than once.'); |
| - endTest(); |
| - return; |
| - } |
| - |
| - consoleWrite("*** Showing confirm dialog..."); |
| - confirm('I hope the movie continues to play!'); |
| - } |
| - |
| - function canplaythrough() |
| - { |
| - logEvent(event); |
| - |
| - consoleWrite(""); |
| - endTest(); |
| - } |
| - |
| - function setup() |
| - { |
| - logEvent(event); |
| - consoleWrite("*** Setting up element..."); |
| - |
| - findMediaElement(); |
| - var movie = findMediaFile("video", "../resources/test"); |
| - video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=100"; |
| - } |
| - |
| - </script> |
| - </head> |
| - |
| - <body onload="setup()"> |
| - <video controls |
| - oncanplaythrough="canplaythrough()" |
| - onloadstart="loadstart()"> |
| - </video> |
| - <p>Make sure we don't reload a <video> element after a dialog is shown.<br> |
| - Test this by loading a movie slowly and showing a dialog when a 'loadstart' event <br> |
| - handler is called. If the movie is reloaded when the dialog is "dismissed", another <br> |
| - 'loadstart' event will be fired</p> |
| - </body> |
| -</html> |
| +<title>Test that video is not reloaded on showing a dialog.</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../../media-resources/media-file.js"></script> |
| +<video></video> |
| +<script> |
| +// Make sure we don't reload a "video" element after a dialog is shown. |
| +// Test this by loading a movie slowly and showing a dialog when a |
| +// "loadstart" event handler is called. If the movie is reloaded when |
| +// the dialog is "dismissed", another "loadstart" event will be fired. |
| +async_test(function(t) { |
| + var movie = findMediaFile("video", "../resources/test"); |
| + var video = document.querySelector("video"); |
| + |
| + video.onloadstart = t.step_func(function() { |
| + video.onloadstart = t.unreached_func(); |
| + |
| + // Showing confirm dialog. |
| + confirm("I hope the movie continues to play!"); |
|
Srirama
2016/08/18 13:25:59
will the test framework dismiss the confirm dialog
fs
2016/08/18 14:04:05
IIRC it'll log and return true.
|
| + }); |
| + |
| + video.oncanplaythrough = t.step_func_done(); |
| + |
| + video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=100"; |
| +}); |
| +</script> |