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

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

Issue 697233002: Remove flag to disable ignore autocomplete='off' for password forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | components/autofill.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 451b1fc527b3e895a4cef0737486c77e0e63387e..47a287486164c3377d517703f4479cddd0851390 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -12,7 +12,6 @@
#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"
@@ -325,37 +324,6 @@ class PasswordAutofillAgentTest : public ChromeRenderViewTest {
is_user_input);
}
- // Tests that no suggestion popup is generated when the username_element_ is
- // edited.
- void ExpectNoSuggestionsPopup() {
- // The first test below ensures that the suggestions have been handled by
- // the password_autofill_agent, even though autocomplete='off' is set. The
- // second check ensures that, although handled, no "show suggestions" IPC to
- // the browser was generated.
- //
- // This is interesting in the specific case of an autocomplete='off' form
- // that also has a remembered username and password
- // (http://crbug.com/326679). To fix the DCHECK that this case used to hit,
- // |true| is returned from ShowSuggestions for all forms with valid
- // usersnames that are autocomplete='off', prentending that a selection box
- // 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).
- //
- // 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(
- password_autofill_agent_->ShowSuggestions(username_element_, false));
-
- EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
- AutofillHostMsg_ShowPasswordSuggestions::ID));
- }
- }
-
void SimulateKeyDownEvent(const WebInputElement& element,
ui::KeyboardCode key_code) {
blink::WebKeyboardEvent key_event;
@@ -970,68 +938,6 @@ TEST_F(PasswordAutofillAgentTest, NoDOMActivationTest) {
CheckTextFieldsDOMState(kAliceUsername, true, "", true);
}
-// Regression test for http://crbug.com/326679
-TEST_F(PasswordAutofillAgentTest, SelectUsernameWithUsernameAutofillOff) {
- // Simulate the browser sending back the login info.
- SimulateOnFillPasswordForm(fill_data_);
-
- // Set the username element to autocomplete='off'
- username_element_.setAttribute(WebString::fromUTF8("autocomplete"),
- WebString::fromUTF8("off"));
-
- // Simulate the user changing the username to some known username.
- SimulateUsernameChange(kAliceUsername, true);
-
- ExpectNoSuggestionsPopup();
-}
-
-// Regression test for http://crbug.com/326679
-TEST_F(PasswordAutofillAgentTest,
- SelectUnknownUsernameWithUsernameAutofillOff) {
- // Simulate the browser sending back the login info.
- SimulateOnFillPasswordForm(fill_data_);
-
- // Set the username element to autocomplete='off'
- username_element_.setAttribute(WebString::fromUTF8("autocomplete"),
- WebString::fromUTF8("off"));
-
- // Simulate the user changing the username to some unknown username.
- SimulateUsernameChange("foo", true);
-
- ExpectNoSuggestionsPopup();
-}
-
-// Regression test for http://crbug.com/326679
-TEST_F(PasswordAutofillAgentTest, SelectUsernameWithPasswordAutofillOff) {
- // Simulate the browser sending back the login info.
- SimulateOnFillPasswordForm(fill_data_);
-
- // Set the main password element to autocomplete='off'
- password_element_.setAttribute(WebString::fromUTF8("autocomplete"),
- WebString::fromUTF8("off"));
-
- // Simulate the user changing the username to some known username.
- SimulateUsernameChange(kAliceUsername, true);
-
- ExpectNoSuggestionsPopup();
-}
-
-// Regression test for http://crbug.com/326679
-TEST_F(PasswordAutofillAgentTest,
- SelectUnknownUsernameWithPasswordAutofillOff) {
- // Simulate the browser sending back the login info.
- SimulateOnFillPasswordForm(fill_data_);
-
- // Set the main password element to autocomplete='off'
- password_element_.setAttribute(WebString::fromUTF8("autocomplete"),
- WebString::fromUTF8("off"));
-
- // Simulate the user changing the username to some unknown username.
- SimulateUsernameChange("foo", true);
-
- ExpectNoSuggestionsPopup();
-}
-
// Verifies that password autofill triggers onChange events in JavaScript for
// forms that are filled on page load.
TEST_F(PasswordAutofillAgentTest,
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | components/autofill.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698