| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <embed id="plugin" type="application/x-webkit-test-webplugin" accepts-touch="raw
" print-user-gesture-status="true" width="100" height="100"></embed> | 4 <embed id="plugin" type="application/x-webkit-test-webplugin" accepts-touch="raw
" print-user-gesture-status="true" width="100" height="100"></embed> |
| 5 <p> | 5 <p> |
| 6 Test that the user gesture indicator is correctly set for events forwarded | 6 Test that the user gesture indicator is correctly set for events forwarded |
| 7 through the WebPluginContainer. The tests succeeds if the first | 7 through the WebPluginContainer. The tests succeeds if the first |
| 8 mousedown/mouseup event pair is a user gesture, and the second is not. | 8 mousedown/mouseup event pair is a user gesture, and the second is not. |
| 9 </p> | 9 </p> |
| 10 <script> | 10 <script> |
| 11 if (!window.testRunner || !window.eventSender) { | 11 if (!window.testRunner || !window.eventSender) { |
| 12 document.write("This test does not work in manual mode."); | 12 document.write("This test does not work in manual mode."); |
| 13 } else { | 13 } else { |
| 14 testRunner.dumpAsText(); | 14 testRunner.dumpAsText(); |
| 15 | 15 |
| 16 // Mouse events only work after an initial layout | |
| 17 document.body.offsetLeft; | |
| 18 // Click on the plugin. | 16 // Click on the plugin. |
| 19 eventSender.mouseMoveTo(20, 20); | 17 eventSender.mouseMoveTo(20, 20); |
| 20 eventSender.mouseDown(); | 18 eventSender.mouseDown(); |
| 21 eventSender.mouseUp(); | 19 eventSender.mouseUp(); |
| 22 | 20 |
| 23 // Fake mouse events | 21 // Fake mouse events |
| 24 var plugin = document.getElementById("plugin"); | 22 var plugin = document.getElementById("plugin"); |
| 25 var evt = document.createEvent("MouseEvent"); | 23 var evt = document.createEvent("MouseEvent"); |
| 26 evt.initMouseEvent("mousedown", true, true, window, 1, 20, 20, 20, 20, f
alse, false, false, false, 0, null); | 24 evt.initMouseEvent("mousedown", true, true, window, 1, 20, 20, 20, 20, f
alse, false, false, false, 0, null); |
| 27 plugin.dispatchEvent(evt); | 25 plugin.dispatchEvent(evt); |
| 28 | 26 |
| 29 evt = document.createEvent("MouseEvent"); | 27 evt = document.createEvent("MouseEvent"); |
| 30 evt.initMouseEvent("mouseup", true, true, window, 1, 20, 20, 20, 20, fal
se, false, false, false, 0, null); | 28 evt.initMouseEvent("mouseup", true, true, window, 1, 20, 20, 20, 20, fal
se, false, false, false, 0, null); |
| 31 plugin.dispatchEvent(evt); | 29 plugin.dispatchEvent(evt); |
| 32 } | 30 } |
| 33 </script> | 31 </script> |
| 34 </body> | 32 </body> |
| 35 </html> | 33 </html> |
| OLD | NEW |