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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html

Issue 2167743002: Convert media-document* and pdf* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add suggested change 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/pdf-served-as-pdf.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html b/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html
index 11c3b58d5e6245491367f2f6d01e0e3c7da52099..7623ca08067ef8eed5631052aa57a138d12cffad 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/pdf-served-as-pdf.html
@@ -1,39 +1,18 @@
<!DOCTYPE html>
-<html>
- <head>
- <title>PDF file served as 'application/pdf'</title>
- <!-- 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(evt)
- {
- logResult(false, "loaded PDF file served as PDF");
- endTest();
- }
+<title>Tests that a PDF file is served as "application/pdf"</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../../media-resources/media-file.js"></script>
+<video></video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
- function error(evt)
- {
- logResult(true, "failed trying to load PDF file served as PDF");
- endTest();
- }
+ var watcher = new EventWatcher(t, video, ["loadstart", "loadedmetadata", "error"]);
+ watcher.wait_for(["loadstart", "error"]).then(t.step_func_done());
+ assert_equals(video.error, null);
- function start()
- {
- findMediaElement();
-
- waitForEvent('loadedmetadata', loadedmetadata);
- waitForEvent("error", error);
- waitForEvent("loadstart");
- testExpected("video.error", null);
-
- var movie = "resources/test.pdf";
- video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=99999&type=application/pdf";
- }
- </script>
- </head>
-
- <body onload="start()">
- <video controls></video>
- </body>
-</html>
+ var movie = "resources/test.pdf";
+ video.src = "http://127.0.0.1:8000/media/video-throttled-load.cgi?name=" + movie + "&throttle=99999&type=application/pdf";
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698