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 "components/autofill/core/browser/form_structure.h" | 5 #include "components/autofill/core/browser/form_structure.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 2345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 | 2356 |
2357 form_structure.reset(new FormStructure(form)); | 2357 form_structure.reset(new FormStructure(form)); |
2358 | 2358 |
2359 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); | 2359 ASSERT_EQ(form_structure->field_count(), possible_field_types.size()); |
2360 for (size_t i = 0; i < form_structure->field_count(); ++i) { | 2360 for (size_t i = 0; i < form_structure->field_count(); ++i) { |
2361 form_structure->field(i)->set_possible_types(possible_field_types[i]); | 2361 form_structure->field(i)->set_possible_types(possible_field_types[i]); |
2362 if (form_structure->field(i)->name == ASCIIToUTF16("password")) { | 2362 if (form_structure->field(i)->name == ASCIIToUTF16("password")) { |
2363 form_structure->field(i)->set_generation_type( | 2363 form_structure->field(i)->set_generation_type( |
2364 AutofillUploadContents::Field:: | 2364 AutofillUploadContents::Field:: |
2365 MANUALLY_TRIGGERED_GENERATION_ON_SIGN_UP_FORM); | 2365 MANUALLY_TRIGGERED_GENERATION_ON_SIGN_UP_FORM); |
| 2366 form_structure->field(i)->set_generated_password_changed(true); |
2366 form_structure->field(i)->set_form_classifier_outcome( | 2367 form_structure->field(i)->set_form_classifier_outcome( |
2367 AutofillUploadContents::Field::GENERATION_ELEMENT); | 2368 AutofillUploadContents::Field::GENERATION_ELEMENT); |
2368 } else { | 2369 } else { |
2369 form_structure->field(i)->set_form_classifier_outcome( | 2370 form_structure->field(i)->set_form_classifier_outcome( |
2370 AutofillUploadContents::Field::NON_GENERATION_ELEMENT); | 2371 AutofillUploadContents::Field::NON_GENERATION_ELEMENT); |
2371 } | 2372 } |
2372 if (form_structure->field(i)->name == ASCIIToUTF16("firstname")) { | 2373 if (form_structure->field(i)->name == ASCIIToUTF16("firstname")) { |
2373 form_structure->field(i)->properties_mask = | 2374 form_structure->field(i)->properties_mask = |
2374 FieldPropertiesFlags::HAD_FOCUS; | 2375 FieldPropertiesFlags::HAD_FOCUS; |
2375 } else { | 2376 } else { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2429 AutofillUploadContents::Field* upload_password_field = upload.add_field(); | 2430 AutofillUploadContents::Field* upload_password_field = upload.add_field(); |
2430 test::FillUploadField(upload_password_field, 2051817934U, "password", | 2431 test::FillUploadField(upload_password_field, 2051817934U, "password", |
2431 "password", "email", 76U); | 2432 "password", "email", 76U); |
2432 upload_password_field->set_form_classifier_outcome( | 2433 upload_password_field->set_form_classifier_outcome( |
2433 AutofillUploadContents::Field::GENERATION_ELEMENT); | 2434 AutofillUploadContents::Field::GENERATION_ELEMENT); |
2434 upload_password_field->set_generation_type( | 2435 upload_password_field->set_generation_type( |
2435 AutofillUploadContents::Field:: | 2436 AutofillUploadContents::Field:: |
2436 MANUALLY_TRIGGERED_GENERATION_ON_SIGN_UP_FORM); | 2437 MANUALLY_TRIGGERED_GENERATION_ON_SIGN_UP_FORM); |
2437 upload_password_field->set_properties_mask(FieldPropertiesFlags::HAD_FOCUS | | 2438 upload_password_field->set_properties_mask(FieldPropertiesFlags::HAD_FOCUS | |
2438 FieldPropertiesFlags::USER_TYPED); | 2439 FieldPropertiesFlags::USER_TYPED); |
| 2440 upload_password_field->set_generated_password_changed(true); |
2439 | 2441 |
2440 std::string expected_upload_string; | 2442 std::string expected_upload_string; |
2441 ASSERT_TRUE(upload.SerializeToString(&expected_upload_string)); | 2443 ASSERT_TRUE(upload.SerializeToString(&expected_upload_string)); |
2442 | 2444 |
2443 AutofillUploadContents encoded_upload; | 2445 AutofillUploadContents encoded_upload; |
2444 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, true, | 2446 EXPECT_TRUE(form_structure->EncodeUploadRequest(available_field_types, true, |
2445 "42", true, &encoded_upload)); | 2447 "42", true, &encoded_upload)); |
2446 | 2448 |
2447 std::string encoded_upload_string; | 2449 std::string encoded_upload_string; |
2448 encoded_upload.SerializeToString(&encoded_upload_string); | 2450 encoded_upload.SerializeToString(&encoded_upload_string); |
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3848 prefix = FormStructure::FindLongestCommonPrefix(strings); | 3850 prefix = FormStructure::FindLongestCommonPrefix(strings); |
3849 EXPECT_EQ(ASCIIToUTF16("1234567890123456"), prefix); | 3851 EXPECT_EQ(ASCIIToUTF16("1234567890123456"), prefix); |
3850 | 3852 |
3851 // Empty vector. | 3853 // Empty vector. |
3852 strings.clear(); | 3854 strings.clear(); |
3853 prefix = FormStructure::FindLongestCommonPrefix(strings); | 3855 prefix = FormStructure::FindLongestCommonPrefix(strings); |
3854 EXPECT_EQ(ASCIIToUTF16(""), prefix); | 3856 EXPECT_EQ(ASCIIToUTF16(""), prefix); |
3855 } | 3857 } |
3856 | 3858 |
3857 } // namespace autofill | 3859 } // namespace autofill |
OLD | NEW |