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

Unified Diff: chrome/renderer/autofill/password_autofill_agent_browsertest.cc

Issue 146023002: Password manager now ignores autocomplete='off' by default; user may specify a flag that says other… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leak in unit test Created 6 years, 10 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/renderer/autofill/password_autofill_agent_browsertest.cc
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
index 6a64f21860e68749608af881b31522c0596907a7..1723480a6b8fa2195a2f660fd0d43664434a0af0 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -12,6 +12,7 @@
#include "components/autofill/content/renderer/test_password_autofill_agent.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
+#include "components/autofill/core/common/password_autofill_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebVector.h"
@@ -301,11 +302,19 @@ class PasswordAutofillAgentTest : public ChromeRenderViewTest {
// has been shown to the user. Of course, it hasn't, so a message is never
// sent to the browser on acceptance, and the DCHECK isn't hit (and nothing
// is filled).
- EXPECT_TRUE(autofill_agent_->password_autofill_agent_->ShowSuggestions(
- username_element_));
-
- EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
- AutofillHostMsg_ShowPasswordSuggestions::ID));
+ //
+ // These tests only make sense in the context of not ignoring
+ // autocomplete='off', so only test them if the disable autocomplete='off'
+ // flag is not enabled.
+ // TODO(jww): Remove this function and callers once autocomplete='off' is
+ // permanently ignored.
+ if (!ShouldIgnoreAutocompleteOffForPasswordFields()) {
+ EXPECT_TRUE(autofill_agent_->password_autofill_agent_->ShowSuggestions(
+ username_element_));
+
+ EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
+ AutofillHostMsg_ShowPasswordSuggestions::ID));
+ }
}
void SimulateKeyDownEvent(const WebInputElement& element,
« no previous file with comments | « chrome/browser/password_manager/password_manager_unittest.cc ('k') | components/autofill/core/common/autofill_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698