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

Unified Diff: components/autofill/content/browser/content_autofill_driver_unittest.cc

Issue 2422363002: Trigger HTTP-bad warning when querying credit card autofill (Closed)
Patch Set: add missing blank line 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/content/browser/content_autofill_driver_unittest.cc
diff --git a/components/autofill/content/browser/content_autofill_driver_unittest.cc b/components/autofill/content/browser/content_autofill_driver_unittest.cc
index 5feba33619fb3c13f8b24223469341a3b858748e..82dd2f6254a902f05767ce706bf9f83f43a0f7a7 100644
--- a/components/autofill/content/browser/content_autofill_driver_unittest.cc
+++ b/components/autofill/content/browser/content_autofill_driver_unittest.cc
@@ -22,6 +22,8 @@
#include "components/autofill/core/common/form_data_predictions.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/ssl_status.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/frame_navigate_params.h"
@@ -447,4 +449,34 @@ TEST_F(ContentAutofillDriverTest, PreviewFieldWithValue) {
EXPECT_EQ(input_value, output_value);
}
+// Tests that credit card form interactions are recorded on the current
+// NavigationEntry's SSLStatus if the page is HTTP.
+TEST_F(ContentAutofillDriverTest, CreditCardFormInteraction) {
+ GURL url("http://example.test");
+ NavigateAndCommit(url);
+ driver_->DidInteractWithCreditCardForm();
+
+ content::NavigationEntry* entry =
+ web_contents()->GetController().GetVisibleEntry();
+ ASSERT_TRUE(entry);
+ EXPECT_EQ(url, entry->GetURL());
+ EXPECT_TRUE(!!(entry->GetSSL().content_status &
+ content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP));
+}
+
+// Tests that credit card form interactions are *not* recorded on the current
+// NavigationEntry's SSLStatus if the page is *not* HTTP.
+TEST_F(ContentAutofillDriverTest, CreditCardFormInteractionOnHTTPS) {
+ GURL url("https://example.test");
+ NavigateAndCommit(url);
+ driver_->DidInteractWithCreditCardForm();
+
+ content::NavigationEntry* entry =
+ web_contents()->GetController().GetVisibleEntry();
+ ASSERT_TRUE(entry);
+ EXPECT_EQ(url, entry->GetURL());
+ EXPECT_FALSE(!!(entry->GetSSL().content_status &
+ content::SSLStatus::DISPLAYED_CREDIT_CARD_FIELD_ON_HTTP));
+}
+
} // namespace autofill
« no previous file with comments | « components/autofill/content/browser/content_autofill_driver.cc ('k') | components/autofill/core/browser/autofill_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698