| Index: third_party/WebKit/LayoutTests/media/video-source-none-supported.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/video-source-none-supported.html b/third_party/WebKit/LayoutTests/media/video-source-none-supported.html
|
| index 07e0d36803f8030c6274c15286e66061c14f1527..d434876805c31286cd4df5e84f2478d23a69ff7e 100644
|
| --- a/third_party/WebKit/LayoutTests/media/video-source-none-supported.html
|
| +++ b/third_party/WebKit/LayoutTests/media/video-source-none-supported.html
|
| @@ -1,50 +1,31 @@
|
| <!DOCTYPE html>
|
| -<html>
|
| -<head>
|
| - <title>no usable <source> test</title>
|
| - <!-- 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>
|
| - document.addEventListener("error", errorEvent, true);
|
| +<title>Test that no usable "source" element leaves the media element with networkState == NETWORK_NO_SOURCE.</title>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<video>
|
| + <source src="test.mp4" type="audio/x-chicken-face"></source>
|
| + <source src="test.ogv" type="video/x-higglety-pigglety"></source>
|
| + <source src="doesnotexist.mp4"></source>
|
| +</video>
|
| +<script>
|
| +async_test(function(t) {
|
| + var errorCount = 0;
|
| + var video = document.querySelector("video");
|
|
|
| - function errorEvent(evt)
|
| - {
|
| - findMediaElement();
|
| - consoleWrite("++ ERROR, src = " + relativeURL(event.target.src) + ", type = \"" + event.target.type + "\"");
|
| - testExpected("event.target.tagName", "SOURCE", "==");
|
| -
|
| - // Any more source elements pending?
|
| - var nextSource = event.target.nextSibling;
|
| - while (video.hasChildNodes()) {
|
| - if (!nextSource || nextSource.tagName == "SOURCE")
|
| - break;
|
| - nextSource = nextSource.nextSibling;
|
| - }
|
| -
|
| - if (!nextSource) {
|
| - testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_NO_SOURCE, "==");
|
| - consoleWrite("");
|
| - endTest();
|
| + var sourceList = document.querySelectorAll("source");
|
| + for (var source of sourceList) {
|
| + source.onerror = t.step_func(function(event) {
|
| + errorCount++;
|
| + if (errorCount < 3) {
|
| + // Because the error event is fired asynchronously the network state
|
| + // can be either NETWORK_LOADING or NETWORK_NO_SOURCE, depending on
|
| + // whether or not any pending "source" element is available.
|
| + assert_greater_than(video.networkState, HTMLMediaElement.NETWORK_IDLE);
|
| } else {
|
| - // Because the error event is fired asynchronously the network state can be either
|
| - // NETWORK_LOADING or NETWORK_NO_SOURCE, depending on whether or not
|
| - testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_IDLE, ">");
|
| + assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
|
| + t.done();
|
| }
|
| -
|
| - consoleWrite("");
|
| - }
|
| - </script>
|
| -
|
| -</head>
|
| -<body>
|
| - <video controls>
|
| - <source src="test.mp4" type="audio/x-chicken-face">
|
| - <source src="test.ogv" type="video/x-higglety-pigglety">
|
| - <source src="doesnotexist.mp4">
|
| - </video>
|
| -
|
| - <p>1. Test that no usable <source> element leaves the media element with
|
| - networkState == NETWORK_NO_SOURCE</p>
|
| -</body>
|
| -</html>
|
| + });
|
| + }
|
| +});
|
| +</script>
|
|
|