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