Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / data / password / password_xhr_submit.html
blob9426dd9ab8e931aa0363592698dd97fb9b53a8c8
1 <html>
2 <head>
3 <base href="done">
5 <script>
7 var navigate = true;
9 // TODO(gcasto): Not sure why this is necessary, but calling
10 // window.domAutomationController directly in setTimeout seemt to causes the
11 // function to be evaluated inline.
12 function delayedUpload() {
13 window.domAutomationController.send("XHR_FINISHED");
16 function state_changed(xhr) {
17 if (xhr.readyState == 4) {
18 if (navigate) {
19 window.top.location.href = "done.html";
20 } else {
21 // Pretend like auth succeeded by hiding the login and signup forms.
22 document.getElementById("testform").style.display = "none";
23 document.getElementById("signup_testform").style.display = "none";
24 window.domAutomationController.setAutomationId(0);
25 // Delay upload so that handler in PasswordAutofillAgent can be run
26 // first. This will happen immediately after JS execution ends, so this
27 // shouldn't introduce any timing dependent flakes.
28 setTimeout(delayedUpload, 0);
33 function send_xhr() {
34 var xhr = new XMLHttpRequest();
35 xhr.onreadystatechange = function() { state_changed(xhr); };
36 xhr.open("GET", "password_xhr_submit.html", true);
37 xhr.send(null);
40 </script>
41 </head>
42 <body>
43 <form onsubmit="send_xhr(); return false;" id="testform">
44 <input type="text" id="username_field" name="username_field">
45 <input type="password" id="password_field" name="password_field">
46 <input type="submit" id="submit_button" name="submit_button">
47 </form>
49 <form action="password_xhr_submit.html" onsubmit="send_xhr(); return false;"
50 id="signup_testform">
51 <input type="text" id="signup_username_field" name="signup_username_field">
52 <input type="password" id="signup_password_field"
53 name="signup_password_field" autocomplete="new-password">
54 <input type="password" id="confirmation_password_field"
55 name="confirmation_password_field" autocomplete="new-password">
56 <input type="submit" id="signup_submit_button" name="signup_submit_button">
57 </form>
58 </body>
59 </html>