| Index: third_party/WebKit/LayoutTests/media/video-src-remove.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/video-src-remove.html b/third_party/WebKit/LayoutTests/media/video-src-remove.html
|
| index 730aa81157158b8d3858f82e10c8014941dde49a..0abcdaa1b2a70b28f0c0c02a660adce82a826936 100644
|
| --- a/third_party/WebKit/LayoutTests/media/video-src-remove.html
|
| +++ b/third_party/WebKit/LayoutTests/media/video-src-remove.html
|
| @@ -1,58 +1,33 @@
|
| -<html>
|
| -<body>
|
| - <script src=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=video-test.js></script>
|
| - <div id=panel></div>
|
| - <script>
|
| - var panel = document.getElementById("panel");
|
| - var mediaFile = findMediaFile("video", "content/test");
|
| - panel.innerHTML = "<video src=" + mediaFile + " controls onloadedmetadata='loadedmetadata()'><source src=content/counting.mp4></video>";
|
| - </script>
|
| -
|
| - <p>Test that removing valid 'src' attribute DOES NOT trigger load of <source> elements</p>
|
| -
|
| - <script>
|
| - findMediaElement();
|
| -
|
| - var loadCount = 0;
|
| -
|
| - function testSrc()
|
| - {
|
| - testExpected("stripExtension(relativeURL(video.currentSrc))", stripExtension(mediaFile));
|
| - testExpected("isNaN(video.duration)", false);
|
| - consoleWrite("");
|
| - }
|
| -
|
| - function loadedmetadata()
|
| - {
|
| - consoleWrite("EVENT(loadedmetadata)");
|
| -
|
| - ++loadCount;
|
| - if (loadCount == 1)
|
| - {
|
| - testSrc();
|
| - run("video.removeAttribute('src')");
|
| - }
|
| - else
|
| - {
|
| - consoleWrite("<span style='color:red'>FAIL</span> : 'loadCount' fired " + loadCount + "times" );
|
| - endTest();
|
| - }
|
| - consoleWrite("");
|
| - setTimeout(someTimeLater, 100) ;
|
| - }
|
| -
|
| - function someTimeLater()
|
| - {
|
| +<!DOCTYPE html>
|
| +<title>Test that removing valid "src" attribute doesn't trigger load of "source" elements.</title>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="media-file.js"></script>
|
| +<video>
|
| + <source></source>
|
| +</video>
|
| +<script>
|
| +async_test(function(t) {
|
| + var video = document.querySelector("video");
|
| +
|
| + video.onloadedmetadata = t.step_func(function() {
|
| + testSrc();
|
| + video.removeAttribute("src");
|
| + video.onloadedmetadata = t.unreached_func();
|
| +
|
| + setTimeout(t.step_func_done(function() {
|
| testSrc();
|
| - endTest();
|
| - consoleWrite("");
|
| - }
|
| -
|
| - consoleWrite("");
|
| - </script>
|
| -
|
| -</body>
|
| -</html>
|
| + }), 100) ;
|
| + });
|
| +
|
| + function testSrc() {
|
| + var url = video.currentSrc;
|
| + assert_equals(url.substr(url.lastIndexOf("/media/")+7), mediaFile);
|
| + assert_false(isNaN(video.duration));
|
| + }
|
| +
|
| + document.querySelector("source").src = findMediaFile("video", "content/counting");
|
| + var mediaFile = findMediaFile("video", "content/test");
|
| + video.src = mediaFile;
|
| +});
|
| +</script>
|
|
|