OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/strings/string16.h" | 5 #include "base/strings/string16.h" |
6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "components/autofill/content/renderer/password_form_conversion_utils.h" | 9 #include "components/autofill/content/renderer/password_form_conversion_utils.h" |
10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 ASSERT_NO_FATAL_FAILURE(LoadHTMLAndConvertForm(html, &password_form)); | 262 ASSERT_NO_FATAL_FAILURE(LoadHTMLAndConvertForm(html, &password_form)); |
263 ASSERT_TRUE(password_form); | 263 ASSERT_TRUE(password_form); |
264 | 264 |
265 EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_element), | 265 EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_element), |
266 password_form->username_element); | 266 password_form->username_element); |
267 | 267 |
268 if (nonempty_username_fields) { | 268 if (nonempty_username_fields) { |
269 EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_value), | 269 EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_username_value), |
270 password_form->username_value); | 270 password_form->username_value); |
271 EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_other_possible_usernames), | 271 EXPECT_EQ(base::UTF8ToUTF16(cases[i].expected_other_possible_usernames), |
272 base::JoinString(password_form->other_possible_usernames, | 272 JoinString(password_form->other_possible_usernames, '+')); |
273 base::ASCIIToUTF16("+"))); | |
274 } else { | 273 } else { |
275 EXPECT_TRUE(password_form->username_value.empty()); | 274 EXPECT_TRUE(password_form->username_value.empty()); |
276 EXPECT_TRUE(password_form->other_possible_usernames.empty()); | 275 EXPECT_TRUE(password_form->other_possible_usernames.empty()); |
277 } | 276 } |
278 | 277 |
279 // Do a basic sanity check that we are still having a password field. | 278 // Do a basic sanity check that we are still having a password field. |
280 EXPECT_EQ(base::UTF8ToUTF16("password"), password_form->password_element); | 279 EXPECT_EQ(base::UTF8ToUTF16("password"), password_form->password_element); |
281 EXPECT_EQ(base::UTF8ToUTF16("secret"), password_form->password_value); | 280 EXPECT_EQ(base::UTF8ToUTF16("secret"), password_form->password_value); |
282 } | 281 } |
283 } | 282 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 692 |
694 scoped_ptr<PasswordForm> login_plus_signup_form; | 693 scoped_ptr<PasswordForm> login_plus_signup_form; |
695 ASSERT_NO_FATAL_FAILURE( | 694 ASSERT_NO_FATAL_FAILURE( |
696 LoadHTMLAndConvertForm(login_plus_signup_html, &login_plus_signup_form)); | 695 LoadHTMLAndConvertForm(login_plus_signup_html, &login_plus_signup_form)); |
697 ASSERT_TRUE(login_plus_signup_form); | 696 ASSERT_TRUE(login_plus_signup_form); |
698 EXPECT_EQ(PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP, | 697 EXPECT_EQ(PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP, |
699 login_plus_signup_form->layout); | 698 login_plus_signup_form->layout); |
700 } | 699 } |
701 | 700 |
702 } // namespace autofill | 701 } // namespace autofill |
OLD | NEW |