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

Unified Diff: chrome/browser/autofill/autofill_manager_unittest.cc

Issue 2941009: AutoFill: Only send credit card data suggestions on HTTPS sites. (Closed)
Patch Set: Created 10 years, 5 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 | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/autofill/form_structure.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_manager_unittest.cc
diff --git a/chrome/browser/autofill/autofill_manager_unittest.cc b/chrome/browser/autofill/autofill_manager_unittest.cc
index 8aeeb25331c122e99ccfaec1fba59c7a3d187070..2acfc925975b3248bf85d6b73af7d371e7ce3f49 100644
--- a/chrome/browser/autofill/autofill_manager_unittest.cc
+++ b/chrome/browser/autofill/autofill_manager_unittest.cc
@@ -164,8 +164,8 @@ void CreateTestFormData(FormData* form) {
void CreateTestFormDataBilling(FormData* form) {
form->name = ASCIIToUTF16("MyForm");
form->method = ASCIIToUTF16("POST");
- form->origin = GURL("http://myform.com/form.html");
- form->action = GURL("http://myform.com/submit.html");
+ form->origin = GURL("https://myform.com/form.html");
+ form->action = GURL("https://myform.com/submit.html");
webkit_glue::FormField field;
autofill_unittest::CreateTestFormField(
@@ -520,6 +520,27 @@ TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsSemicolon) {
EXPECT_EQ(ASCIIToUTF16("Home; 8765; 8765"), labels[7]);
}
+TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonHTTPS) {
+ FormData form;
+ CreateTestFormDataBilling(&form);
+ form.origin = GURL("http://myform.com/form.html");
+
+ // Set up our FormStructures.
+ std::vector<FormData> forms;
+ forms.push_back(form);
+ autofill_manager_->FormsSeen(forms);
+
+ // The page ID sent to the AutoFillManager from the RenderView, used to send
+ // an IPC message back to the renderer.
+ const int kPageID = 1;
+
+ webkit_glue::FormField field;
+ autofill_unittest::CreateTestFormField(
+ "Card Number", "cardnumber", "", "text", &field);
+ EXPECT_FALSE(
+ autofill_manager_->GetAutoFillSuggestions(kPageID, false, field));
+}
+
TEST_F(AutoFillManagerTest, GetCombinedAutoFillAndAutocompleteSuggestions) {
FormData form;
CreateTestFormData(&form);
@@ -700,8 +721,8 @@ TEST_F(AutoFillManagerTest, FillCreditCardForm) {
EXPECT_TRUE(GetAutoFillFormDataFilledMessage(&page_id, &results));
EXPECT_EQ(ASCIIToUTF16("MyForm"), results.name);
EXPECT_EQ(ASCIIToUTF16("POST"), results.method);
- EXPECT_EQ(GURL("http://myform.com/form.html"), results.origin);
- EXPECT_EQ(GURL("http://myform.com/submit.html"), results.action);
+ EXPECT_EQ(GURL("https://myform.com/form.html"), results.origin);
+ EXPECT_EQ(GURL("https://myform.com/submit.html"), results.action);
ASSERT_EQ(15U, results.fields.size());
webkit_glue::FormField field;
@@ -854,8 +875,8 @@ TEST_F(AutoFillManagerTest, FillBillFormSemicolon) {
EXPECT_TRUE(GetAutoFillFormDataFilledMessage(&page_id, &results));
EXPECT_EQ(ASCIIToUTF16("MyForm"), results.name);
EXPECT_EQ(ASCIIToUTF16("POST"), results.method);
- EXPECT_EQ(GURL("http://myform.com/form.html"), results.origin);
- EXPECT_EQ(GURL("http://myform.com/submit.html"), results.action);
+ EXPECT_EQ(GURL("https://myform.com/form.html"), results.origin);
+ EXPECT_EQ(GURL("https://myform.com/submit.html"), results.action);
ASSERT_EQ(15U, results.fields.size());
webkit_glue::FormField field;
« no previous file with comments | « chrome/browser/autofill/autofill_manager.cc ('k') | chrome/browser/autofill/form_structure.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698