OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <title>activation behavior</title> | |
3 <script src="../resources/testharness.js"></script> | |
4 <script src="../resources/testharnessreport.js"></script> | |
5 <div id="log"></div> | |
6 <script> | |
7 function activation_behavior_test(tagName) | |
8 { | |
9 test(function() | |
10 { | |
11 var e1 = document.createElement(tagName); | |
12 var e2 = document.createElement(tagName); | |
13 e1.controls = true; | |
14 e1.play(); // plays and clears autoplaying flag | |
15 // e2 remains autoplaying and paused | |
16 e1.controller = new MediaController(); | |
17 e2.controller = e1.controller; | |
18 assert_false(e1.controller.paused, 'controller paused state before click
'); | |
19 assert_false(e1.paused, 'element 1 paused state before click'); | |
20 assert_true(e2.paused, 'element 2 paused state before click'); | |
21 e1.click(); | |
22 assert_false(e1.controller.paused, 'controller paused state after click'
); | |
23 assert_false(e1.paused, 'element 1 paused state after click'); | |
24 assert_false(e2.paused, 'element 2 paused state after click'); | |
25 }, tagName + ' activation behavior for restrained media controller (with aut
oplaying and paused slave)'); | |
26 | |
27 test(function() | |
28 { | |
29 var e1 = document.createElement(tagName); | |
30 var e2 = document.createElement(tagName); | |
31 e1.controls = true; | |
32 e1.pause(); // clears autoplaying flag | |
33 e2.pause(); // clears autoplaying flag | |
34 e1.controller = new MediaController(); | |
35 e2.controller = e1.controller; | |
36 assert_false(e1.controller.paused, 'controller paused state before click
'); | |
37 assert_true(e1.paused, 'element 1 paused state before click'); | |
38 assert_true(e2.paused, 'element 2 paused state before click'); | |
39 e1.click(); | |
40 assert_false(e1.controller.paused, 'controller paused state after click'
); | |
41 assert_false(e1.paused, 'element 1 paused state after click'); | |
42 assert_false(e2.paused, 'element 2 paused state after click'); | |
43 }, tagName + ' activation behavior for restrained media controller (with all
paused slaves)'); | |
44 | |
45 test(function() | |
46 { | |
47 var e = document.createElement(tagName); | |
48 e.controls = true; | |
49 e.controller = new MediaController(); | |
50 e.controller.pause(); | |
51 assert_true(e.controller.paused, 'controller paused state before click')
; | |
52 assert_true(e.paused, 'element paused state before click'); | |
53 e.click(); | |
54 assert_false(e.controller.paused, 'controller paused state after click')
; | |
55 assert_true(e.paused, 'element paused state after click'); | |
56 }, tagName + ' activation behavior for paused media controller'); | |
57 | |
58 test(function() | |
59 { | |
60 var e = document.createElement(tagName); | |
61 e.controls = true; | |
62 e.controller = new MediaController(); | |
63 e.controller.play(); | |
64 assert_false(e.controller.paused, 'controller paused state before click'
); | |
65 assert_false(e.paused, 'element paused state before click'); | |
66 e.click(); | |
67 assert_true(e.controller.paused, 'controller paused state after click'); | |
68 assert_false(e.paused, 'element paused state after click'); | |
69 }, tagName + ' activation behavior for playing media controller'); | |
70 | |
71 test(function() | |
72 { | |
73 var e = document.createElement(tagName); | |
74 e.controls = true; | |
75 assert_true(e.paused, 'paused state before click()'); | |
76 e.click(); | |
77 assert_false(e.paused, 'paused state after click()'); | |
78 }, tagName + ' activation behavior for paused media element'); | |
79 | |
80 test(function() | |
81 { | |
82 var e = document.createElement(tagName); | |
83 e.controls = true; | |
84 e.play(); | |
85 assert_false(e.paused, 'paused state before click()'); | |
86 e.click(); | |
87 assert_true(e.paused, 'paused state after click()'); | |
88 }, tagName + ' activation behavior for playing media element'); | |
89 | |
90 test(function() | |
91 { | |
92 var e = document.createElement(tagName); | |
93 e.controls = true; | |
94 e.onclick = function(ev) { ev.preventDefault(); }; | |
95 assert_true(e.paused, 'paused state before click()'); | |
96 e.click(); | |
97 assert_true(e.paused, 'paused state after click()'); | |
98 }, tagName + ' activation behavior for canceled event'); | |
99 | |
100 test(function() | |
101 { | |
102 var e = document.createElement(tagName); | |
103 assert_true(e.paused, 'paused state before click()'); | |
104 e.click(); | |
105 assert_true(e.paused, 'paused state after click()'); | |
106 }, tagName + ' activation behavior without controls'); | |
107 } | |
108 | |
109 activation_behavior_test('audio'); | |
110 activation_behavior_test('video'); | |
111 </script> | |
OLD | NEW |