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

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

Issue 2874803002: Prevent autofilling credit card security number fields with passwords. (Closed)
Patch Set: Fix build. Created 3 years, 7 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
« no previous file with comments | « components/autofill/content/renderer/password_form_conversion_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 std::string html = builder.ProduceHTML(); 1284 std::string html = builder.ProduceHTML();
1285 1285
1286 std::map<int, PasswordFormFieldPredictionType> predictions_positions; 1286 std::map<int, PasswordFormFieldPredictionType> predictions_positions;
1287 predictions_positions[2] = PREDICTION_NOT_PASSWORD; 1287 predictions_positions[2] = PREDICTION_NOT_PASSWORD;
1288 1288
1289 FormsPredictionsMap predictions; 1289 FormsPredictionsMap predictions;
1290 SetPredictions(html, &predictions, predictions_positions); 1290 SetPredictions(html, &predictions, predictions_positions);
1291 1291
1292 std::unique_ptr<PasswordForm> password_form = 1292 std::unique_ptr<PasswordForm> password_form =
1293 LoadHTMLAndConvertForm(html, &predictions, false); 1293 LoadHTMLAndConvertForm(html, &predictions, false);
1294 EXPECT_TRUE(password_form); 1294 EXPECT_FALSE(password_form);
1295 } 1295 }
1296 1296
1297 TEST_F(MAYBE_PasswordFormConversionUtilsTest, IsGaiaReauthFormIgnored) { 1297 TEST_F(MAYBE_PasswordFormConversionUtilsTest, IsGaiaReauthFormIgnored) {
1298 struct TestCase { 1298 struct TestCase {
1299 const char* origin; 1299 const char* origin;
1300 struct KeyValue { 1300 struct KeyValue {
1301 KeyValue() : name(nullptr), value(nullptr) {} 1301 KeyValue() : name(nullptr), value(nullptr) {}
1302 KeyValue(const char* new_name, const char* new_value) 1302 KeyValue(const char* new_name, const char* new_value)
1303 : name(new_name), value(new_value) {} 1303 : name(new_name), value(new_value) {}
1304 const char* name; 1304 const char* name;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 1570
1571 ASSERT_TRUE(password_form); 1571 ASSERT_TRUE(password_form);
1572 1572
1573 EXPECT_EQ(base::UTF8ToUTF16("username"), password_form->username_element); 1573 EXPECT_EQ(base::UTF8ToUTF16("username"), password_form->username_element);
1574 EXPECT_EQ(base::UTF8ToUTF16("johnsmith"), password_form->username_value); 1574 EXPECT_EQ(base::UTF8ToUTF16("johnsmith"), password_form->username_value);
1575 EXPECT_EQ(base::UTF8ToUTF16("password"), password_form->password_element); 1575 EXPECT_EQ(base::UTF8ToUTF16("password"), password_form->password_element);
1576 EXPECT_EQ(base::UTF8ToUTF16("secret"), password_form->password_value); 1576 EXPECT_EQ(base::UTF8ToUTF16("secret"), password_form->password_value);
1577 } 1577 }
1578 1578
1579 } // namespace autofill 1579 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/password_form_conversion_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698