OLD | NEW |
---|---|
1 <!doctype html> | 1 <!doctype html> |
2 <title>activation behavior</title> | 2 <title>activation behavior</title> |
3 <script src="../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <script src="media-file.js"></script> | 5 <script src="media-file.js"></script> |
6 <div id="log"></div> | 6 <div id="log"></div> |
7 <script> | 7 <script> |
8 setup({ timeout: 10000 }); | |
acolwell GONE FROM CHROMIUM
2014/03/25 22:57:55
It would be nice to make this and the ones below t
philipj_slow
2014/03/26 09:06:43
Yeah, it would be nice if the default timeouts as
| |
9 | |
8 function activation_behavior_test(tagName, src) | 10 function activation_behavior_test(tagName, src) |
9 { | 11 { |
10 async_test(function(t) | 12 async_test(function(t) |
11 { | 13 { |
12 var e = document.createElement(tagName); | 14 var e = document.createElement(tagName); |
13 e.controls = true; | 15 e.controls = true; |
14 e.src = src; | 16 e.src = src; |
15 e.preload = 'auto'; | 17 e.preload = 'auto'; |
16 e.oncanplay = t.step_func(function() | 18 e.oncanplay = t.step_func(function() |
17 { | 19 { |
18 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); | 20 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); |
19 e.controller = new MediaController(); | 21 e.controller = new MediaController(); |
20 assert_false(e.controller.paused, 'controller paused state before cl ick'); | 22 assert_false(e.controller.paused, 'controller paused state before cl ick'); |
21 assert_true(e.paused, 'element paused state before click'); | 23 assert_true(e.paused, 'element paused state before click'); |
22 e.click(); | 24 e.click(); |
23 assert_false(e.controller.paused, 'controller paused state after cli ck'); | 25 assert_false(e.controller.paused, 'controller paused state after cli ck'); |
24 assert_false(e.paused, 'element paused state after click'); | 26 assert_false(e.paused, 'element paused state after click'); |
25 t.done(); | 27 t.done(); |
26 }); | 28 }); |
27 }, tagName + ' activation behavior for restrained media controller'); | 29 }, tagName + ' activation behavior for restrained media controller', |
30 { timeout: 10000 }); | |
28 | 31 |
29 async_test(function(t) | 32 async_test(function(t) |
30 { | 33 { |
31 var e = document.createElement(tagName); | 34 var e = document.createElement(tagName); |
32 e.controls = true; | 35 e.controls = true; |
33 e.src = src; | 36 e.src = src; |
34 e.preload = 'auto'; | 37 e.preload = 'auto'; |
35 e.oncanplay = t.step_func(function() | 38 e.oncanplay = t.step_func(function() |
36 { | 39 { |
37 e.pause(); // clears autoplaying flag | 40 e.pause(); // clears autoplaying flag |
38 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); | 41 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); |
39 e.controller = new MediaController(); | 42 e.controller = new MediaController(); |
40 assert_false(e.controller.paused, 'controller paused state before cl ick'); | 43 assert_false(e.controller.paused, 'controller paused state before cl ick'); |
41 assert_true(e.paused, 'element paused state before click'); | 44 assert_true(e.paused, 'element paused state before click'); |
42 e.click(); | 45 e.click(); |
43 assert_false(e.controller.paused, 'controller paused state after cli ck'); | 46 assert_false(e.controller.paused, 'controller paused state after cli ck'); |
44 assert_false(e.paused, 'element paused state after click'); | 47 assert_false(e.paused, 'element paused state after click'); |
45 t.done(); | 48 t.done(); |
46 }); | 49 }); |
47 }, tagName + ' activation behavior for restrained media controller (with non -autoplaying paused slave)'); | 50 }, tagName + ' activation behavior for restrained media controller (with non -autoplaying paused slave)', |
51 { timeout: 10000 }); | |
48 | 52 |
49 async_test(function(t) | 53 async_test(function(t) |
50 { | 54 { |
51 var e1 = document.createElement(tagName); | 55 var e1 = document.createElement(tagName); |
52 var e2 = document.createElement(tagName); | 56 var e2 = document.createElement(tagName); |
53 e1.controls = true; | 57 e1.controls = true; |
54 e1.src = e2.src = src; | 58 e1.src = e2.src = src; |
55 e1.preload = e2.preload = 'auto'; | 59 e1.preload = e2.preload = 'auto'; |
56 var canplaycount = 0; | 60 var canplaycount = 0; |
57 e1.oncanplay = e2.oncanplay = t.step_func(function() | 61 e1.oncanplay = e2.oncanplay = t.step_func(function() |
58 { | 62 { |
59 if (++canplaycount != 2) { | 63 if (++canplaycount != 2) { |
60 return; | 64 return; |
61 } | 65 } |
62 e1.play(); | 66 e1.play(); |
63 assert_greater_than(e1.readyState, e1.HAVE_CURRENT_DATA, 'element 1 readyState'); | 67 assert_greater_than(e1.readyState, e1.HAVE_CURRENT_DATA, 'element 1 readyState'); |
64 assert_greater_than(e2.readyState, e2.HAVE_CURRENT_DATA, 'element 2 readyState'); | 68 assert_greater_than(e2.readyState, e2.HAVE_CURRENT_DATA, 'element 2 readyState'); |
65 e1.controller = new MediaController(); | 69 e1.controller = new MediaController(); |
66 e2.controller = e1.controller; | 70 e2.controller = e1.controller; |
67 assert_false(e1.controller.paused, 'controller paused state before c lick'); | 71 assert_false(e1.controller.paused, 'controller paused state before c lick'); |
68 assert_false(e1.paused, 'element 1 paused state before click'); | 72 assert_false(e1.paused, 'element 1 paused state before click'); |
69 assert_true(e2.paused, 'element 2 paused state before click'); | 73 assert_true(e2.paused, 'element 2 paused state before click'); |
70 e1.click(); | 74 e1.click(); |
71 assert_false(e1.controller.paused, 'controller paused state after cl ick'); | 75 assert_false(e1.controller.paused, 'controller paused state after cl ick'); |
72 assert_false(e1.paused, 'element 1 paused state after click'); | 76 assert_false(e1.paused, 'element 1 paused state after click'); |
73 assert_false(e2.paused, 'element 2 paused state after click'); | 77 assert_false(e2.paused, 'element 2 paused state after click'); |
74 t.done(); | 78 t.done(); |
75 }); | 79 }); |
76 }, tagName + ' activation behavior for restrained media controller (with non -blocked playing and autoplaying-and-paused slaves)'); | 80 }, tagName + ' activation behavior for restrained media controller (with non -blocked playing and autoplaying-and-paused slaves)', |
81 { timeout: 10000 }); | |
77 | 82 |
78 test(function() | 83 test(function() |
79 { | 84 { |
80 var e = document.createElement(tagName); | 85 var e = document.createElement(tagName); |
81 e.controls = true; | 86 e.controls = true; |
82 e.controller = new MediaController(); | 87 e.controller = new MediaController(); |
83 e.controller.pause(); | 88 e.controller.pause(); |
84 assert_true(e.controller.paused, 'controller paused state before click') ; | 89 assert_true(e.controller.paused, 'controller paused state before click') ; |
85 assert_true(e.paused, 'element paused state before click'); | 90 assert_true(e.paused, 'element paused state before click'); |
86 e.click(); | 91 e.click(); |
(...skipping 12 matching lines...) Expand all Loading... | |
99 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); | 104 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); |
100 e.controller = new MediaController(); | 105 e.controller = new MediaController(); |
101 e.controller.pause(); | 106 e.controller.pause(); |
102 assert_true(e.controller.paused, 'controller paused state before cli ck'); | 107 assert_true(e.controller.paused, 'controller paused state before cli ck'); |
103 assert_true(e.paused, 'element paused state before click'); | 108 assert_true(e.paused, 'element paused state before click'); |
104 e.click(); | 109 e.click(); |
105 assert_false(e.controller.paused, 'controller paused state after cli ck'); | 110 assert_false(e.controller.paused, 'controller paused state after cli ck'); |
106 assert_true(e.paused, 'element paused state after click'); | 111 assert_true(e.paused, 'element paused state after click'); |
107 t.done(); | 112 t.done(); |
108 }); | 113 }); |
109 }, tagName + ' activation behavior for paused media controller (with non-blo cked paused slave)'); | 114 }, tagName + ' activation behavior for paused media controller (with non-blo cked paused slave)', |
115 { timeout: 10000 }); | |
110 | 116 |
111 test(function() | 117 test(function() |
112 { | 118 { |
113 var e = document.createElement(tagName); | 119 var e = document.createElement(tagName); |
114 e.controls = true; | 120 e.controls = true; |
115 e.controller = new MediaController(); | 121 e.controller = new MediaController(); |
116 e.controller.play(); | 122 e.controller.play(); |
117 assert_false(e.controller.paused, 'controller paused state before click' ); | 123 assert_false(e.controller.paused, 'controller paused state before click' ); |
118 assert_false(e.paused, 'element paused state before click'); | 124 assert_false(e.paused, 'element paused state before click'); |
119 e.click(); | 125 e.click(); |
(...skipping 12 matching lines...) Expand all Loading... | |
132 e.play(); | 138 e.play(); |
133 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); | 139 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); |
134 e.controller = new MediaController(); | 140 e.controller = new MediaController(); |
135 assert_false(e.controller.paused, 'controller paused state before cl ick'); | 141 assert_false(e.controller.paused, 'controller paused state before cl ick'); |
136 assert_false(e.paused, 'element paused state before click'); | 142 assert_false(e.paused, 'element paused state before click'); |
137 e.click(); | 143 e.click(); |
138 assert_true(e.controller.paused, 'controller paused state after clic k'); | 144 assert_true(e.controller.paused, 'controller paused state after clic k'); |
139 assert_false(e.paused, 'element paused state after click'); | 145 assert_false(e.paused, 'element paused state after click'); |
140 t.done(); | 146 t.done(); |
141 }); | 147 }); |
142 }, tagName + ' activation behavior for playing media controller (with non-bl ocked playing slave)'); | 148 }, tagName + ' activation behavior for playing media controller (with non-bl ocked playing slave)', |
149 { timeout: 10000 }); | |
143 | 150 |
144 async_test(function(t) | 151 async_test(function(t) |
145 { | 152 { |
146 var e1 = document.createElement(tagName); | 153 var e1 = document.createElement(tagName); |
147 var e2 = document.createElement(tagName); | 154 var e2 = document.createElement(tagName); |
148 e1.controls = true; | 155 e1.controls = true; |
149 e1.src = src; | 156 e1.src = src; |
150 e1.preload = 'auto'; | 157 e1.preload = 'auto'; |
151 e1.oncanplay = t.step_func(function() | 158 e1.oncanplay = t.step_func(function() |
152 { | 159 { |
153 assert_greater_than(e1.readyState, e1.HAVE_CURRENT_DATA, 'element 1 readyState'); | 160 assert_greater_than(e1.readyState, e1.HAVE_CURRENT_DATA, 'element 1 readyState'); |
154 assert_equals(e2.readyState, e2.HAVE_NOTHING, 'element 2 readyState' ); | 161 assert_equals(e2.readyState, e2.HAVE_NOTHING, 'element 2 readyState' ); |
155 e1.controller = new MediaController(); | 162 e1.controller = new MediaController(); |
156 e2.controller = e1.controller; | 163 e2.controller = e1.controller; |
157 assert_false(e1.controller.paused, 'controller paused state before c lick'); | 164 assert_false(e1.controller.paused, 'controller paused state before c lick'); |
158 assert_true(e1.paused, 'element 1 paused state before click'); | 165 assert_true(e1.paused, 'element 1 paused state before click'); |
159 assert_true(e2.paused, 'element 2 paused state before click'); | 166 assert_true(e2.paused, 'element 2 paused state before click'); |
160 e1.click(); | 167 e1.click(); |
161 assert_true(e1.controller.paused, 'controller paused state after cli ck'); | 168 assert_true(e1.controller.paused, 'controller paused state after cli ck'); |
162 assert_true(e1.paused, 'element 1 paused state after click'); | 169 assert_true(e1.paused, 'element 1 paused state after click'); |
163 assert_true(e2.paused, 'element 2 paused state after click'); | 170 assert_true(e2.paused, 'element 2 paused state after click'); |
164 t.done(); | 171 t.done(); |
165 }); | 172 }); |
166 }, tagName + ' activation behavior for playing media controller (with non-bl ocked autoplaying-and-paused and blocked paused slaves)'); | 173 }, tagName + ' activation behavior for playing media controller (with non-bl ocked autoplaying-and-paused and blocked paused slaves)', |
174 { timeout: 10000 }); | |
167 | 175 |
168 test(function() | 176 test(function() |
169 { | 177 { |
170 var e = document.createElement(tagName); | 178 var e = document.createElement(tagName); |
171 e.controls = true; | 179 e.controls = true; |
172 assert_true(e.paused, 'paused state before click()'); | 180 assert_true(e.paused, 'paused state before click()'); |
173 e.click(); | 181 e.click(); |
174 assert_false(e.paused, 'paused state after click()'); | 182 assert_false(e.paused, 'paused state after click()'); |
175 }, tagName + ' activation behavior for paused media element'); | 183 }, tagName + ' activation behavior for paused media element'); |
176 | 184 |
(...skipping 22 matching lines...) Expand all Loading... | |
199 var e = document.createElement(tagName); | 207 var e = document.createElement(tagName); |
200 assert_true(e.paused, 'paused state before click()'); | 208 assert_true(e.paused, 'paused state before click()'); |
201 e.click(); | 209 e.click(); |
202 assert_true(e.paused, 'paused state after click()'); | 210 assert_true(e.paused, 'paused state after click()'); |
203 }, tagName + ' activation behavior without controls'); | 211 }, tagName + ' activation behavior without controls'); |
204 } | 212 } |
205 | 213 |
206 activation_behavior_test('audio', findMediaFile('audio', 'content/test')); | 214 activation_behavior_test('audio', findMediaFile('audio', 'content/test')); |
207 activation_behavior_test('video', findMediaFile('video', 'content/test')); | 215 activation_behavior_test('video', findMediaFile('video', 'content/test')); |
208 </script> | 216 </script> |
OLD | NEW |