Index: third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html b/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html |
index 7ab852c259be9b27456ea6c958414a3c5c25e71b..eb42abf5fb4f6a1130ed4655a1182627f8210d29 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html |
+++ b/third_party/WebKit/LayoutTests/media/video-source-add-after-remove.html |
@@ -1,25 +1,22 @@ |
-<!doctype html> |
-<html> |
- <head> |
- <title>Add <source> after removing failed candidate</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 src=media-file.js></script> |
- <script> |
- function error() |
- { |
- findMediaElement(); |
- video.removeChild(video.firstChild); |
- var source = document.createElement("source"); |
- source.src = findMediaFile("video", "content/test"); |
- video.appendChild(source); |
- waitForEventAndEnd("loadedmetadata"); |
- } |
- </script> |
- </head> |
+<!DOCTYPE html> |
+<title>Test adding "source" after removing failed candidate loads media normally.</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"); |
- <body> |
- <video><source onerror="error()"></video> |
- </body> |
-</html> |
+ source.onerror = t.step_func(function() { |
+ video.removeChild(video.firstChild); |
+ var newSource = document.createElement("source"); |
+ newSource.src = findMediaFile("video", "content/test"); |
+ video.appendChild(newSource); |
+ video.onloadedmetadata = t.step_func_done(); |
+ }); |
+}); |
+</script> |