Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / multiple-form-submission-protection-mouse.html
blobe88f6e5798547ae6cbc2380edaa7f2a169213d38
1 <html>
2 <head>
3 <script>
5 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.setCanOpenWindows();
8 testRunner.waitUntilDone();
11 addEventListener('message', function(e) {
12 simulateClick('button2');
13 }, false);
15 function runTest()
17 if (!eventSender)
18 return;
20 simulateClick('button1');
23 function simulateClick(id)
25 var rect = document.getElementById(id).getBoundingClientRect();
26 eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2);
27 eventSender.mouseDown();
28 eventSender.mouseUp();
31 function submitTo(target)
33 document.test.target = target;
34 document.test.submit();
37 </script>
38 </head>
39 <body onload="runTest()">
40 <p>This test ensures that multiple form submission protection is correctly reset on mouse events. To test manually:
41 <ol>
42 <li>Click on "Click 1" to submit form to a new window. The window will close immediately.
43 <li>Click on "Click 2" to submit form to this window. Single word "SUCCESS" should replace the contents of this document.
44 </ol>
45 <p>If either event doesn't occur, the test has failed.
46 <form method="post" name="test" action="data:text/html,<script>if (opener) { opener.postMessage('trololo', '*'); window.close(); } else { document.write('SUCCESS'); window.testRunner && testRunner.notifyDone(); }</script>">
47 <input type="button" id="button1" value="Click 1" onclick="submitTo('_new')">
48 <input type="button" id="button2" value="Click 2" onclick="submitTo('_self')">
49 </form>
50 </body>
51 </html>