| 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 <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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |