Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: LayoutTests/media/activation-behavior.html

Issue 216233003: Make media element sources unique to investigate flaky test (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: deterministic Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var uniqueSrcCounter = 0;
9
8 function activation_behavior_test(tagName, src) 10 function activation_behavior_test(tagName, src)
9 { 11 {
12 // FIXME: hack used to investigate http://crbug.com/355489
13 function uniqueSrc()
14 {
15 return src + '?activation-behavior-' + ++uniqueSrcCounter;
16 }
17
10 async_test(function(t) 18 async_test(function(t)
11 { 19 {
12 var e = document.createElement(tagName); 20 var e = document.createElement(tagName);
13 e.controls = true; 21 e.controls = true;
14 e.src = src; 22 e.src = uniqueSrc();
15 e.preload = 'auto'; 23 e.preload = 'auto';
16 e.oncanplay = t.step_func(function() 24 e.oncanplay = t.step_func(function()
17 { 25 {
18 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); 26 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState');
19 e.controller = new MediaController(); 27 e.controller = new MediaController();
20 assert_false(e.controller.paused, 'controller paused state before cl ick'); 28 assert_false(e.controller.paused, 'controller paused state before cl ick');
21 assert_true(e.paused, 'element paused state before click'); 29 assert_true(e.paused, 'element paused state before click');
22 e.click(); 30 e.click();
23 assert_false(e.controller.paused, 'controller paused state after cli ck'); 31 assert_false(e.controller.paused, 'controller paused state after cli ck');
24 assert_false(e.paused, 'element paused state after click'); 32 assert_false(e.paused, 'element paused state after click');
25 t.done(); 33 t.done();
26 }); 34 });
27 }, tagName + ' activation behavior for restrained media controller'); 35 }, tagName + ' activation behavior for restrained media controller');
28 36
29 async_test(function(t) 37 async_test(function(t)
30 { 38 {
31 var e = document.createElement(tagName); 39 var e = document.createElement(tagName);
32 e.controls = true; 40 e.controls = true;
33 e.src = src; 41 e.src = uniqueSrc();
34 e.preload = 'auto'; 42 e.preload = 'auto';
35 e.oncanplay = t.step_func(function() 43 e.oncanplay = t.step_func(function()
36 { 44 {
37 e.pause(); // clears autoplaying flag 45 e.pause(); // clears autoplaying flag
38 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); 46 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState');
39 e.controller = new MediaController(); 47 e.controller = new MediaController();
40 assert_false(e.controller.paused, 'controller paused state before cl ick'); 48 assert_false(e.controller.paused, 'controller paused state before cl ick');
41 assert_true(e.paused, 'element paused state before click'); 49 assert_true(e.paused, 'element paused state before click');
42 e.click(); 50 e.click();
43 assert_false(e.controller.paused, 'controller paused state after cli ck'); 51 assert_false(e.controller.paused, 'controller paused state after cli ck');
44 assert_false(e.paused, 'element paused state after click'); 52 assert_false(e.paused, 'element paused state after click');
45 t.done(); 53 t.done();
46 }); 54 });
47 }, tagName + ' activation behavior for restrained media controller (with non -autoplaying paused slave)'); 55 }, tagName + ' activation behavior for restrained media controller (with non -autoplaying paused slave)');
48 56
49 async_test(function(t) 57 async_test(function(t)
50 { 58 {
51 var e1 = document.createElement(tagName); 59 var e1 = document.createElement(tagName);
52 var e2 = document.createElement(tagName); 60 var e2 = document.createElement(tagName);
53 e1.controls = true; 61 e1.controls = true;
54 e1.src = e2.src = src; 62 e1.src = uniqueSrc();
63 e2.src = uniqueSrc();
55 e1.preload = e2.preload = 'auto'; 64 e1.preload = e2.preload = 'auto';
56 var canplaycount = 0; 65 var canplaycount = 0;
57 e1.oncanplay = e2.oncanplay = t.step_func(function() 66 e1.oncanplay = e2.oncanplay = t.step_func(function()
58 { 67 {
59 if (++canplaycount != 2) { 68 if (++canplaycount != 2) {
60 return; 69 return;
61 } 70 }
62 e1.play(); 71 e1.play();
63 assert_greater_than(e1.readyState, e1.HAVE_CURRENT_DATA, 'element 1 readyState'); 72 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'); 73 assert_greater_than(e2.readyState, e2.HAVE_CURRENT_DATA, 'element 2 readyState');
(...skipping 20 matching lines...) Expand all
85 assert_true(e.paused, 'element paused state before click'); 94 assert_true(e.paused, 'element paused state before click');
86 e.click(); 95 e.click();
87 assert_false(e.controller.paused, 'controller paused state after click') ; 96 assert_false(e.controller.paused, 'controller paused state after click') ;
88 assert_true(e.paused, 'element paused state after click'); 97 assert_true(e.paused, 'element paused state after click');
89 }, tagName + ' activation behavior for paused media controller'); 98 }, tagName + ' activation behavior for paused media controller');
90 99
91 async_test(function(t) 100 async_test(function(t)
92 { 101 {
93 var e = document.createElement(tagName); 102 var e = document.createElement(tagName);
94 e.controls = true; 103 e.controls = true;
95 e.src = src; 104 e.src = uniqueSrc();
96 e.preload = 'auto'; 105 e.preload = 'auto';
97 e.oncanplay = t.step_func(function() 106 e.oncanplay = t.step_func(function()
98 { 107 {
99 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); 108 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState');
100 e.controller = new MediaController(); 109 e.controller = new MediaController();
101 e.controller.pause(); 110 e.controller.pause();
102 assert_true(e.controller.paused, 'controller paused state before cli ck'); 111 assert_true(e.controller.paused, 'controller paused state before cli ck');
103 assert_true(e.paused, 'element paused state before click'); 112 assert_true(e.paused, 'element paused state before click');
104 e.click(); 113 e.click();
105 assert_false(e.controller.paused, 'controller paused state after cli ck'); 114 assert_false(e.controller.paused, 'controller paused state after cli ck');
(...skipping 12 matching lines...) Expand all
118 assert_false(e.paused, 'element paused state before click'); 127 assert_false(e.paused, 'element paused state before click');
119 e.click(); 128 e.click();
120 assert_true(e.controller.paused, 'controller paused state after click'); 129 assert_true(e.controller.paused, 'controller paused state after click');
121 assert_false(e.paused, 'element paused state after click'); 130 assert_false(e.paused, 'element paused state after click');
122 }, tagName + ' activation behavior for playing media controller'); 131 }, tagName + ' activation behavior for playing media controller');
123 132
124 async_test(function(t) 133 async_test(function(t)
125 { 134 {
126 var e = document.createElement(tagName); 135 var e = document.createElement(tagName);
127 e.controls = true; 136 e.controls = true;
128 e.src = src; 137 e.src = uniqueSrc();
129 e.preload = 'auto'; 138 e.preload = 'auto';
130 e.oncanplay = t.step_func(function() 139 e.oncanplay = t.step_func(function()
131 { 140 {
132 e.play(); 141 e.play();
133 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState'); 142 assert_greater_than(e.readyState, e.HAVE_CURRENT_DATA, 'element read yState');
134 e.controller = new MediaController(); 143 e.controller = new MediaController();
135 assert_false(e.controller.paused, 'controller paused state before cl ick'); 144 assert_false(e.controller.paused, 'controller paused state before cl ick');
136 assert_false(e.paused, 'element paused state before click'); 145 assert_false(e.paused, 'element paused state before click');
137 e.click(); 146 e.click();
138 assert_true(e.controller.paused, 'controller paused state after clic k'); 147 assert_true(e.controller.paused, 'controller paused state after clic k');
139 assert_false(e.paused, 'element paused state after click'); 148 assert_false(e.paused, 'element paused state after click');
140 t.done(); 149 t.done();
141 }); 150 });
142 }, tagName + ' activation behavior for playing media controller (with non-bl ocked playing slave)'); 151 }, tagName + ' activation behavior for playing media controller (with non-bl ocked playing slave)');
143 152
144 async_test(function(t) 153 async_test(function(t)
145 { 154 {
146 var e1 = document.createElement(tagName); 155 var e1 = document.createElement(tagName);
147 var e2 = document.createElement(tagName); 156 var e2 = document.createElement(tagName);
148 e1.controls = true; 157 e1.controls = true;
149 e1.src = src; 158 e1.src = uniqueSrc();
150 e1.preload = 'auto'; 159 e1.preload = 'auto';
151 e1.oncanplay = t.step_func(function() 160 e1.oncanplay = t.step_func(function()
152 { 161 {
153 assert_greater_than(e1.readyState, e1.HAVE_CURRENT_DATA, 'element 1 readyState'); 162 assert_greater_than(e1.readyState, e1.HAVE_CURRENT_DATA, 'element 1 readyState');
154 assert_equals(e2.readyState, e2.HAVE_NOTHING, 'element 2 readyState' ); 163 assert_equals(e2.readyState, e2.HAVE_NOTHING, 'element 2 readyState' );
155 e1.controller = new MediaController(); 164 e1.controller = new MediaController();
156 e2.controller = e1.controller; 165 e2.controller = e1.controller;
157 assert_false(e1.controller.paused, 'controller paused state before c lick'); 166 assert_false(e1.controller.paused, 'controller paused state before c lick');
158 assert_true(e1.paused, 'element 1 paused state before click'); 167 assert_true(e1.paused, 'element 1 paused state before click');
159 assert_true(e2.paused, 'element 2 paused state before click'); 168 assert_true(e2.paused, 'element 2 paused state before click');
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 var e = document.createElement(tagName); 208 var e = document.createElement(tagName);
200 assert_true(e.paused, 'paused state before click()'); 209 assert_true(e.paused, 'paused state before click()');
201 e.click(); 210 e.click();
202 assert_true(e.paused, 'paused state after click()'); 211 assert_true(e.paused, 'paused state after click()');
203 }, tagName + ' activation behavior without controls'); 212 }, tagName + ' activation behavior without controls');
204 } 213 }
205 214
206 activation_behavior_test('audio', findMediaFile('audio', 'content/test')); 215 activation_behavior_test('audio', findMediaFile('audio', 'content/test'));
207 activation_behavior_test('video', findMediaFile('video', 'content/test')); 216 activation_behavior_test('video', findMediaFile('video', 'content/test'));
208 </script> 217 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698