Index: third_party/WebKit/LayoutTests/media/video-source.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-source.html b/third_party/WebKit/LayoutTests/media/video-source.html |
index 93413461dbeb0524e2f560fe1fde01f5a75836a9..1f4b6b5c58cbf53a5b95908d7e5d6e0a4735bd98 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-source.html |
+++ b/third_party/WebKit/LayoutTests/media/video-source.html |
@@ -1,35 +1,26 @@ |
-<html> |
- <head> |
- <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> |
- <script> |
- |
- function test() |
- { |
- var panel = document.getElementById("panel"); |
- var mediaFile = findMediaFile("video", "content/test"); |
- |
- panel.innerHTML = "<video controls><source src='" + mediaFile + "'></video>"; |
- |
- video = mediaElement = document.getElementsByTagName('video')[0]; |
- waitForEvent("loadstart", function () { |
- testExpected("stripExtension(relativeURL(video.currentSrc))", stripExtension(mediaFile)); |
- |
- source = document.querySelector('source'); |
- testExpected("stripExtension(source.getAttribute('src'))", stripExtension(mediaFile)); |
- testExpected("stripExtension(relativeURL(source.src))", stripExtension(mediaFile)); |
- |
- endTest(); |
- }); |
- } |
- </script> |
- </head> |
- |
- <body onload="setTimeout(test, 100)"> |
- |
- <div id=panel></div> |
- |
- </body> |
-</html> |
+<!DOCTYPE html> |
+<title>Test "source" element.</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"); |
+ var source = document.querySelector("source"); |
+ var mediaFile = findMediaFile("video", "content/test"); |
+ source.src = mediaFile; |
+ |
+ video.onloadstart = t.step_func_done(function() { |
+ var url = video.currentSrc; |
+ assert_equals(url.substr(url.lastIndexOf("/media/") + 7), mediaFile); |
+ |
+ assert_equals(source.getAttribute("src"), mediaFile); |
+ |
+ url = source.src; |
+ assert_equals(url.substr(url.lastIndexOf("/media/") + 7), mediaFile); |
+ }); |
+}); |
+</script> |