Index: third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html b/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html |
index 57bc0efdc3dafdf57849ff199386c08bc3b0339a..1197a82084b71555cd3eb2fd64720816c9e75f11 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html |
@@ -1,40 +1,30 @@ |
-<html> |
- <head> |
- <!-- 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 src=../../media-resources/media-file.js></script> |
- <script> |
- function loadMediaFrame() |
- { |
- findMediaElement(); |
+<!DOCTYPE html> |
+<title>Tests that the media player sends the User Agent string when requesting a media file.</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="../../media-resources/media-file.js"></script> |
+<body> |
+<video> |
+ <source></source> |
+</video> |
+<script> |
+async_test(function(t) { |
+ var movie = findMediaFile('video', 'test'); |
+ var type = mimeTypeForExtension(movie.split('.').pop()); |
+ var iframe = document.createElement('iframe'); |
- var movie = findMediaFile('video', 'test'); |
- var type = mimeTypeForExtension(movie.split('.').pop()); |
- var frame = document.createElement('iframe'); |
- frame.width = 0; |
- frame.height = 0; |
- frame.addEventListener('load', function () { |
- source = document.getElementById('source'); |
- source.src = 'http://127.0.0.1:8000/media/resources/video-check-useragent.php?name=' + movie + '&type=' + type; |
- source.type = type; |
+ iframe.onload = t.step_func(function() { |
+ var video = document.querySelector('video'); |
+ video.oncanplay = t.step_func_done(); |
- waitForEventAndFail('error'); |
- waitForEventAndEnd('canplay'); |
- video.load(); |
- }); |
+ var source = document.querySelector('source'); |
+ source.src = 'http://127.0.0.1:8000/media/resources/video-check-useragent.php?name=' + movie + '&type=' + type; |
+ source.type = type; |
+ source.onerror = t.unreached_func(); |
+ video.load(); |
+ }); |
- frame.src = "data:text/html,<b>test</b>"; |
- document.body.appendChild(frame); |
- } |
- </script> |
- </head> |
- |
- <body onload="loadMediaFrame()"> |
- <video id="video"> |
- <source id="source"> |
- </video> |
- <br> |
- Tests that the media player sends the WebKit User Agent string when requesting a media file. |
- </body> |
-</html> |
+ iframe.src = 'data:text/html,<b>test</b>'; |
+ document.body.appendChild(iframe); |
+}); |
+</script> |