Index: third_party/WebKit/LayoutTests/media/media-source-append-multiple.html |
diff --git a/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html b/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html |
index 0b7a2ff65e65d776692a862367bb65db44fc93ed..d2cef335933f97bd3ea8d6672aca3bb7982ec7e1 100644 |
--- a/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html |
+++ b/third_party/WebKit/LayoutTests/media/media-source-append-multiple.html |
@@ -1,53 +1,27 @@ |
<!DOCTYPE html> |
-<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> |
- var audio, sourceA, sourceB; |
+<title>Test that a media element doesn't reload on removing the current source element and inserting a new source element.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="media-file.js"></script> |
+<audio></audio> |
+<script> |
+async_test(function(t) { |
+ var audio = document.querySelector("audio"); |
- function canplaythrough(e) |
- { |
- testExpected("audio.currentSrc == sourceA.src", true); |
- endTest(); |
- } |
+ audio.oncanplaythrough = t.step_func_done(function() { |
+ assert_equals(audio.currentSrc, sourceA.src); |
+ }); |
- function loadedMetadataA() |
- { |
- consoleWrite("loadedMetadataA"); |
- audio.removeChild(sourceA); |
- audio.appendChild(sourceB); |
- waitForEventAndFail("loadedmetadata"); |
- } |
+ audio.onloadedmetadata = t.step_func(function() { |
+ audio.removeChild(sourceA); |
+ audio.appendChild(sourceB); |
+ audio.onloadedmetadata = t.unreached_func(); |
+ }); |
- function onWindowLoad(e) |
- { |
- audio = document.getElementById('a'); |
- waitForEvent("loadstart"); |
- waitForEvent("progress"); |
- waitForEvent("emptied"); |
- waitForEvent("suspend"); |
- waitForEvent("loadeddata"); |
- waitForEvent("canplay"); |
- waitForEventOnce('canplaythrough', canplaythrough); |
- |
- sourceA = document.createElement("source"); |
- var audioFile = findMediaFile("audio", "content/test"); |
- sourceA.setAttribute("src", audioFile); |
- sourceB = document.createElement("source"); |
- audioFile = findMediaFile("audio", "content/silence"); |
- sourceB.setAttribute("src", audioFile); |
- |
- waitForEventOnce("loadedmetadata", loadedMetadataA); |
- audio.appendChild(sourceA); |
- } |
- |
- window.addEventListener('load', onWindowLoad, false); |
- </script> |
- </head> |
- <body> |
- <audio id="a"></audio> |
- </body> |
-</html> |
+ var sourceA = document.createElement("source"); |
+ sourceA.src = findMediaFile("audio", "content/test"); |
+ var sourceB = document.createElement("source"); |
+ sourceB.src = findMediaFile("audio", "content/silence"); |
+ audio.appendChild(sourceA); |
+}); |
+</script> |