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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html

Issue 2180713002: Convert video-load* http tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test failures Created 4 years, 5 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/http/tests/media/video-load-twice.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html b/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html
index 6a636ee887890be812bc86603b10cefe8d30fd4a..f89f1bd982d1ffaebf4745e12752f0688907ef14 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-load-twice.html
@@ -1,35 +1,28 @@
-<html>
-<head>
-<script src=../../media-resources/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=../../media-resources/video-test.js></script>
+<!DOCTYPE html>
+<title>Test loading video twice.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<body>
<script>
+async_test(function(t) {
var file = findMediaFile("video", "http://127.0.0.1:8000/resources/test");
-
- function createVideo() {
+ createAndLoadVideo(false);
+ function createAndLoadVideo(endTest) {
var video = document.createElement("video");
document.body.appendChild(video);
- findMediaElement();
- waitForEvent('loadedmetadata');
- waitForEvent('loadeddata');
- waitForEvent('canplay');
- }
-
- function firstCanPlayThrough() {
- document.body.removeChild(video);
- createVideo();
- waitForEventOnce('canplaythrough', endTest);
- run("video.src = file");
- }
+ var expectedEvents = ["loadedmetadata", "loadeddata", "canplay", "canplaythrough"];
+ var watcher = new EventWatcher(t, video, expectedEvents);
+ watcher.wait_for(expectedEvents).then(t.step_func(function() {
+ if (endTest) {
+ t.done();
+ } else {
+ document.body.removeChild(video);
+ createAndLoadVideo(true);
+ }
+ }));
- function init() {
- createVideo();
- waitForEventOnce('canplaythrough', firstCanPlayThrough);
- run("video.src = file");
+ video.src = file;
}
-</script>
-</head>
-<body onload="init()">
-</body>
-</html>
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698