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

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

Issue 2174143002: Convert video-query* and video-reference* 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-referer.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html b/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html
index d6796ba118ad025d3e88c787200b575285a3106d..2949acaa4b5fce618405827f055cdb415ada37bb 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/video-referer.html
@@ -1,35 +1,30 @@
-<html>
-<head>
-</head>
-<body onload="loadCookieAndReferer()">
-<video id="video">
- <source id="source">
+<!DOCTYPE html>
+<title>Tests that the media player will send the relevant referer when requesting the 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>
-<!-- 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 loadCookieAndReferer () {
- 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-referer-check-referer.php?name=' + movie + '&type=' + type;
- source.type = type;
+async_test(function(t) {
+ var movie = findMediaFile('video', 'test');
+ var type = mimeTypeForExtension(movie.split('.').pop());
+ var iframe = document.createElement('iframe');
- waitForEventAndFail('error');
- waitForEventAndEnd('canplay');
- video.load();
- });
+ iframe.onload = t.step_func(function() {
+ var video = document.querySelector('video');
+ video.onerror = t.unreached_func();
+ video.oncanplay = t.step_func_done();
- frame.src = "data:text/html,<b>test</b>";
- document.body.appendChild(frame);
- }
-</script>
-Tests that the media player will send the relevant referer when requesting the media file.<br/>
-</body>
-</html>
+ var source = document.querySelector('source');
+ source.src = 'http://127.0.0.1:8000/media/resources/video-referer-check-referer.php?name=' + movie + '&type=' + type;
+ source.type = type;
+ video.load();
+ });
+
+ iframe.src = 'data:text/html,<b>test</b>';
+ document.body.appendChild(iframe);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698