OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <script src=media-file.js></script> | |
5 <script src=video-test.js></script> | |
6 | |
7 <script> | |
8 var controller; | |
9 var video2; | |
10 | |
11 function start() { | |
12 video = document.getElementsByTagName('video')[0]; | |
13 video2 = document.getElementsByTagName('video')[1]; | |
14 | |
15 consoleWrite("Test presence of MediaController constructor, controll
er, and mediaGroup attributes:"); | |
16 testExpected("typeof(MediaController)", "undefined", "!="); | |
17 testExpected("video.controller", null); | |
18 testExpected("video.mediaGroup", ""); | |
19 consoleWrite(""); | |
20 consoleWrite("Test that the presence of a mediaGroup attribute creat
es a controller:") | |
21 testExpected("video2.mediaGroup", 'group'); | |
22 testExpected("video2.controller", null, "!="); | |
23 consoleWrite(""); | |
24 consoleWrite("Test that setting mediaGroup to an empty string remove
s the controller:") | |
25 run("video.mediaGroup = ''"); | |
26 testExpected("video.controller", null); | |
27 consoleWrite(""); | |
28 consoleWrite("Test manually creating and assigning a controller to a
media element:") | |
29 run("controller = new MediaController()"); | |
30 run("video.controller = controller"); | |
31 testExpected("video.controller", controller); | |
32 consoleWrite(""); | |
33 consoleWrite("Test assigning the wrong type to the controller attrib
ute of a media element:") | |
34 testException("video.controller = 42", '"TypeError: Failed to set th
e \'controller\' property on \'HTMLMediaElement\': The provided value is not of
type \'MediaController\'."'); | |
35 testExpected("video.controller", controller); | |
36 consoleWrite(""); | |
37 consoleWrite("Test assigning a null controller to a media element:") | |
38 run("video.controller = null"); | |
39 testExpected("video.controller", null); | |
40 consoleWrite(""); | |
41 consoleWrite("Test that two media elements with the same mediaGroup
have the same controller:") | |
42 run("video.mediaGroup = 'group'"); | |
43 run("video2.mediaGroup = 'group'"); | |
44 testExpected("video.controller === video2.controller", true); | |
45 consoleWrite(""); | |
46 consoleWrite("Test that setting the controller clears the mediaGroup
:") | |
47 testExpected("video.mediaGroup", "group"); | |
48 run("video.controller = null"); | |
49 testExpected("video.controller", null); | |
50 testExpected("video.hasAttribute('mediaGroup')", false); | |
51 testExpected("video.mediaGroup", ""); | |
52 run("video.mediaGroup = 'group'"); | |
53 testExpected("video.mediaGroup", "group"); | |
54 run("video.controller = controller"); | |
55 testExpected("video.controller", controller); | |
56 testExpected("video.hasAttribute('mediaGroup')", false); | |
57 testExpected("video.mediaGroup", ""); | |
58 consoleWrite(""); | |
59 consoleWrite("Test that setting the controller to undefined is treat
ed as null:") | |
60 testExpected("video.controller", null, "!="); | |
61 run("video.controller = undefined"); | |
62 testExpected("video.controller", null); | |
63 endTest(); | |
64 } | |
65 </script> | |
66 </head> | |
67 <body onload="start()"> | |
68 <video></video> | |
69 <video mediagroup="group"></video> | |
70 </body> | |
71 </html> | |
OLD | NEW |