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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/video-useragent.html

Issue 2180243002: Convert video-[in, throttled, useragent]* http tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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-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>

Powered by Google App Engine
This is Rietveld 408576698