Index: chrome/renderer/password_autocomplete_manager_unittest.cc |
=================================================================== |
--- chrome/renderer/password_autocomplete_manager_unittest.cc (revision 66391) |
+++ chrome/renderer/password_autocomplete_manager_unittest.cc (working copy) |
@@ -38,7 +38,10 @@ |
const char* const kAlicePassword = "password"; |
const char* const kBobUsername = "bob"; |
const char* const kBobPassword = "secret"; |
+const char* const kChrisUsername = "Chris"; |
Ilya Sherman
2010/11/23 07:16:52
nit: In the spirit of cryptographic silliness, ple
|
+const char* const kChrisPassword = "test"; |
+ |
const char* const kFormHTML = |
"<FORM name='LoginTestForm' action='http://www.bidule.com'>" |
" <INPUT type='text' id='username'/>" |
@@ -68,6 +71,8 @@ |
password1_ = ASCIIToUTF16(kAlicePassword); |
username2_ = ASCIIToUTF16(kBobUsername); |
password2_ = ASCIIToUTF16(kBobPassword); |
+ username3_ = ASCIIToUTF16(kChrisUsername); |
+ password3_ = ASCIIToUTF16(kChrisPassword); |
fill_data_.basic_data.fields.push_back( |
FormField(string16(), ASCIIToUTF16(kUsernameName), |
@@ -76,6 +81,7 @@ |
FormField(string16(), ASCIIToUTF16(kPasswordName), |
password1_, string16(), 0)); |
fill_data_.additional_logins[username2_] = password2_; |
+ fill_data_.additional_logins[username3_] = password3_; |
// We need to set the origin so it matches the frame URL and the action so |
// it matches the form action, otherwise we won't autocomplete. |
@@ -141,8 +147,10 @@ |
string16 username1_; |
string16 username2_; |
+ string16 username3_; |
string16 password1_; |
string16 password2_; |
+ string16 password3_; |
PasswordFormFillData fill_data_; |
WebInputElement username_element_; |
@@ -285,6 +293,16 @@ |
CheckTextFieldsState("alf", false, "", false); |
CheckUsernameSelection(3, 3); // No selection. |
+ // Test case sensetive autocompletion. Check Chris is completed iff the start |
+ // charactoer is 'C'. |
Ilya Sherman
2010/11/23 07:16:52
nit: This comment would match the surrounding comm
|
+ SimulateUsernameChange("C", true); |
+ CheckTextFieldsState(kChrisUsername, true, kChrisPassword, true); |
+ CheckUsernameSelection(1, 5); |
+ // And completion is not triggered if the start is 'c'. |
+ SimulateUsernameChange("c", true); |
+ CheckTextFieldsState("c", false, "", false); |
+ CheckUsernameSelection(1, 1); |
+ |
// Ok, so now the user removes all the text and enters the letter 'b'. |
SimulateUsernameChange("b", true); |
// The username and password fields should match the 'bob' entry. |
@@ -310,4 +328,4 @@ |
CheckTextFieldsState(kAliceUsername, true, kAlicePassword, true); |
} |
-} // namespace |
+} |