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

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

Issue 4591001: Display a warning when autofill is disabled for a website. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile on ChromeOS... Created 10 years, 1 month 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/form_structure.cc ('k') | chrome/browser/chromeos/login/account_creation_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/form_structure_unittest.cc
diff --git a/chrome/browser/autofill/form_structure_unittest.cc b/chrome/browser/autofill/form_structure_unittest.cc
index b5881d693fb3191a30058d2c2d52a30250c19ef5..8eb03fd20036602fdbc167e9b2692280ec347e6d 100644
--- a/chrome/browser/autofill/form_structure_unittest.cc
+++ b/chrome/browser/autofill/form_structure_unittest.cc
@@ -199,7 +199,7 @@ TEST(FormStructureTest, IsAutoFillable) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_FALSE(form_structure->IsAutoFillable());
+ EXPECT_FALSE(form_structure->IsAutoFillable(true));
// We now have three text fields, but only two auto-fillable fields.
form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("First Name"),
@@ -213,7 +213,7 @@ TEST(FormStructureTest, IsAutoFillable) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_FALSE(form_structure->IsAutoFillable());
+ EXPECT_FALSE(form_structure->IsAutoFillable(true));
// We now have three auto-fillable fields.
form.fields.push_back(webkit_glue::FormField(ASCIIToUTF16("Email"),
@@ -222,23 +222,25 @@ TEST(FormStructureTest, IsAutoFillable) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
- // The method must be 'post'.
+ // The method must be 'post', though we can intentionally ignore this
+ // criterion for the sake of providing a helpful warning message to the user.
form.method = ASCIIToUTF16("get");
form_structure.reset(new FormStructure(form));
- EXPECT_FALSE(form_structure->IsAutoFillable());
+ EXPECT_FALSE(form_structure->IsAutoFillable(true));
+ EXPECT_TRUE(form_structure->IsAutoFillable(false));
// The target cannot include http(s)://*/search...
form.method = ASCIIToUTF16("post");
form.action = GURL("http://google.com/search?q=hello");
form_structure.reset(new FormStructure(form));
- EXPECT_FALSE(form_structure->IsAutoFillable());
+ EXPECT_FALSE(form_structure->IsAutoFillable(true));
// But search can be in the URL.
form.action = GURL("http://search.com/?q=hello");
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
}
TEST(FormStructureTest, HeuristicsContactInfo) {
@@ -292,7 +294,7 @@ TEST(FormStructureTest, HeuristicsContactInfo) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
// Expect the correct number of fields.
ASSERT_EQ(9U, form_structure->field_count());
@@ -410,7 +412,7 @@ TEST(FormStructureTest, HeuristicsHiddenFields) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
// Expect the correct number of fields.
ASSERT_EQ(17U, form_structure->field_count());
@@ -503,7 +505,7 @@ TEST(FormStructureTest, HeuristicsSample8) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(10U, form_structure->field_count());
ASSERT_EQ(9U, form_structure->autofill_count());
@@ -581,7 +583,7 @@ TEST(FormStructureTest, HeuristicsSample6) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(7U, form_structure->field_count());
ASSERT_EQ(6U, form_structure->autofill_count());
@@ -655,7 +657,7 @@ TEST(FormStructureTest, HeuristicsLabelsOnly) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(9U, form_structure->field_count());
ASSERT_EQ(8U, form_structure->autofill_count());
@@ -716,7 +718,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfo) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(6U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -778,7 +780,7 @@ TEST(FormStructureTest, HeuristicsCreditCardInfoWithUnknownCardField) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(7U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -829,7 +831,7 @@ TEST(FormStructureTest, ThreeAddressLines) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -875,7 +877,7 @@ TEST(FormStructureTest, BillingAndShippingAddresses) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(4U, form_structure->autofill_count());
@@ -925,7 +927,7 @@ TEST(FormStructureTest, ThreeAddressLinesExpedia) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -966,7 +968,7 @@ TEST(FormStructureTest, TwoAddressLinesEbay) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(3U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1002,7 +1004,7 @@ TEST(FormStructureTest, HeuristicsStateWithProvince) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(3U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1087,7 +1089,7 @@ TEST(FormStructureTest, HeuristicsWithBilling) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(11U, form_structure->field_count());
ASSERT_EQ(11U, form_structure->autofill_count());
@@ -1136,7 +1138,7 @@ TEST(FormStructureTest, ThreePartPhoneNumber) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
ASSERT_EQ(4U, form_structure->field_count());
ASSERT_EQ(3U, form_structure->autofill_count());
@@ -1207,7 +1209,7 @@ TEST(FormStructureTest, MatchSpecificInputTypes) {
ASCIIToUTF16("submit"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
// Expect the correct number of fields.
ASSERT_EQ(10U, form_structure->field_count());
@@ -1266,7 +1268,7 @@ TEST(FormStructureTest, HeuristicsInfernoCC) {
ASCIIToUTF16("text"),
0));
form_structure.reset(new FormStructure(form));
- EXPECT_TRUE(form_structure->IsAutoFillable());
+ EXPECT_TRUE(form_structure->IsAutoFillable(true));
// Expect the correct number of fields.
ASSERT_EQ(5U, form_structure->field_count());
« no previous file with comments | « chrome/browser/autofill/form_structure.cc ('k') | chrome/browser/chromeos/login/account_creation_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698