Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / click-after-mousedown-cancel.html
blob22fdce234df15e38362797a93cfb11ae04f93ca1
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <iframe src="data:text/html,"></iframe>
4 <button type="button">Button</button>
5 <script>
6 description('Mousedown without mouseup in a sub frame should not confuse a click in another frame.');
7 jsTestIsAsync = true;
8 window.onload = function() {
9 var button = document.querySelector('button');
10 button.addEventListener('mousedown', function(event) {
11 event.preventDefault();
12 }, false);
13 button.addEventListener('click', function(event) {
14 testPassed('Click event was dispatched.');
15 finishJSTest();
16 }, false);
18 var iframe = document.querySelector('iframe');
19 // Mousedown on the iframe, but no mouseup.
20 eventSender.mouseMoveTo(iframe.offsetLeft + iframe.offsetWidth / 2, iframe.offsetTop + iframe.offsetHeight / 2);
21 eventSender.mouseDown(1);
22 // Click on the button in the main document.
23 eventSender.mouseMoveTo(button.offsetLeft + button.offsetWidth / 2, button.offsetTop + button.offsetHeight / 2);
24 eventSender.mouseDown(0);
25 setTimeout(function() {
26 testFailed('Click event was not dispatched.');
27 finishJSTest();
28 }, 100);
29 eventSender.mouseUp(0);
31 </script>