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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.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-suspend.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html b/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html
index 1f531d89562fedf8238d4877258289fe9c221a4d..71a7186a5177c2ed73dcddab6e984f2d739e8766 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-load-suspend.html
@@ -1,33 +1,16 @@
-<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 that the load eventually suspends and returns to NETWORK_IDLE.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<video></video>
<script>
- var file = findMediaFile("video", "http://127.0.0.1:8000/resources/test");
-
- function init()
- {
- findMediaElement();
- run("video.src = file");
- waitForEvent('loadstart', onLoadStart);
- }
-
- function onLoadStart()
- {
- waitForEvent('suspend', onSuspend);
- }
-
- function onSuspend()
- {
- testExpected("video.networkState", HTMLMediaElement.NETWORK_IDLE, "==");
- endTest();
- }
-</script>
-</head>
-<body onload="init()">
- <p>Test that the load eventually suspends and returns to NETWORK_IDLE.</p>
- <video></video>
-</body>
-</html>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ video.src = findMediaFile("video", "http://127.0.0.1:8000/resources/test");
+ var watcher = new EventWatcher(t, video, ["loadstart", "suspend"]);
+ watcher.wait_for(["loadstart", "suspend"]).then(t.step_func_done(function() {
+ assert_equals(video.networkState, HTMLMediaElement.NETWORK_IDLE);
+ }));
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698