Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Unified Diff: chrome/test/data/password/password_xhr_submit.html

Issue 1012853002: [Password Manager] Use successful XHR submission as a signal for password saving (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..bc32409fa055085b5f9373e5b6bbfe96d0744e45 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() {

Powered by Google App Engine
This is Rietveld 408576698