Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/video-src-empty.html |
| diff --git a/third_party/WebKit/LayoutTests/media/video-src-empty.html b/third_party/WebKit/LayoutTests/media/video-src-empty.html |
| index 06d62385b3ef3155cea7cd17deb6b3996bd681ad..260c36a55ecca8b90bafe8888f35c63fa1e415fd 100644 |
| --- a/third_party/WebKit/LayoutTests/media/video-src-empty.html |
| +++ b/third_party/WebKit/LayoutTests/media/video-src-empty.html |
| @@ -1,45 +1,31 @@ |
| <!DOCTYPE html> |
| -<html> |
| - <head> |
| - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
| - (Please avoid writing new tests using video-test.js) --> |
| - <script src=video-test.js></script> |
| - <script src=media-file.js></script> |
| - <script> |
| +<title>Video element with src="" should invoke media element's load algorithm and should fire "error" event. Network state should be NETWORK_NO_SOURCE and the error code should be MEDIA_ERR_SRC_NOT_SUPPORTED.</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="media-file.js"></script> |
| +<video></video> |
| +<script> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| - function start() |
| - { |
| - findMediaElement(); |
| + video.onloadstart = t.step_func(function() {}); |
| + video.onloadedmetadata = t.step_func(function() {}); |
| + video.onloadeddata = t.step_func(function() {}); |
| + video.onabort = t.step_func(function() {}); |
| + video.onemptied = t.step_func(function() {}); |
| - waitForEvent("loadstart"); |
| - waitForEvent("loadedmetadata"); |
| - waitForEvent("loadeddata"); |
| - waitForEvent("abort"); |
| - waitForEvent("emptied"); |
| - waitForEvent("canplaythrough", testLoad); |
| - waitForEvent("error", errorEvent); |
| - consoleWrite("** <video> with valid non-empty 'src' attribute**"); |
| - video.src = findMediaFile("video", "content/test"); |
| - } |
| + video.oncanplaythrough = t.step_func(function() { |
| + // video with empty src attribute. |
| + video.src = ""; |
|
fs
2016/06/25 17:12:03
Maybe it would be better to start out with onerror
Srirama
2016/06/26 05:41:55
Done.
|
| + }); |
| - function errorEvent() |
| - { |
| - consoleWrite("<br>'error' event:"); |
| - testExpected('event.target', video); |
| - testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
| - testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE); |
| - endTest(); |
| - } |
| + video.onerror = t.step_func_done(function() { |
|
fs
2016/06/25 17:12:03
Nit: Add 'event' as argument?
Srirama
2016/06/26 05:41:55
Done.
|
| + assert_equals(event.target, video); |
| + assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
| + assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE); |
| + }); |
| - function testLoad() |
| - { |
| - consoleWrite("<br>** <video> with empty src attribute**"); |
| - run('video.src = ""'); |
| - } |
| - </script> |
| - </head> |
| - <body onload="start()"> |
| - <video width=320 height=60 controls></video> |
| - <p> <video> element with src="" should invoke media element's load algorithm and should fire 'error' event. Network state should be NETWORK_NO_SOURCE and set error to MEDIA_ERR_SRC_NOT_SUPPORTED.</p> |
| - </body> |
| -</html> |
| + // video with valid non-empty "src" attribute. |
| + video.src = findMediaFile("video", "content/test"); |
| +}); |
| +</script> |