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

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

Issue 2419853002: [Autofill] Do not offer autofill suggestions on insecure forms (Closed)
Patch Set: Scheme check for HTTPS Created 4 years, 2 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
Index: components/autofill/core/browser/autofill_metrics_unittest.cc
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc
index 73c9ae8fd4a4a7915996259c8ff2bd32752b5dd8..39ae287e789e7366d6652f5df9b7cbac824e0ff9 100644
--- a/components/autofill/core/browser/autofill_metrics_unittest.cc
+++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -1817,8 +1817,6 @@ TEST_F(AutofillMetricsTest, PolledCreditCardSuggestions_DebounceLogs) {
// Set up the form data.
FormData form;
form.name = ASCIIToUTF16("TestForm");
- form.origin = GURL("http://example.com/form.html");
- form.action = GURL("http://example.com/submit.html");
FormFieldData field;
std::vector<ServerFieldType> field_types;
@@ -1890,27 +1888,34 @@ TEST_F(AutofillMetricsTest, QueriedCreditCardFormIsSecure) {
form.fields.push_back(field);
field_types.push_back(CREDIT_CARD_NUMBER);
- // Simulate having seen this form on page load.
- autofill_manager_->AddSeenForm(form, field_types, field_types);
-
{
- // Simulate an Autofill query on a credit card field.
- autofill_client_.set_is_context_secure(true);
+ // Simulate having seen this insecure form on page load.
+ form.origin = GURL("http://example.com/form.html");
+ form.action = GURL("http://example.com/submit.html");
+ autofill_manager_->AddSeenForm(form, field_types, field_types);
+
+ // Simulate an Autofill query on a credit card field (HTTP, non-secure
+ // form).
base::HistogramTester histogram_tester;
autofill_manager_->OnQueryFormFieldAutofill(0, form, form.fields[1],
gfx::RectF());
histogram_tester.ExpectUniqueSample(
- "Autofill.QueriedCreditCardFormIsSecure", true, 1);
+ "Autofill.QueriedCreditCardFormIsSecure", false, 1);
}
{
- // Simulate an Autofill query on a credit card field.
- autofill_client_.set_is_context_secure(false);
+ // Simulate having seen this secure form on page load.
+ autofill_manager_->Reset();
+ form.origin = GURL("https://example.com/form.html");
+ form.action = GURL("https://example.com/submit.html");
+ autofill_manager_->AddSeenForm(form, field_types, field_types);
+
+ // Simulate an Autofill query on a credit card field (HTTPS form).
base::HistogramTester histogram_tester;
autofill_manager_->OnQueryFormFieldAutofill(0, form, form.fields[1],
gfx::RectF());
histogram_tester.ExpectUniqueSample(
- "Autofill.QueriedCreditCardFormIsSecure", false, 1);
+ "Autofill.QueriedCreditCardFormIsSecure", true, 1);
}
}
« no previous file with comments | « components/autofill/core/browser/autofill_manager_unittest.cc ('k') | components/autofill/core/browser/test_autofill_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698