Index: third_party/WebKit/LayoutTests/http/tests/media/video-throttled-load-metadata.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-throttled-load-metadata.html b/third_party/WebKit/LayoutTests/http/tests/media/video-throttled-load-metadata.html |
index 046e8eee426ec64b06244635efd3037c012c53ee..4920061abc7d5f6fb0b6fde3982c25153e6b9c1d 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-throttled-load-metadata.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-throttled-load-metadata.html |
@@ -1,52 +1,30 @@ |
-<html> |
-<head> |
- <title>throttled loading metadata</title> |
- <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> |
- <script> |
- function loadedmetadata(e) |
- { |
- logResult(true, "loaded metadata of media file"); |
- endTest(); |
- } |
+<!DOCTYPE html> |
+<title>This test case simulates a slow network, and starts a web worker thread to write a log message when retrieving media metadata to see if the webkit thread is blocked by media retrieving thread.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<video></video> |
+<script> |
+// This test case is for https://bugs.webkit.org/show_bug.cgi?id=80978. |
+async_test(function(t) { |
+ var workerExecuted = false; |
+ var video = document.querySelector("video"); |
- function error(e) |
- { |
- logResult(false, "failed to load media file"); |
- endTest(); |
- } |
+ video.onloadedmetadata = t.step_func_done(function() { |
+ assert_true(workerExecuted); |
+ }); |
- function start() |
- { |
- findMediaElement(); |
+ video.onerror = t.unreached_func(); |
+ assert_equals(video.error, null); |
- waitForEvent('loadedmetadata', loadedmetadata); |
- waitForEvent("error", error); |
- testExpected("video.error", null); |
+ var worker = new Worker("video-throttled-load-metadata-worker.js"); |
+ worker.onmessage = t.step_func(function() { |
+ workerExecuted = true; |
+ }); |
- var worker = new Worker("video-throttled-load-metadata-worker.js"); |
- worker.onmessage = function (event) { |
- logResult(true, event.data); |
- } |
- |
- // Use a .webm to ensure metadata is near the beginning of the file. |
- var mediaFile = "resources/media-source/webm/test.webm"; |
- video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?" + |
- "nph=1&name=" + mediaFile + "&throttle=40&type=video/webm" + |
- "avoidCache=" + Math.random(); |
- |
- video.load(); |
- } |
- </script> |
-</head> |
-<body onload="start()"> |
-<video id="video"></video> |
-<p> |
-This test case simulates a slow network, and starts a web worker thread to write a log message |
-when retrieving media metadata to see if the webkit thread is blocked by media retrieving thread.<br> |
-This test case is for <a href="https://bugs.webkit.org/show_bug.cgi?id=80978">https://bugs.webkit.org/show_bug.cgi?id=80978</a> |
-</p> |
-</body> |
-</html> |
+ // Use a .webm to ensure metadata is near the beginning of the file. |
+ var mediaFile = "resources/media-source/webm/test.webm"; |
+ video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?" + |
+ "nph=1&name=" + mediaFile + "&throttle=40&type=video/webm" + |
+ "avoidCache=" + Math.random(); |
+}); |
+</script> |