| OLD | NEW |
| 1 <html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <title>Tests that the media player will send the relevant referer when requestin
g the media file.</title> |
| 3 </head> | 3 <script src="../resources/testharness.js"></script> |
| 4 <body onload="loadCookieAndReferer()"> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <video id="video"> | 5 <script src="../../media-resources/media-file.js"></script> |
| 6 <source id="source"> | 6 <body> |
| 7 <video> |
| 8 <source></source> |
| 7 </video> | 9 </video> |
| 8 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
| 9 (Please avoid writing new tests using video-test.js) --> | |
| 10 <script src=../../media-resources/video-test.js></script> | |
| 11 <script src=../../media-resources/media-file.js></script> | |
| 12 <script> | 10 <script> |
| 13 function loadCookieAndReferer () { | 11 async_test(function(t) { |
| 14 var movie = findMediaFile('video', 'test'); | 12 var movie = findMediaFile('video', 'test'); |
| 15 var type = mimeTypeForExtension(movie.split('.').pop()); | 13 var type = mimeTypeForExtension(movie.split('.').pop()); |
| 16 var frame = document.createElement('iframe'); | 14 var iframe = document.createElement('iframe'); |
| 17 frame.width = 0; | |
| 18 frame.height = 0; | |
| 19 frame.addEventListener('load', function () { | |
| 20 source = document.getElementById('source'); | |
| 21 source.src = 'http://127.0.0.1:8000/media/resources/video-refere
r-check-referer.php?name=' + movie + '&type=' + type; | |
| 22 source.type = type; | |
| 23 | 15 |
| 24 waitForEventAndFail('error'); | 16 iframe.onload = t.step_func(function() { |
| 25 waitForEventAndEnd('canplay'); | 17 var video = document.querySelector('video'); |
| 26 video.load(); | 18 video.onerror = t.unreached_func(); |
| 27 }); | 19 video.oncanplay = t.step_func_done(); |
| 28 | 20 |
| 29 frame.src = "data:text/html,<b>test</b>"; | 21 var source = document.querySelector('source'); |
| 30 document.body.appendChild(frame); | 22 source.src = 'http://127.0.0.1:8000/media/resources/video-referer-check-
referer.php?name=' + movie + '&type=' + type; |
| 31 } | 23 source.type = type; |
| 32 </script> | 24 video.load(); |
| 33 Tests that the media player will send the relevant referer when requesting the m
edia file.<br/> | 25 }); |
| 34 </body> | 26 |
| 35 </html> | 27 iframe.src = 'data:text/html,<b>test</b>'; |
| 28 document.body.appendChild(iframe); |
| 29 }); |
| 30 </script> |
| OLD | NEW |