Index: third_party/WebKit/LayoutTests/media/video-src-plus-source.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-src-plus-source.html b/third_party/WebKit/LayoutTests/media/video-src-plus-source.html |
index 7dfcd63909d8f5a10416e98d6937efc5fb66ed7c..5b75d85b4deee87651be4ebcff1dc84aaf4722a7 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-src-plus-source.html |
+++ b/third_party/WebKit/LayoutTests/media/video-src-plus-source.html |
@@ -1,35 +1,30 @@ |
-<html> |
-<body> |
- <!-- 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> |
+<!DOCTYPE html> |
+<title>Test that a "source" element is not used when a bogus "src" attribute is present.</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"); |
- <script> |
- mediaElement.addEventListener('loadedmetadata', function() { |
- failTest("'loadedmetadata' event fired" ); |
- }, true); |
+ video.onloadedmetadata = t.unreached_func(); |
+ video.onloadstart = t.step_func(function () { |
+ var url = video.currentSrc; |
+ assert_equals(url.substr(url.lastIndexOf("/media/")+7), mediaFile); |
+ }); |
- waitForEvent('loadstart', function () { |
- findMediaElement(); |
- testExpected("relativeURL(video.currentSrc)", "content/bogus.mpeg"); |
- consoleWrite(""); |
- }); |
+ video.onerror = t.step_func(function () { |
+ var url = video.currentSrc; |
+ assert_equals(url.substr(url.lastIndexOf("/media/")+7), mediaFile); |
+ assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
+ setTimeout(t.step_func_done(), 200) ; |
+ }); |
- waitForEvent('error', function () { |
- findMediaElement(); |
- testExpected("relativeURL(video.currentSrc)", "content/bogus.mpeg"); |
- testExpected("mediaElement.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
- setTimeout(endTest, 200) ; |
- consoleWrite(""); |
- }); |
- </script> |
- |
- <video src=content/bogus.mpeg controls> |
- <source src=content/test.mp4> |
- </video> |
- |
-<p>Test that a <source> element is not used when a bogus 'src' attribute is present |
-</p> |
- |
-</body> |
-</html> |
+ document.querySelector("source").src = findMediaFile("video", "content/test"); |
+ var mediaFile = "content/bogus.mpeg"; |
+ video.src = mediaFile; |
+}); |
+</script> |