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

Side by Side Diff: components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc

Issue 1161023008: Suggest to fill password change forms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tiny fix Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 TEST_F(MAYBE_PasswordFormConversionUtilsTest, IdentifyingTwoPasswordFields) { 285 TEST_F(MAYBE_PasswordFormConversionUtilsTest, IdentifyingTwoPasswordFields) {
286 // Each test case consists of a set of parameters to be plugged into the 286 // Each test case consists of a set of parameters to be plugged into the
287 // PasswordFormBuilder below, plus the corresponding expectations. 287 // PasswordFormBuilder below, plus the corresponding expectations.
288 struct TestCase { 288 struct TestCase {
289 const char* password_values[2]; 289 const char* password_values[2];
290 const char* expected_password_element; 290 const char* expected_password_element;
291 const char* expected_password_value; 291 const char* expected_password_value;
292 const char* expected_new_password_element; 292 const char* expected_new_password_element;
293 const char* expected_new_password_value; 293 const char* expected_new_password_value;
294 } cases[] = { 294 } cases[] = {
295 // Twp non-empty fields with the same value should be treated as a new 295 // Two non-empty fields with the same value should be treated as a new
296 // password field plus a confirmation field for the new password. 296 // password field plus a confirmation field for the new password.
297 {{"alpha", "alpha"}, "", "", "password1", "alpha"}, 297 {{"alpha", "alpha"}, "", "", "password1", "alpha"},
298 // The same goes if the fields are yet empty: we speculate that we will 298 // The same goes if the fields are yet empty: we speculate that we will
299 // identify them as new password fields once they are filled out, and we 299 // identify them as new password fields once they are filled out, and we
300 // want to keep our abstract interpretation of the form less flaky. 300 // want to keep our abstract interpretation of the form less flaky.
301 {{"", ""}, "", "", "password1", ""}, 301 {{"", ""}, "password1", "", "password2", ""},
302 // Two different values should be treated as a password change form, one 302 // Two different values should be treated as a password change form, one
303 // that also asks for the current password, but only once for the new. 303 // that also asks for the current password, but only once for the new.
304 {{"alpha", ""}, "password1", "alpha", "password2", ""}, 304 {{"alpha", ""}, "password1", "alpha", "password2", ""},
305 {{"", "beta"}, "password1", "", "password2", "beta"}, 305 {{"", "beta"}, "password1", "", "password2", "beta"},
306 {{"alpha", "beta"}, "password1", "alpha", "password2", "beta"}}; 306 {{"alpha", "beta"}, "password1", "alpha", "password2", "beta"}};
307 307
308 for (size_t i = 0; i < arraysize(cases); ++i) { 308 for (size_t i = 0; i < arraysize(cases); ++i) {
309 SCOPED_TRACE(testing::Message() << "Iteration " << i); 309 SCOPED_TRACE(testing::Message() << "Iteration " << i);
310 310
311 PasswordFormBuilder builder(kTestFormActionURL); 311 PasswordFormBuilder builder(kTestFormActionURL);
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 scoped_ptr<PasswordForm> login_plus_signup_form; 693 scoped_ptr<PasswordForm> login_plus_signup_form;
694 ASSERT_NO_FATAL_FAILURE( 694 ASSERT_NO_FATAL_FAILURE(
695 LoadHTMLAndConvertForm(login_plus_signup_html, &login_plus_signup_form)); 695 LoadHTMLAndConvertForm(login_plus_signup_html, &login_plus_signup_form));
696 ASSERT_TRUE(login_plus_signup_form); 696 ASSERT_TRUE(login_plus_signup_form);
697 EXPECT_EQ(PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP, 697 EXPECT_EQ(PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP,
698 login_plus_signup_form->layout); 698 login_plus_signup_form->layout);
699 } 699 }
700 700
701 } // namespace autofill 701 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698