summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/autofill/password_generation_manager_browsertest.cc
diff options
context:
space:
mode:
authormihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 22:00:51 +0000
committermihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-30 22:00:51 +0000
commitace62514423ffe9c55eeb3c5b8069e87d1a30cc2 (patch)
tree548d6ed3b6976c4302138806ea26fc8153d19dea /chrome/renderer/autofill/password_generation_manager_browsertest.cc
parent4699f1faf715bc2714e0d6b0ca8b939b6cefcef7 (diff)
downloadchromium_src-ace62514423ffe9c55eeb3c5b8069e87d1a30cc2.zip
chromium_src-ace62514423ffe9c55eeb3c5b8069e87d1a30cc2.tar.gz
chromium_src-ace62514423ffe9c55eeb3c5b8069e87d1a30cc2.tar.bz2
Revert 129946 - Enable password generation only if sync for passwords is enabled.
BUG=114092 TEST=Ran corresponding unit and browser tests. Review URL: https://chromiumcodereview.appspot.com/9834082 TBR=gcasto@chromium.org Review URL: https://chromiumcodereview.appspot.com/9956041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129963 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/autofill/password_generation_manager_browsertest.cc')
-rw-r--r--chrome/renderer/autofill/password_generation_manager_browsertest.cc57
1 files changed, 22 insertions, 35 deletions
diff --git a/chrome/renderer/autofill/password_generation_manager_browsertest.cc b/chrome/renderer/autofill/password_generation_manager_browsertest.cc
index 1119bd4..72e612b 100644
--- a/chrome/renderer/autofill/password_generation_manager_browsertest.cc
+++ b/chrome/renderer/autofill/password_generation_manager_browsertest.cc
@@ -72,22 +72,14 @@ class PasswordGenerationManagerTest : public ChromeRenderViewTest {
DISALLOW_COPY_AND_ASSIGN(PasswordGenerationManagerTest);
};
-const char kSigninFormHTML[] =
- "<FORM name = 'blah' action = 'www.random.com/'> "
- " <INPUT type = 'text' id = 'username'/> "
- " <INPUT type = 'password' id = 'password'/> "
- " <INPUT type = 'submit' value = 'LOGIN' />"
- "</FORM>";
-
-const char kAccountCreationFormHTML[] =
- "<FORM name = 'blah' action = 'www.random.com/'> "
- " <INPUT type = 'text' id = 'username'/> "
- " <INPUT type = 'password' id = 'first_password'/> "
- " <INPUT type = 'password' id = 'second_password'/> "
- " <INPUT type = 'submit' value = 'LOGIN' />"
- "</FORM>";
TEST_F(PasswordGenerationManagerTest, DetectionTest) {
+ const char kSigninFormHTML[] =
+ "<FORM name = 'blah' action = 'www.random.com/'> "
+ " <INPUT type = 'text' id = 'username'/> "
+ " <INPUT type = 'password' id = 'password'/> "
+ " <INPUT type = 'submit' value = 'LOGIN' />"
+ "</FORM>";
LoadHTML(kSigninFormHTML);
WebDocument document = GetMainFrame()->document();
@@ -97,9 +89,16 @@ TEST_F(PasswordGenerationManagerTest, DetectionTest) {
WebInputElement password_element = element.to<WebInputElement>();
EXPECT_EQ(0u, generation_manager_->messages().size());
+ const char kAccountCreationFormHTML[] =
+ "<FORM name = 'blah' action = 'www.random.com/'> "
+ " <INPUT type = 'text' id = 'username'/> "
+ " <INPUT type = 'password' id = 'first_password'/> "
+ " <INPUT type = 'password' id = 'second_password'/> "
+ " <INPUT type = 'submit' value = 'LOGIN' />"
+ "</FORM>";
LoadHTML(kAccountCreationFormHTML);
- // We don't do anything yet because the feature is disabled.
+ // We don't autofill at first.
document = GetMainFrame()->document();
element = document.getElementById(WebString::fromUTF8("first_password"));
ASSERT_FALSE(element.isNull());
@@ -109,24 +108,8 @@ TEST_F(PasswordGenerationManagerTest, DetectionTest) {
ASSERT_FALSE(element.isNull());
WebInputElement second_password_element = element.to<WebInputElement>();
EXPECT_EQ(0u, generation_manager_->messages().size());
- SetFocused(first_password_element.to<WebNode>());
- EXPECT_EQ(0u, generation_manager_->messages().size());
-
- // Pretend like sync was enabled.
- AutofillMsg_PasswordSyncEnabled msg(0, true);
- generation_manager_->OnMessageReceived(msg);
- // Now we will send a message once the first password feld is focused.
- LoadHTML(kAccountCreationFormHTML);
- document = GetMainFrame()->document();
- element = document.getElementById(WebString::fromUTF8("first_password"));
- ASSERT_FALSE(element.isNull());
- first_password_element = element.to<WebInputElement>();
- EXPECT_EQ(0u, generation_manager_->messages().size());
- element = document.getElementById(WebString::fromUTF8("second_password"));
- ASSERT_FALSE(element.isNull());
- second_password_element = element.to<WebInputElement>();
- EXPECT_EQ(0u, generation_manager_->messages().size());
+ // After first element is focused, then we autofill.
SetFocused(first_password_element.to<WebNode>());
EXPECT_EQ(1u, generation_manager_->messages().size());
EXPECT_EQ(AutofillHostMsg_ShowPasswordGenerationPopup::ID,
@@ -134,9 +117,13 @@ TEST_F(PasswordGenerationManagerTest, DetectionTest) {
}
TEST_F(PasswordGenerationManagerTest, FillTest) {
- // Make sure that we are enabled before loading HTML.
- AutofillMsg_PasswordSyncEnabled enabled_msg(0, true);
- generation_manager_->OnMessageReceived(enabled_msg);
+ const char kAccountCreationFormHTML[] =
+ "<FORM name = 'blah' action = 'www.random.com/'> "
+ " <INPUT type = 'text' id = 'username'/> "
+ " <INPUT type = 'password' id = 'first_password'/> "
+ " <INPUT type = 'password' id = 'second_password'/> "
+ " <INPUT type = 'submit' value = 'LOGIN' />"
+ "</FORM>";
LoadHTML(kAccountCreationFormHTML);
WebDocument document = GetMainFrame()->document();