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