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

Unified Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 2676653004: Show FormNotSecure warnings on sensitive inputs in non-secure contexts (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/autofill_manager_unittest.cc
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc
index 72d6f432b79a7ccfe549f4a9a6d8db4b34df1320..d59d332687f07a1e5a012d5bbe587341581708b9 100644
--- a/components/autofill/core/browser/autofill_manager_unittest.cc
+++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -695,7 +695,7 @@ class TestAutofillExternalDelegate : public AutofillExternalDelegate {
EXPECT_TRUE(on_suggestions_returned_seen_);
EXPECT_EQ(expected_page_id, query_id_);
- ASSERT_EQ(expected_num_suggestions, suggestions_.size());
+ ASSERT_LE(expected_num_suggestions, suggestions_.size());
for (size_t i = 0; i < expected_num_suggestions; ++i) {
SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i));
EXPECT_EQ(expected_suggestions[i].value, suggestions_[i].value);
@@ -704,6 +704,7 @@ class TestAutofillExternalDelegate : public AutofillExternalDelegate {
EXPECT_EQ(expected_suggestions[i].frontend_id,
suggestions_[i].frontend_id);
}
+ ASSERT_EQ(expected_num_suggestions, suggestions_.size());
}
// Wrappers around the above GetSuggestions call that take a hardcoded number
@@ -1630,11 +1631,17 @@ TEST_F(AutofillManagerTest,
l10n_util::GetStringUTF8(IDS_AUTOFILL_WARNING_PAYMENT_DISABLED), "",
"", POPUP_ITEM_ID_INSECURE_CONTEXT_PAYMENT_DISABLED_MESSAGE));
- // Clear the test credit cards and try again -- we shouldn't return a warning.
+ // Clear the test credit cards and try again -- we should still show the
+ // warning.
personal_data_.ClearCreditCards();
GetAutofillSuggestions(form, field);
- // Autocomplete suggestions are queried, but not Autofill.
- EXPECT_FALSE(external_delegate_->on_suggestions_returned_seen());
+ // Test that we sent the right values to the external delegate.
+ external_delegate_->CheckSuggestions(
+ kDefaultPageID,
+ Suggestion(l10n_util::GetStringUTF8(
+ IDS_AUTOFILL_CREDIT_CARD_HTTP_WARNING_MESSAGE),
+ l10n_util::GetStringUTF8(IDS_AUTOFILL_HTTP_WARNING_LEARN_MORE),
+ "httpWarning", POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE));
}
// Test that we don't show the extra "Payment not secure" warning when the page
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698