<!-- Used for testing that the automation code handles client redirects
---- correctly. Tests can call |runTestCase| to run various redirect
---- cases, such as javascript redirects and form submissions.
!-->
<html>
<script>
var g_shouldSubmit = true;
function runTestCase(case_number) {
if (case_number == 1) {
document.querySelector("form").submit();
} else if (case_number == 2) {
g_shouldSubmit = false;
// Submitting with javascript does not call the onsubmit handler,
// so fire a synthetic event instead.
var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, true, window,
0, 0, 0, 0, 0, false, false,
false, false, 0, null);
document.querySelector("#submitButton").dispatchEvent(event);
} else if (case_number == 3) {
window.location.href = "client_redirects.html";
} else if (case_number == 4) {
window.location.href = "nosuchpageexistshopefully";
}
}
</script>
<body>
<form name="form" method="get" onsubmit="return g_shouldSubmit">
<input name="text" type="text" value="1" />
<input id="submitButton" type="submit" value="Submit" />
</form>
</body>
</html>