| Index: components/autofill/core/browser/autofill_assistant_unittest.cc
|
| diff --git a/components/autofill/core/browser/autofill_assistant_unittest.cc b/components/autofill/core/browser/autofill_assistant_unittest.cc
|
| index 4f93f192dfbf5bf3ceb3e2df02bc18b3c30f9a80..7191e68cdf5b1e9e69b6d39d087cae600d7ece37 100644
|
| --- a/components/autofill/core/browser/autofill_assistant_unittest.cc
|
| +++ b/components/autofill/core/browser/autofill_assistant_unittest.cc
|
| @@ -60,6 +60,7 @@ class AutofillAssistantTest : public testing::Test {
|
|
|
| void EnableAutofillCreditCardAssist() {
|
| scoped_feature_list_.InitAndEnableFeature(kAutofillCreditCardAssist);
|
| + autofill_client_.set_is_context_secure(true);
|
| }
|
|
|
| // Returns an initialized FormStructure with credit card form data. To be
|
| @@ -132,6 +133,24 @@ TEST_F(AutofillAssistantTest, CanShowCreditCardAssist_FeatureOn) {
|
| EXPECT_TRUE(autofill_assistant_.CanShowCreditCardAssist(form_structures));
|
| }
|
|
|
| +// Tests that with the feature enabled and proper input,
|
| +// CanShowCreditCardAssist() behaves as expected for secure vs insecure
|
| +// contexts.
|
| +TEST_F(AutofillAssistantTest, CanShowCreditCardAssist_FeatureOn_NotSecure) {
|
| + EnableAutofillCreditCardAssist();
|
| + std::unique_ptr<FormStructure> form_structure = CreateValidCreditCardForm();
|
| + std::vector<FormStructure*> form_structures;
|
| + form_structures.push_back(form_structure.get());
|
| +
|
| + // Cannot be shown if the context is not secure.
|
| + autofill_client_.set_is_context_secure(false);
|
| + EXPECT_FALSE(autofill_assistant_.CanShowCreditCardAssist(form_structures));
|
| +
|
| + // Can be shown if the context is secure.
|
| + autofill_client_.set_is_context_secure(true);
|
| + EXPECT_TRUE(autofill_assistant_.CanShowCreditCardAssist(form_structures));
|
| +}
|
| +
|
| TEST_F(AutofillAssistantTest, ShowAssistForCreditCard_ValidCard) {
|
| EnableAutofillCreditCardAssist();
|
| std::unique_ptr<FormStructure> form_structure = CreateValidCreditCardForm();
|
|
|