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

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

Issue 1899893002: Card unmasking without form filling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the credit card number field in metrics tests, because ios single-field form fill will not requ… Created 4 years, 8 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 <memory> 5 #include <memory>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 MOCK_METHOD2(ShouldShowScanCreditCard, 91 MOCK_METHOD2(ShouldShowScanCreditCard,
92 bool(const FormData& form, const FormFieldData& field)); 92 bool(const FormData& form, const FormFieldData& field));
93 93
94 MOCK_METHOD5(FillOrPreviewForm, 94 MOCK_METHOD5(FillOrPreviewForm,
95 void(AutofillDriver::RendererFormDataAction action, 95 void(AutofillDriver::RendererFormDataAction action,
96 int query_id, 96 int query_id,
97 const FormData& form, 97 const FormData& form,
98 const FormFieldData& field, 98 const FormFieldData& field,
99 int unique_id)); 99 int unique_id));
100 100
101 MOCK_METHOD4(FillCreditCardForm, 101 MOCK_METHOD5(FillCreditCardForm,
102 void(int query_id, 102 void(int query_id,
103 const FormData& form, 103 const FormData& form,
104 const FormFieldData& field, 104 const FormFieldData& field,
105 const CreditCard& credit_card)); 105 const CreditCard& credit_card,
106 const base::string16& cvc));
106 107
107 private: 108 private:
108 DISALLOW_COPY_AND_ASSIGN(MockAutofillManager); 109 DISALLOW_COPY_AND_ASSIGN(MockAutofillManager);
109 }; 110 };
110 111
111 } // namespace 112 } // namespace
112 113
113 class AutofillExternalDelegateUnitTest : public testing::Test { 114 class AutofillExternalDelegateUnitTest : public testing::Test {
114 protected: 115 protected:
115 void SetUp() override { 116 void SetUp() override {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 567
567 // Test that autofill manager will fill the credit card form after user scans a 568 // Test that autofill manager will fill the credit card form after user scans a
568 // credit card. 569 // credit card.
569 TEST_F(AutofillExternalDelegateUnitTest, FillCreditCardForm) { 570 TEST_F(AutofillExternalDelegateUnitTest, FillCreditCardForm) {
570 base::string16 card_number = base::ASCIIToUTF16("test"); 571 base::string16 card_number = base::ASCIIToUTF16("test");
571 int expiration_month = 1; 572 int expiration_month = 1;
572 int expiration_year = 3000; 573 int expiration_year = 3000;
573 EXPECT_CALL(*autofill_manager_, 574 EXPECT_CALL(*autofill_manager_,
574 FillCreditCardForm( 575 FillCreditCardForm(
575 _, _, _, CreditCardMatches(card_number, expiration_month, 576 _, _, _, CreditCardMatches(card_number, expiration_month,
576 expiration_year))); 577 expiration_year),
578 base::string16()));
577 external_delegate_->OnCreditCardScanned(card_number, expiration_month, 579 external_delegate_->OnCreditCardScanned(card_number, expiration_month,
578 expiration_year); 580 expiration_year);
579 } 581 }
580 582
581 TEST_F(AutofillExternalDelegateUnitTest, IgnoreAutocompleteOffForAutofill) { 583 TEST_F(AutofillExternalDelegateUnitTest, IgnoreAutocompleteOffForAutofill) {
582 const FormData form; 584 const FormData form;
583 FormFieldData field; 585 FormFieldData field;
584 field.is_focusable = true; 586 field.is_focusable = true;
585 field.should_autocomplete = false; 587 field.should_autocomplete = false;
586 const gfx::RectF element_bounds; 588 const gfx::RectF element_bounds;
(...skipping 18 matching lines...) Expand all
605 RendererShouldFillFieldWithValue(dummy_string)); 607 RendererShouldFillFieldWithValue(dummy_string));
606 base::HistogramTester histogram_tester; 608 base::HistogramTester histogram_tester;
607 external_delegate_->DidAcceptSuggestion(dummy_string, 609 external_delegate_->DidAcceptSuggestion(dummy_string,
608 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, 610 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY,
609 0); 611 0);
610 histogram_tester.ExpectUniqueSample( 612 histogram_tester.ExpectUniqueSample(
611 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1); 613 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1);
612 } 614 }
613 615
614 } // namespace autofill 616 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.cc ('k') | components/autofill/core/browser/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698