Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE HTML> | |
| 2 <script src='../../../../../resources/js-test.js'></script> | |
| 3 <style> | |
| 4 iframe { | |
| 5 width: 300px; | |
| 6 height: 300px; | |
| 7 top: 100px; | |
| 8 left: 50px; | |
| 9 border: 0; | |
| 10 position: absolute; | |
| 11 background: green; | |
| 12 } | |
| 13 </style> | |
| 14 <iframe id='target' srcdoc=" | |
| 15 <body style='height:500px; width: 500px; padding: 0; margin: 0;'> | |
| 16 <script> | |
| 17 var testEventList = ['pointerup', 'pointerdown', 'pointermove']; | |
| 18 testEventList.forEach(function(eventName) { | |
| 19 document.documentElement.addEventListener(eventName, function(event) { | |
| 20 top.document.events.push(event); | |
| 21 }); | |
| 22 }); | |
| 23 </script> | |
| 24 </body>"> | |
| 25 </iframe> | |
| 26 | |
| 27 <div id='console'></div> | |
| 28 | |
| 29 <script> | |
| 30 | |
| 31 var attributes = [ | |
| 32 'clientX', | |
| 33 'clientY' | |
| 34 ]; | |
| 35 | |
| 36 document.events = []; | |
| 37 | |
| 38 function testScenario(scrollX, scrollY, zoomFactor) { | |
| 39 document.getElementById('target').contentWindow.scrollTo(scrollX, scrollY); | |
|
mustaq
2016/05/10 17:26:16
Please print a test scenario header with the curre
Navid Zolghadr
2016/05/10 17:46:42
Done.
I also added the touch event listener to se
| |
| 40 window.internals.setZoomFactor(zoomFactor); | |
| 41 | |
| 42 // touch events inside iframe | |
| 43 eventSender.addTouchPoint(200, 200) | |
| 44 eventSender.touchStart(); | |
| 45 eventSender.updateTouchPoint(0, 200, 200); | |
| 46 eventSender.touchMove(); | |
| 47 eventSender.releaseTouchPoint(0); | |
| 48 eventSender.touchEnd(); | |
| 49 | |
| 50 } | |
| 51 | |
| 52 function runTests(scrollX, scrollY) { | |
| 53 testRunner.dumpAsText(); | |
| 54 testRunner.waitUntilDone(); | |
| 55 | |
| 56 testScenario(25, 100, 1); | |
| 57 testScenario(40, 140, 1); | |
| 58 testScenario(40, 140, 2); | |
| 59 | |
| 60 window.setTimeout('finish()', 0); | |
| 61 } | |
| 62 | |
| 63 function finish() | |
| 64 { | |
| 65 document.events.forEach(function(event) { | |
| 66 debug(event.type + " of " + event.pointerType + " is recieved:"); | |
| 67 attributes.forEach(function(att) { | |
| 68 debug(att + " = " + event[att]); | |
| 69 }); | |
| 70 }); | |
| 71 testRunner.notifyDone(); | |
| 72 } | |
| 73 | |
| 74 if (window.eventSender) { | |
| 75 window.onload = runTests; | |
| 76 } else | |
| 77 debug('This test requires eventSender'); | |
| 78 | |
| 79 description("This test verifies clientX/Y of pointer events inside iframe."); | |
| 80 | |
| 81 </script> | |
| OLD | NEW |