OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <title>Test that video(media) documents scale to fit undersized containers.</tit
le> |
3 <script src="media-file.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharnessreport.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <script src="media-file.js"></script> |
6 <script src="video-test.js"></script> | 6 <iframe style="width: 200px; height: 200px;"></iframe> |
7 <script> | 7 <script> |
8 function canPlayThrough(event) { | 8 async_test(function(t) { |
9 var video = event.target; | 9 var iframe = document.querySelector("iframe"); |
10 testExpected(video.offsetWidth, 200); | |
11 testExpected(video.offsetHeight, 164); | |
12 endTest(); | |
13 } | |
14 | 10 |
15 function iframeLoad() { | 11 iframe.onload = t.step_func(function() { |
16 var iframe = document.querySelector("iframe"); | 12 var video = iframe.contentDocument.querySelector("video"); |
17 var video = iframe.contentDocument.querySelector("video"); | 13 video.oncanplaythrough = t.step_func_done(function() { |
18 video.addEventListener("canplaythrough", canPlayThrough); | 14 assert_equals(video.offsetWidth, 200); |
19 video.load() | 15 assert_equals(video.offsetHeight, 164); |
20 } | 16 }); |
21 | 17 |
22 function load() { | 18 video.load(); |
23 var iframe = document.querySelector("iframe"); | 19 }); |
24 iframe.onload = iframeLoad; | |
25 iframe.src = findMediaFile("video", "content/counting"); | |
26 } | |
27 </script> | |
28 </head> | |
29 | 20 |
30 <body onload="load()"> | 21 iframe.src = findMediaFile("video", "content/counting"); |
31 <p>Test that video media documents scale to fit undersized containers.</
p> | 22 }); |
32 <iframe style="width: 200px; height: 200px;"></iframe> | 23 </script> |
33 </body> | |
34 </html> | |
OLD | NEW |