Chromium Code Reviews| 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..f124a593a981518628b3a010229f69c30b60742d 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,19 @@ |
| <!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 expectedEvents = ["loadstart", "error"]; |
| + var watcher = new EventWatcher(t, video, expectedEvents); |
| + watcher.wait_for(expectedEvents).then(t.step_func_done()); |
| + assert_equals(video.error, null); |
|
fs
2016/07/20 14:58:25
unreached_func on loadedmetadata too?
Srirama
2016/07/20 15:00:31
EventWatcher anyway throws error if loadedmetadata
Srirama
2016/07/20 15:19:22
Done.
|
| - 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> |