Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Unified Diff: third_party/WebKit/LayoutTests/media/media-source-append-multiple.html

Issue 2065433002: Convert media-source*, no-autoplay* and remove-from* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..90beeba0ae8221e1906ff212e947b10c560d3b44 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,28 @@
<!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.onloadedmetadata = null;
fs 2016/06/11 18:59:50 This seems redundant with the definition below? (T
Srirama 2016/06/12 09:51:04 Done.
+ 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>

Powered by Google App Engine
This is Rietveld 408576698