| Index: chrome/test/data/password/password_xhr_submit.html
|
| diff --git a/chrome/test/data/password/password_xhr_submit.html b/chrome/test/data/password/password_xhr_submit.html
|
| index 67ec93e2b8b0567b979a6dbda02f2efd3d13afe6..93fec20e0fb3bb778afa782cf8181a3439bcfb6b 100644
|
| --- a/chrome/test/data/password/password_xhr_submit.html
|
| +++ b/chrome/test/data/password/password_xhr_submit.html
|
| @@ -2,9 +2,30 @@
|
| <head>
|
| <script>
|
|
|
| +var navigate = true;
|
| +
|
| +// TODO(gcasto): Not sure why this is necessary, but calling
|
| +// window.domAutomationController directly in setTimeout seemt to causes the
|
| +// function to be evaluated inline.
|
| +function delayedUpload() {
|
| + window.domAutomationController.send("XHR_FINISHED");
|
| +}
|
| +
|
| function state_changed(xhr) {
|
| - if (xhr.readyState == 4)
|
| - window.top.location.href = "done.html";
|
| + if (xhr.readyState == 4) {
|
| + if (navigate) {
|
| + window.top.location.href = "done.html";
|
| + } else {
|
| + // Pretend like auth succeeded by hiding the login and signup forms.
|
| + document.getElementById("testform").style.display = "none";
|
| + document.getElementById("signup_testform").style.display = "none";
|
| + window.domAutomationController.setAutomationId(0);
|
| + // Delay upload so that handler in PasswordAutofillAgent can be run
|
| + // first. This will happen immediately after JS execution ends, so this
|
| + // shouldn't introduce any timing dependent flakes.
|
| + setTimeout(delayedUpload, 0);
|
| + }
|
| + }
|
| }
|
|
|
| function send_xhr() {
|
| @@ -24,7 +45,8 @@ function send_xhr() {
|
| <input type="submit" id="submit_button" name="submit_button">
|
| </form>
|
|
|
| -<form action="password_xhr_submit.html" id="signup_testform">
|
| +<form action="password_xhr_submit.html" onsubmit="send_xhr(); return false;"
|
| + id="signup_testform">
|
| <input type="text" id="signup_username_field" name="signup_username_field">
|
| <input type="password" id="signup_password_field"
|
| name="signup_password_field" autocomplete="new-password">
|
|
|