Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html |
| diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html b/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html |
| index 687437ee9061740a86c481f784c6967a89f50f02..91b85693d736da0a8b1311863c8890f1dfecdcdd 100644 |
| --- a/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html |
| +++ b/third_party/WebKit/LayoutTests/http/tests/media/video-error-abort.html |
| @@ -1,67 +1,38 @@ |
| -<!DOCTYPE HTML> |
| -<html> |
| - <head> |
| - <title>'abort' event test</title> |
| - <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 didLoad = false; |
| - |
| - function loadstart() |
| - { |
| - consoleWrite("<br><b><em>'loadstart'</em> event</b>"); |
| - testExpected("video.error", null); |
| - |
| - if (didLoad) |
| - return; |
| - didLoad = true; |
| - |
| - // Force the element to reload, while the current movie is still loading, |
| - // this should generate an 'abort' event |
| - run("video.load()"); |
| - } |
| - |
| - function abort() |
| - { |
| - consoleWrite("<br><b><em>'abort'</em> event</b>"); |
| - testExpected("video.error", null); |
| - |
| - // Progress events have a 'lengthComputable' field, check to make sure this event |
| - // doesn't have one. |
| - testExpected("event.lengthComputable", undefined); |
| - } |
| - |
| - function canplaythrough() |
| - { |
| - consoleWrite("<br><b><em>'canplaythrough'</em> event</b>"); |
| - testExpected("video.error", null); |
| - |
| - consoleWrite(""); |
| - endTest(); |
| - } |
| - |
| - function start() |
| - { |
| - findMediaElement(); |
| - |
| - waitForEvent("error"); |
| - |
| - consoleWrite("<br><b>Test before movie is open</b>"); |
| - testExpected("video.error", null); |
| - |
| - var movie = findMediaFile("video", "../resources/test"); |
| - video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=256"; |
| - } |
| - </script> |
| - </head> |
| - |
| - <body onload="start()"> |
| - <video controls |
| - onloadstart="loadstart()" |
| - onabort="abort()" |
| - oncanplaythrough="canplaythrough()" |
| - ></video> |
| - </body> |
| -</html> |
| +<!DOCTYPE html> |
| +<title>Test "abort" event.</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="../../media-resources/media-file.js"></script> |
| +<video></video> |
| +<script> |
| +async_test(function(t) { |
|
fs
2016/07/22 14:59:46
This looks like a test that might even be simpler
Srirama
2016/07/22 17:37:30
Done.
|
| + var didLoad = false; |
| + var video = document.querySelector("video"); |
| + |
| + video.onerror = t.unreached_func(); |
| + // Test before movie is open. |
| + assert_equals(video.error, null); |
| + var movie = findMediaFile("video", "../resources/test"); |
| + video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=256"; |
| + |
| + video.onloadstart = t.step_func(function() { |
| + assert_equals(video.error, null); |
| + |
| + if (didLoad) |
| + return; |
| + didLoad = true; |
| + |
| + // Force the element to reload, while the current movie is still loading, |
| + // this should generate an "abort" event. |
| + video.load(); |
| + }); |
| + |
| + video.onabort = t.step_func(function() { |
| + assert_equals(video.error, null); |
| + }); |
| + |
| + video.oncanplaythrough = t.step_func_done(function() { |
| + assert_equals(video.error, null); |
| + }); |
| +}); |
| +</script> |