Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <script src="../../../../resources/js-test.js"></script> | |
| 3 <style> | |
| 4 #target { | |
| 5 width: 50px; | |
| 6 height: 50px; | |
| 7 } | |
| 8 </style> | |
| 9 <iframe id="target" src="resources/event-delegator.html"></iframe> | |
| 10 <div id=console></div> | |
| 11 <script> | |
| 12 var scrollbarEventType; | |
| 13 | |
| 14 function onEventInFrame(e) { | |
| 15 debug("Received " + e.type + " in child frame"); | |
| 16 if (e.type == scrollbarEventType) { | |
| 17 debug('Adding scrollbars to iframe'); | |
| 18 target.contentDocument.body.style.height = "500px"; | |
| 19 } | |
| 20 } | |
| 21 | |
| 22 function eventLogger(e) { | |
| 23 debug("Received " + e.type + " in main frame"); | |
| 24 } | |
| 25 | |
| 26 document.addEventListener('mousemove', eventLogger); | |
| 27 document.addEventListener('mousedown', eventLogger); | |
| 28 document.addEventListener('mouseup', eventLogger); | |
| 29 document.addEventListener('click', eventLogger); | |
| 30 | |
| 31 description("Taps at a point that becomes a scrollbar (i.e. hit test with innerN ode=null) during the tap and verifies we don't crash."); | |
| 32 | |
| 33 // Tap at the right edge of the frame, where it's scrollbar would live. | |
|
Zeeshan Qureshi
2014/08/15 18:33:17
typo: s/it's/its
Rick Byers
2014/08/15 20:17:14
Thanks, done.
| |
| 34 var rect = target.getBoundingClientRect(); | |
| 35 var point = { | |
| 36 x: rect.right - 4, | |
| 37 y: rect.top + rect.height / 2 | |
| 38 }; | |
| 39 | |
| 40 function doTap(type) | |
| 41 { | |
| 42 return new Promise(function(resolve, reject) { | |
| 43 if (type) { | |
| 44 debug('Test case: Add scrollbars during ' + type); | |
| 45 scrollbarEventType = type; | |
| 46 target.contentDocument.body.style.height = "0"; | |
| 47 } else { | |
| 48 debug('Test case: Tap on consistent scrollbar'); | |
| 49 } | |
| 50 | |
| 51 eventSender.gestureTapDown(point.x, point.y); | |
| 52 eventSender.gestureShowPress(point.x, point.y); | |
| 53 debug("Sending GestureTap"); | |
| 54 eventSender.gestureTap(point.x, point.y); | |
| 55 | |
| 56 setTimeout(function() { | |
| 57 debug(''); | |
| 58 resolve(); | |
| 59 }, 0); | |
| 60 }); | |
| 61 } | |
| 62 | |
| 63 if (window.eventSender) { | |
| 64 jsTestIsAsync = true; | |
| 65 target.onload = function() { | |
| 66 doTap() | |
| 67 .then(function() { return doTap('mousemove'); }) | |
| 68 .then(function() { return doTap('mousedown'); }) | |
| 69 .then(function() { return doTap('mouseup'); }) | |
| 70 .catch(function(err) { | |
| 71 testFailed("Promise rejected: " + err.message); | |
| 72 }).then(finishJSTest); | |
| 73 } | |
| 74 } else { | |
| 75 debug("This test requires eventSender"); | |
| 76 } | |
| 77 </script> | |
| OLD | NEW |