OLD | NEW |
1 <!doctype html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test HTMLVideoElement's prefixed fullscreen API.</title> |
3 <head> | 3 <script src="../resources/testharness.js"></script> |
4 <title>Test the prefixed HTMLVideoElement fullscreen API</title> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="media-file.js"></script> | 5 <script src="media-file.js"></script> |
6 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 6 <video></video> |
7 (Please avoid writing new tests using video-test.js) --> | 7 <script> |
8 <script src="video-test.js"></script> | 8 async_test(function(t) { |
9 <script> | 9 var video = document.querySelector("video"); |
10 function start() | 10 assert_true(video.webkitSupportsFullscreen); |
11 { | 11 assert_false(video.webkitDisplayingFullscreen); |
12 findMediaElement(); | 12 video.src = findMediaFile("video", "content/test"); |
13 testExpected("video.webkitSupportsFullscreen", true); | |
14 testExpected("video.webkitDisplayingFullscreen", false); | |
15 video.src = findMediaFile("video", "content/test"); | |
16 waitForEvent("loadeddata", loadeddata); | |
17 } | |
18 | 13 |
19 function loadeddata() | 14 video.onloadeddata = t.step_func(function() { |
20 { | 15 assert_true(video.webkitSupportsFullscreen); |
21 testExpected("video.webkitSupportsFullscreen", true); | 16 assert_false(video.webkitDisplayingFullscreen); |
22 testExpected("video.webkitDisplayingFullscreen", false); | 17 video.webkitEnterFullscreen(); |
23 run("video.webkitEnterFullscreen()"); | 18 video.onwebkitfullscreenerror = t.step_func(function() { |
24 waitForEvent("webkitfullscreenerror", fullscreenerror); | 19 assert_true(video.webkitSupportsFullscreen); |
25 } | 20 assert_false(video.webkitDisplayingFullscreen); |
26 | 21 |
27 function fullscreenerror() | 22 document.onclick = t.step_func(function() { |
28 { | 23 video.webkitEnterFullscreen(); |
29 testExpected("video.webkitSupportsFullscreen", true); | 24 video.onwebkitfullscreenchange = t.step_func(function() { |
30 testExpected("video.webkitDisplayingFullscreen", false); | 25 assert_true(video.webkitSupportsFullscreen); |
31 document.onclick = function() | 26 assert_true(video.webkitDisplayingFullscreen); |
32 { | 27 video.webkitExitFullscreen(); |
33 run("video.webkitEnterFullscreen()"); | 28 video.onwebkitfullscreenchange = t.step_func_done(function()
{ |
34 waitForEventOnce("webkitfullscreenchange", fullscreenenter); | 29 assert_true(video.webkitSupportsFullscreen); |
35 }; | 30 assert_false(video.webkitDisplayingFullscreen); |
36 eventSender.mouseDown(); | 31 }); |
37 eventSender.mouseUp(); | 32 }); |
38 } | 33 }); |
39 | 34 |
40 function fullscreenenter() | 35 eventSender.mouseDown(); |
41 { | 36 eventSender.mouseUp(); |
42 testExpected("video.webkitSupportsFullscreen", true); | 37 }); |
43 testExpected("video.webkitDisplayingFullscreen", true); | 38 }); |
44 run("video.webkitExitFullscreen()"); | 39 }); |
45 waitForEvent("webkitfullscreenchange", fullscreenexit); | 40 </script> |
46 } | |
47 | |
48 function fullscreenexit() | |
49 { | |
50 testExpected("video.webkitSupportsFullscreen", true); | |
51 testExpected("video.webkitDisplayingFullscreen", false); | |
52 endTest(); | |
53 } | |
54 </script> | |
55 </head> | |
56 <body onload="start()"> | |
57 <p>Test the prefixed HTMLVideoElement fullscreen API</p> | |
58 <video></video> | |
59 </body> | |
60 </html> | |
OLD | NEW |