OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>HitRegion Event Test</title> | 2 <title>HitRegion Event Test</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="./resources/test-helpers.js"></script> | 5 <script src="./resources/test-helpers.js"></script> |
6 <canvas width="400" height="400"> | 6 <canvas width="400" height="400"> |
7 <button id="button"></button> | 7 <button id="button"></button> |
8 <button id="button2"></button> | 8 <button id="button2"></button> |
9 </canvas> | 9 </canvas> |
10 <style> | 10 <style> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 context.fill(); | 102 context.fill(); |
103 context.addHitRegion({ id: 'button', control: button }); | 103 context.addHitRegion({ id: 'button', control: button }); |
104 | 104 |
105 var expected = [ | 105 var expected = [ |
106 { type: 'mouseover', target: button, region: 'button' }, | 106 { type: 'mouseover', target: button, region: 'button' }, |
107 { type: 'mouseenter', target: button, region: 'button' }, | 107 { type: 'mouseenter', target: button, region: 'button' }, |
108 { type: 'mousemove', target: button, region: 'button' }, | 108 { type: 'mousemove', target: button, region: 'button' }, |
109 { type: 'mousemove', target: button, region: 'button' }, | 109 { type: 'mousemove', target: button, region: 'button' }, |
110 { type: 'mousedown', target: button, region: 'button' }, | 110 { type: 'mousedown', target: button, region: 'button' }, |
111 { type: 'mouseup', target: button, region: 'button' }, | 111 { type: 'mouseup', target: button, region: 'button' }, |
112 // TODO(zino): The expected value of region should be "button" instead of | 112 { type: 'mouseout', target: button, region: 'button' }, |
113 // null in case of mouseout/mouseleave. Please see http://crbug.com/592992. | 113 { type: 'mouseleave', target: button, region: 'button' }, |
114 { type: 'mouseout', target: button, region: null }, | |
115 { type: 'mouseleave', target: button, region: null }, | |
116 { type: 'touchstart', target: button, region: 'button' }, | 114 { type: 'touchstart', target: button, region: 'button' }, |
117 { type: 'touchend', target: button, region: 'button' }, | 115 { type: 'touchend', target: button, region: 'button' }, |
118 ]; | 116 ]; |
119 var actual = []; | 117 var actual = []; |
120 | 118 |
121 button.addEventListener('mouseover', e => actual.push(e)); | 119 button.addEventListener('mouseover', e => actual.push(e)); |
122 button.addEventListener('mouseenter', e => actual.push(e)); | 120 button.addEventListener('mouseenter', e => actual.push(e)); |
123 button.addEventListener('mousemove', e => actual.push(e)); | 121 button.addEventListener('mousemove', e => actual.push(e)); |
124 button.addEventListener('mousedown', e => actual.push(e)); | 122 button.addEventListener('mousedown', e => actual.push(e)); |
125 button.addEventListener('mouseup', e => actual.push(e)); | 123 button.addEventListener('mouseup', e => actual.push(e)); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 called.push(e.touches[1].region); | 256 called.push(e.touches[1].region); |
259 called.push(e.touches[2].region); | 257 called.push(e.touches[2].region); |
260 }); | 258 }); |
261 | 259 |
262 tmp_canvas.dispatchEvent(touch_event); | 260 tmp_canvas.dispatchEvent(touch_event); |
263 assert_array_equals(called, [ null, null, 'touch', null, null, 'touch' ]); | 261 assert_array_equals(called, [ null, null, 'touch', null, null, 'touch' ]); |
264 this.done(); | 262 this.done(); |
265 }, 'TouchEventInit.'); | 263 }, 'TouchEventInit.'); |
266 | 264 |
267 </script> | 265 </script> |
OLD | NEW |