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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html

Issue 1950283002: Convert track-remove* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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/track/track-remove-insert-ready-state.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html b/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html
index c3a323456b953062ee73a4ac6f36c338f28732a2..5d60268141dd663af144a4ab31bb7fa8c69eb49e 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-remove-insert-ready-state.html
@@ -1,66 +1,38 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>Test that video is playing after media element is re-added</title>
-
- <!-- TODO(philipj): 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>
- if (window.testRunner)
- testRunner.waitUntilDone();
-
- function endTest()
- {
- consoleWrite("<br>** Succesfully played the video **");
-
- if (window.testRunner)
- testRunner.notifyDone();
- }
-
- function canplaythrough()
- {
- video.removeEventListener('canplaythrough', canplaythrough);
- track = document.querySelector('track');
-
- consoleWrite("** Track should have error as ready state **");
- testExpected("track.readyState == HTMLTrackElement.ERROR", true);
-
- consoleWrite("");
- consoleWrite("** Remove the video element from body **");
- document.body.removeChild(video);
-
- consoleWrite("** Reset the video src attribute to re-trigger resource selection for tracks **");
- video.src = findMediaFile('video', '../content/test');
-
- consoleWrite("** Append the video element back to the body **");
- document.body.appendChild(video);
-
- consoleWrite("<br>** The video should start playing **");
- testExpected("track.readyState == HTMLTrackElement.ERROR", true);
-
- video.addEventListener('playing', endTest);
- video.play();
- }
-
- function start()
- {
- video = document.getElementsByTagName('video')[0];
- video.src = findMediaFile('video', '../content/test');
- video.addEventListener('canplaythrough', canplaythrough);
- }
-
- </script>
- </head>
-
- <body onload="start()">
- <p>Tests that re-adding a media element to the document, having a child track that failed
- loading doesn't block video from playing</p>
-
- <video width="320" height="240" controls>
- <track src="captions-webvtt/tc004-no-webvtt.vtt" kind="captions" default>
- </video>
- </body>
-</html>
+<title>Tests that re-adding a media element to the document, having a child track that failed loading doesn't block video from playing.</title>
+<video>
+ <track src="captions-webvtt/tc004-no-webvtt.vtt" kind="captions" default>
+</video>
+<script src="../media-file.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+async_test(function(t) {
+ var video = document.querySelector('video');
+ video.src = findMediaFile('video', '../content/test');
+ video.oncanplaythrough = t.step_func(canplaythrough);
+
+ function canplaythrough() {
+ video.oncanplaythrough = null;
+ var track = document.querySelector('track');
+
+ // Track should have error as ready state.
+ assert_equals(track.readyState, HTMLTrackElement.ERROR);
+
+ // Remove the video element from body.
+ document.body.removeChild(video);
+
+ // Reset the video src attribute to re-trigger resource selection for tracks.
+ video.src = findMediaFile('video', '../content/test');
+
+ // Append the video element back to the body.
+ document.body.appendChild(video);
+
+ assert_equals(track.readyState, HTMLTrackElement.ERROR);
+
+ video.onplaying = t.step_func_done();
+ video.play();
+ // The video should start playing.
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698