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

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

Issue 2505533002: Http Bad: Add "Learn more" sublabel to warning message and make it clickable (Closed)
Patch Set: rebase Created 4 years 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 base::WeakPtr<AutofillPopupDelegate> delegate)); 73 base::WeakPtr<AutofillPopupDelegate> delegate));
74 74
75 MOCK_METHOD2(UpdateAutofillPopupDataListValues, 75 MOCK_METHOD2(UpdateAutofillPopupDataListValues,
76 void(const std::vector<base::string16>& values, 76 void(const std::vector<base::string16>& values,
77 const std::vector<base::string16>& lables)); 77 const std::vector<base::string16>& lables));
78 78
79 MOCK_METHOD0(HideAutofillPopup, void()); 79 MOCK_METHOD0(HideAutofillPopup, void());
80 80
81 MOCK_METHOD0(StartSigninFlow, void()); 81 MOCK_METHOD0(StartSigninFlow, void());
82 82
83 MOCK_METHOD0(ShowHttpNotSecureExplanation, void());
84
83 private: 85 private:
84 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient); 86 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient);
85 }; 87 };
86 88
87 class MockAutofillManager : public AutofillManager { 89 class MockAutofillManager : public AutofillManager {
88 public: 90 public:
89 MockAutofillManager(AutofillDriver* driver, MockAutofillClient* client) 91 MockAutofillManager(AutofillDriver* driver, MockAutofillClient* client)
90 // Force to use the constructor designated for unit test, but we don't 92 // Force to use the constructor designated for unit test, but we don't
91 // really need personal_data in this test so we pass a NULL pointer. 93 // really need personal_data in this test so we pass a NULL pointer.
92 : AutofillManager(driver, client, NULL) {} 94 : AutofillManager(driver, client, NULL) {}
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 666
665 // Test that autofill client will start the signin flow after the user accepted 667 // Test that autofill client will start the signin flow after the user accepted
666 // the suggestion to sign in. 668 // the suggestion to sign in.
667 TEST_F(AutofillExternalDelegateUnitTest, SigninPromoMenuItem) { 669 TEST_F(AutofillExternalDelegateUnitTest, SigninPromoMenuItem) {
668 EXPECT_CALL(autofill_client_, StartSigninFlow()); 670 EXPECT_CALL(autofill_client_, StartSigninFlow());
669 EXPECT_CALL(autofill_client_, HideAutofillPopup()); 671 EXPECT_CALL(autofill_client_, HideAutofillPopup());
670 external_delegate_->DidAcceptSuggestion( 672 external_delegate_->DidAcceptSuggestion(
671 base::string16(), POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO, 0); 673 base::string16(), POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO, 0);
672 } 674 }
673 675
676 // Test that autofill client will open the security indicator help center url
677 // after the user accepted the http warning message suggestion item.
678 TEST_F(AutofillExternalDelegateUnitTest, HttpWarningMessageItem) {
679 EXPECT_CALL(autofill_client_, ShowHttpNotSecureExplanation());
680 EXPECT_CALL(autofill_client_, HideAutofillPopup());
681 external_delegate_->DidAcceptSuggestion(
682 base::string16(), POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE, 0);
683 }
684
674 MATCHER_P(CreditCardMatches, card, "") { 685 MATCHER_P(CreditCardMatches, card, "") {
675 return !arg.Compare(card); 686 return !arg.Compare(card);
676 } 687 }
677 688
678 // Test that autofill manager will fill the credit card form after user scans a 689 // Test that autofill manager will fill the credit card form after user scans a
679 // credit card. 690 // credit card.
680 TEST_F(AutofillExternalDelegateUnitTest, FillCreditCardForm) { 691 TEST_F(AutofillExternalDelegateUnitTest, FillCreditCardForm) {
681 CreditCard card; 692 CreditCard card;
682 test::SetCreditCardInfo(&card, "Alice", "4111", "1", "3000"); 693 test::SetCreditCardInfo(&card, "Alice", "4111", "1", "3000");
683 EXPECT_CALL(*autofill_manager_, 694 EXPECT_CALL(*autofill_manager_,
(...skipping 27 matching lines...) Expand all
711 RendererShouldFillFieldWithValue(dummy_string)); 722 RendererShouldFillFieldWithValue(dummy_string));
712 base::HistogramTester histogram_tester; 723 base::HistogramTester histogram_tester;
713 external_delegate_->DidAcceptSuggestion(dummy_string, 724 external_delegate_->DidAcceptSuggestion(dummy_string,
714 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, 725 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY,
715 0); 726 0);
716 histogram_tester.ExpectUniqueSample( 727 histogram_tester.ExpectUniqueSample(
717 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1); 728 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1);
718 } 729 }
719 730
720 } // namespace autofill 731 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.cc ('k') | components/autofill/core/browser/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698