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

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 1670763006: Autofill server-side heuristics for 2 fields password form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 10 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 4399 matching lines...) Expand 10 before | Expand all | Expand 10 after
4410 EXPECT_TRUE(autofill_manager_->ShouldUploadForm(form_structure_4)); 4410 EXPECT_TRUE(autofill_manager_->ShouldUploadForm(form_structure_4));
4411 4411
4412 // Is off the record. 4412 // Is off the record.
4413 autofill_driver_->SetIsOffTheRecord(true); 4413 autofill_driver_->SetIsOffTheRecord(true);
4414 EXPECT_FALSE(autofill_manager_->ShouldUploadForm(form_structure_4)); 4414 EXPECT_FALSE(autofill_manager_->ShouldUploadForm(form_structure_4));
4415 4415
4416 // Make sure it's reset for the next test case. 4416 // Make sure it's reset for the next test case.
4417 autofill_driver_->SetIsOffTheRecord(false); 4417 autofill_driver_->SetIsOffTheRecord(false);
4418 EXPECT_TRUE(autofill_manager_->ShouldUploadForm(form_structure_4)); 4418 EXPECT_TRUE(autofill_manager_->ShouldUploadForm(form_structure_4));
4419 4419
4420 // Has one field which is a password field.
4421 form.fields.clear();
4422 test::CreateTestFormField("Password", "pw", "", "password", &field);
4423 form.fields.push_back(field);
4424 FormStructure form_structure_5(form);
4425 EXPECT_FALSE(autofill_manager_->ShouldUploadForm(form_structure_5));
4426
4427 // Has two fields which are password fields.
4428 test::CreateTestFormField("New Password", "new_pw", "", "password", &field);
4429 form.fields.push_back(field);
4430 FormStructure form_structure_6(form);
4431 EXPECT_TRUE(autofill_manager_->ShouldUploadForm(form_structure_6));
4432
4420 // Autofill disabled. 4433 // Autofill disabled.
4421 autofill_manager_->set_autofill_enabled(false); 4434 autofill_manager_->set_autofill_enabled(false);
4422 EXPECT_FALSE(autofill_manager_->ShouldUploadForm(form_structure_3)); 4435 EXPECT_FALSE(autofill_manager_->ShouldUploadForm(form_structure_3));
4423 } 4436 }
4424 4437
4425 // Verify that no suggestions are shown on desktop for non credit card related 4438 // Verify that no suggestions are shown on desktop for non credit card related
4426 // fields if the initiating field has the "autocomplete" attribute set to off. 4439 // fields if the initiating field has the "autocomplete" attribute set to off.
4427 TEST_F(AutofillManagerTest, DisplaySuggestions_AutocompleteOff_AddressField) { 4440 TEST_F(AutofillManagerTest, DisplaySuggestions_AutocompleteOff_AddressField) {
4428 // Set up an address form. 4441 // Set up an address form.
4429 FormData mixed_form; 4442 FormData mixed_form;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
4484 FormsSeen(mixed_forms); 4497 FormsSeen(mixed_forms);
4485 4498
4486 // Suggestions should always be displayed. 4499 // Suggestions should always be displayed.
4487 for (const FormFieldData& field : mixed_form.fields) { 4500 for (const FormFieldData& field : mixed_form.fields) {
4488 GetAutofillSuggestions(mixed_form, field); 4501 GetAutofillSuggestions(mixed_form, field);
4489 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen()); 4502 EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen());
4490 } 4503 }
4491 } 4504 }
4492 4505
4493 } // namespace autofill 4506 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/form_structure.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698