Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / automation / client_redirects.html
blobb3a221a6d3c13f15b972808cfadb1e15e0a4dc58
1 <!-- Used for testing that the automation code handles client redirects
2 ---- correctly. Tests can call |runTestCase| to run various redirect
3 ---- cases, such as javascript redirects and form submissions.
4 !-->
5 <html>
6 <script>
7 var g_shouldSubmit = true;
9 function runTestCase(case_number) {
10 if (case_number == 1) {
11 document.querySelector("form").submit();
12 } else if (case_number == 2) {
13 g_shouldSubmit = false;
14 // Submitting with javascript does not call the onsubmit handler,
15 // so fire a synthetic event instead.
16 var event = document.createEvent('MouseEvents');
17 event.initMouseEvent('click', true, true, window,
18 0, 0, 0, 0, 0, false, false,
19 false, false, 0, null);
20 document.querySelector("#submitButton").dispatchEvent(event);
21 } else if (case_number == 3) {
22 window.location.href = "client_redirects.html";
23 } else if (case_number == 4) {
24 window.location.href = "nosuchpageexistshopefully";
27 </script>
28 <body>
29 <form name="form" method="get" onsubmit="return g_shouldSubmit">
30 <input name="text" type="text" value="1" />
31 <input id="submitButton" type="submit" value="Submit" />
32 </form>
33 </body>
34 </html>