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

Unified Diff: third_party/WebKit/LayoutTests/media/media-load-event.html

Issue 2043473002: Convert media-ended*, media-extension* and media-load* 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-load-event.html
diff --git a/third_party/WebKit/LayoutTests/media/media-load-event.html b/third_party/WebKit/LayoutTests/media/media-load-event.html
index af0ecaaf8f7e7ca0a1d85834592dcd0706125d2b..c6b2ef1103af2e72e893d32baed0c465ebe63fbc 100644
--- a/third_party/WebKit/LayoutTests/media/media-load-event.html
+++ b/third_party/WebKit/LayoutTests/media/media-load-event.html
@@ -1,58 +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 playing()
- {
- consoleWrite("EVENT(playing)<br>");
- endTest();
- }
-
- function canplaythrough()
- {
- consoleWrite("EVENT(canplaythrough)");
- consoleWrite("");
- run("document.getElementById('parent').appendChild(mediaElement)");
- run("mediaElement.play()");
- consoleWrite("");
- }
-
- function start()
- {
- run("mediaElement = document.createElement('audio')");
-
- mediaElement.setAttribute('oncanplaythrough', "canplaythrough()");
- mediaElement.setAttribute('onplaying', "playing()");
-
- waitForEvent("loadstart");
- waitForEvent("waiting");
- waitForEvent("ratechange");
- waitForEvent("durationchange");
- waitForEvent("pause");
- waitForEvent("play");
- waitForEvent("canplaythrough");
- waitForEvent('loadeddata');
-
- var mediaFile = findMediaFile("audio", "content/test");
- run("mediaElement.src = '" + mediaFile + "'");
- run("mediaElement.load()");
-
- consoleWrite("");
- }
-
- </script>
- </head>
-
- <body onload="start()">
-
- <p>Test that media file is not reloaded when an element is inserted into the DOM.</p>
-
- <div id="parent"></div>
-
- </body>
-</html>
+<!DOCTYPE html>
+<title>Test that media file is not reloaded when an element is inserted into the DOM.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<div id="parent"></div>
+<script>
+async_test(function(t) {
+ var audio = document.createElement("audio");
+
+ audio.oncanplaythrough = t.step_func(function() {
+ audio.onloadstart = t.unreached_func("Should not fire 'loadstart' event");
+ document.getElementById("parent").appendChild(audio);
+ audio.play();
+ });
+
+ audio.onplaying = t.step_func_done();
+ audio.onloadstart = t.step_func(function() {});
+ audio.ondurationchange = t.step_func(function() {});
+ audio.onplay = t.step_func(function() {});
+ audio.onloadeddata = t.step_func(function() {});
+
+ audio.src = findMediaFile("audio", "content/test");
+ audio.load();
+})
+</script>

Powered by Google App Engine
This is Rietveld 408576698