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

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

Issue 2078016: AutoFill fill billing address when credit card settings specify a billing address. (Closed)
Patch Set: Addressing review comments. Created 10 years, 7 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/address_field.cc ('k') | chrome/browser/autofill/autofill_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/address_field_unittest.cc
diff --git a/chrome/browser/autofill/address_field_unittest.cc b/chrome/browser/autofill/address_field_unittest.cc
index dbf282e7faccbdbdc215573094fa89b1e8b6955e..6af8c339519590dcce0a09c116443594e7713e6d 100644
--- a/chrome/browser/autofill/address_field_unittest.cc
+++ b/chrome/browser/autofill/address_field_unittest.cc
@@ -51,6 +51,46 @@ TEST_F(AddressFieldTest, ParseOneLineAddress) {
iter_ = list_.begin();
field_.reset(AddressField::Parse(&iter_, false));
ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
+ EXPECT_EQ(kGenericAddress, field_->FindType());
+ EXPECT_TRUE(field_->IsFullAddress());
+ ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
+ ASSERT_TRUE(
+ field_type_map_.find(ASCIIToUTF16("addr1")) != field_type_map_.end());
+ EXPECT_EQ(ADDRESS_HOME_LINE1, field_type_map_[ASCIIToUTF16("addr1")]);
+}
+
+TEST_F(AddressFieldTest, ParseOneLineAddressBilling) {
+ list_.push_back(
+ new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address"),
+ ASCIIToUTF16("billingAddress"),
+ string16(),
+ ASCIIToUTF16("text"),
+ 0),
+ ASCIIToUTF16("addr1")));
+ list_.push_back(NULL);
+ iter_ = list_.begin();
+ field_.reset(AddressField::Parse(&iter_, false));
+ ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
+ EXPECT_EQ(kBillingAddress, field_->FindType());
+ EXPECT_TRUE(field_->IsFullAddress());
+ ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
+ ASSERT_TRUE(
+ field_type_map_.find(ASCIIToUTF16("addr1")) != field_type_map_.end());
+ EXPECT_EQ(ADDRESS_HOME_LINE1, field_type_map_[ASCIIToUTF16("addr1")]);
+}
+
+TEST_F(AddressFieldTest, ParseOneLineAddressShipping) {
+ list_.push_back(
+ new AutoFillField(webkit_glue::FormField(ASCIIToUTF16("Address"),
+ ASCIIToUTF16("shippingAddress"),
+ string16(),
+ ASCIIToUTF16("text"),
+ 0),
+ ASCIIToUTF16("addr1")));
+ list_.push_back(NULL);
+ iter_ = list_.begin();
+ field_.reset(AddressField::Parse(&iter_, false));
+ ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
EXPECT_EQ(kShippingAddress, field_->FindType());
EXPECT_TRUE(field_->IsFullAddress());
ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
@@ -98,7 +138,7 @@ TEST_F(AddressFieldTest, ParseTwoLineAddress) {
iter_ = list_.begin();
field_.reset(AddressField::Parse(&iter_, false));
ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
- EXPECT_EQ(kShippingAddress, field_->FindType());
+ EXPECT_EQ(kGenericAddress, field_->FindType());
EXPECT_TRUE(field_->IsFullAddress());
ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
ASSERT_TRUE(
@@ -135,7 +175,7 @@ TEST_F(AddressFieldTest, ParseThreeLineAddress) {
iter_ = list_.begin();
field_.reset(AddressField::Parse(&iter_, false));
ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
- EXPECT_EQ(kShippingAddress, field_->FindType());
+ EXPECT_EQ(kGenericAddress, field_->FindType());
EXPECT_TRUE(field_->IsFullAddress());
ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
ASSERT_TRUE(
@@ -357,7 +397,7 @@ TEST_F(AddressFieldTest, ParseTwoLineAddressMissingLabel) {
iter_ = list_.begin();
field_.reset(AddressField::Parse(&iter_, false));
ASSERT_NE(static_cast<AddressField*>(NULL), field_.get());
- EXPECT_EQ(kShippingAddress, field_->FindType());
+ EXPECT_EQ(kGenericAddress, field_->FindType());
EXPECT_TRUE(field_->IsFullAddress());
ASSERT_TRUE(field_->GetFieldInfo(&field_type_map_));
ASSERT_TRUE(
« no previous file with comments | « chrome/browser/autofill/address_field.cc ('k') | chrome/browser/autofill/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698