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

Unified Diff: chrome/browser/ui/autofill/data_model_wrapper_unittest.cc

Issue 15892013: Make suggestions invalid when no phone number is attached to an address. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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
Index: chrome/browser/ui/autofill/data_model_wrapper_unittest.cc
diff --git a/chrome/browser/ui/autofill/data_model_wrapper_unittest.cc b/chrome/browser/ui/autofill/data_model_wrapper_unittest.cc
index 9cf46d11318eeaae178c52d322006b382a5be46a..70a03c2c099397b23dcd5fff35cca86ca55208c3 100644
--- a/chrome/browser/ui/autofill/data_model_wrapper_unittest.cc
+++ b/chrome/browser/ui/autofill/data_model_wrapper_unittest.cc
@@ -6,6 +6,8 @@
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/ui/autofill/autofill_dialog_models.h"
#include "chrome/browser/ui/autofill/data_model_wrapper.h"
+#include "components/autofill/browser/autofill_common_test.h"
+#include "components/autofill/browser/autofill_profile.h"
#include "components/autofill/browser/credit_card.h"
#include "components/autofill/browser/field_types.h"
#include "components/autofill/browser/wallet/wallet_items.h"
@@ -49,4 +51,24 @@ TEST(WalletInstrumentWrapperTest, GetDisplayTextEmptyWhenExpired) {
EXPECT_TRUE(wrapper.GetDisplayText().empty());
}
+TEST(DataModelWrapperTest, GetDisplayTextEmptyWithoutPhone) {
+ scoped_ptr<wallet::WalletItems::MaskedInstrument> instrument(
+ wallet::GetTestMaskedInstrument());
+
+ WalletInstrumentWrapper instrument_wrapper(instrument.get());
+ ASSERT_FALSE(instrument_wrapper.GetDisplayText().empty());
+
+ WalletAddressWrapper address_wrapper(&instrument->address());
+ ASSERT_FALSE(address_wrapper.GetDisplayText().empty());
+
+ const_cast<wallet::Address*>(&instrument->address())->set_phone_number(
+ string16());
+
+ ASSERT_TRUE(instrument_wrapper.GetInfo(PHONE_HOME_WHOLE_NUMBER).empty());
+ EXPECT_TRUE(instrument_wrapper.GetDisplayText().empty());
+
+ ASSERT_TRUE(address_wrapper.GetInfo(PHONE_HOME_WHOLE_NUMBER).empty());
+ EXPECT_TRUE(address_wrapper.GetDisplayText().empty());
+}
+
} // autofill
« no previous file with comments | « chrome/browser/ui/autofill/data_model_wrapper.cc ('k') | components/autofill/browser/wallet/wallet_address.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698