| Index: third_party/WebKit/LayoutTests/media/video-delay-load-event.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/video-delay-load-event.html b/third_party/WebKit/LayoutTests/media/video-delay-load-event.html
|
| index 7de7b4b2f2b2afed00e5f265f65748e2f0c6c42f..35922274cc01f830a919faa84e7d620845bfc49d 100644
|
| --- a/third_party/WebKit/LayoutTests/media/video-delay-load-event.html
|
| +++ b/third_party/WebKit/LayoutTests/media/video-delay-load-event.html
|
| @@ -1,72 +1,46 @@
|
| -<!doctype html>
|
| -<html>
|
| - <head>
|
| - <title>delay document 'load' event test</title>
|
| - <style> video { border: 3px solid red; } </style>
|
| - <!-- 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>
|
| - var video;
|
| -
|
| - function testMovieWithNoSource(elem)
|
| - {
|
| - video = elem; // Need it in a global for testExpected() to see it.
|
| - consoleWrite("<em>no 'src'.</em>");
|
| - testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_EMPTY, "==");
|
| - testExpected("video.readyState", HTMLMediaElement.prototype.HAVE_NOTHING, "==");
|
| - }
|
| -
|
| - function testMovieWithSource(elem, hasLoaded, msg)
|
| - {
|
| - video = elem; // Need it in a global for testExpected() to see it.
|
| - consoleWrite(msg);
|
| - if (hasLoaded) {
|
| - // The movie should have loaded at least to HAVE_CURRENT_DATA
|
| - testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "!=");
|
| - testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_IDLE, ">=");
|
| - testExpected("video.readyState", HTMLMediaElement.prototype.HAVE_CURRENT_DATA, ">=");
|
| - } else {
|
| - testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "==");
|
| - testExpected("video.readyState", HTMLMediaElement.prototype.HAVE_NOTHING, "==");
|
| - }
|
| - }
|
| -
|
| - function loaded()
|
| - {
|
| - consoleWrite("<br><b>document <em>'load'<" + "/em> event handler</b>");
|
| -
|
| - testMovieWithNoSource(document.getElementById('video-1'));
|
| - testMovieWithSource(document.getElementById('video-2'), true, "<br><em>with 'src' attribute.</em>");
|
| - testMovieWithSource(document.getElementById('video-3'), true, "<br><em>with <source> element.</em>");
|
| -
|
| - if (window.testRunner)
|
| - testRunner.notifyDone();
|
| - }
|
| - </script>
|
| - </head>
|
| - <body onload="loaded()">
|
| - <video id="video-1"></video>
|
| - <video id="video-2"></video>
|
| - <video id="video-3"><source id="source-1"></video>
|
| -
|
| - <p>Test the document's load event is delayed until a movie's meta data is available.</p>
|
| -
|
| - <script>
|
| - consoleWrite("<br><b>inline script</b>");
|
| -
|
| - testMovieWithNoSource(document.getElementById('video-1'));
|
| -
|
| - video = document.getElementById('video-2');
|
| - video.src = findMediaFile("video", "content/test");
|
| - testMovieWithSource(video, false, "<br><em>with 'src' attribute.</em>");
|
| -
|
| - source = document.getElementById('source-1');
|
| - source.src = findMediaFile("video", "content/test");
|
| - testMovieWithSource(document.getElementById('video-3'), false, "<br><em>with <source> element.</em>");
|
| - document.getElementById('video-3').load();
|
| - </script>
|
| -
|
| - </body>
|
| -</html>
|
| +<!DOCTYPE html>
|
| +<title>Test that the document's load event is delayed until a video's meta data is available.</title>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="media-file.js"></script>
|
| +<video id="video1"></video>
|
| +<video id="video2"></video>
|
| +<video id="video3"><source></source></video>
|
| +<script>
|
| +async_test(function(t) {
|
| + assertVideoNoSrcNoLoad(document.getElementById("video1"));
|
| +
|
| + var video = document.getElementById("video2");
|
| + video.src = findMediaFile("video", "content/test");
|
| + assertVideoSrcNoLoad(video);
|
| +
|
| + var source = document.querySelector("source");
|
| + source.src = findMediaFile("video", "content/test");
|
| + assertVideoSrcNoLoad(document.getElementById("video3"));
|
| +
|
| + window.onload = t.step_func_done(function() {
|
| + assertVideoNoSrcNoLoad(document.getElementById("video1"));
|
| + assertVideoSrcLoad(document.getElementById("video2"));
|
| + assertVideoSrcLoad(document.getElementById("video3"));
|
| + });
|
| +
|
| + function assertVideoNoSrcNoLoad(video) {
|
| + // Video should not load as there is no "src".
|
| + assert_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);
|
| + assert_equals(video.readyState, HTMLMediaElement.HAVE_NOTHING);
|
| + }
|
| +
|
| + function assertVideoSrcNoLoad(video) {
|
| + // Video loading has just triggered.
|
| + assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
|
| + assert_equals(video.readyState, HTMLMediaElement.HAVE_NOTHING);
|
| + }
|
| +
|
| + function assertVideoSrcLoad(video) {
|
| + // The Video should have loaded at least to HAVE_CURRENT_DATA
|
| + assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
|
| + assert_greater_than_equal(video.networkState, HTMLMediaElement.NETWORK_IDLE);
|
| + assert_greater_than_equal(video.readyState, HTMLMediaElement.HAVE_CURRENT_DATA);
|
| + }
|
| +});
|
| +</script>
|
|
|