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

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

Issue 113533003: [rAc] Add a test to verify that enough space is reserved for the credit card icon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
index 3e4ca731cd12d68d4d263470d68eee786810f994..05066612712f55dcf0179b1ad541e5d393efbfc5 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_unittest.cc
@@ -45,8 +45,10 @@
#include "content/public/browser/web_contents.h"
#include "content/public/test/mock_render_process_host.h"
#include "google_apis/gaia/google_service_auth_error.h"
+#include "grit/webkit_resources.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/resource/resource_bundle.h"
#if defined(OS_WIN)
#include "ui/base/win/scoped_ole_initializer.h"
@@ -2718,4 +2720,37 @@ TEST_F(AutofillDialogControllerTest, WalletShippingSameAsBilling) {
::prefs::kAutofillDialogWalletShippingSameAsBilling));
}
+// Verifies that a call to the IconsForFields() method before the card type is
+// known returns a placeholder image that is at least as large as the icons for
+// all of the supported major credit card issuers.
+TEST_F(AutofillDialogControllerTest, IconReservedForCreditCardField) {
+ FieldValueMap inputs;
+ inputs[CREDIT_CARD_NUMBER] = base::string16();
+
+ FieldIconMap icons = controller()->IconsForFields(inputs);
+ EXPECT_EQ(1U, icons.size());
+
+ ASSERT_EQ(1U, icons.count(CREDIT_CARD_NUMBER));
+ gfx::Image placeholder_icon = icons[CREDIT_CARD_NUMBER];
+
+ // Verify that the placeholder icon is at least as large as the icons for the
+ // supported credit card issuers.
+ const int kSupportedCardIdrs[] = {
+ IDR_AUTOFILL_CC_AMEX,
+ IDR_AUTOFILL_CC_DINERS,
+ IDR_AUTOFILL_CC_DISCOVER,
+ IDR_AUTOFILL_CC_GENERIC,
+ IDR_AUTOFILL_CC_JCB,
+ IDR_AUTOFILL_CC_MASTERCARD,
+ IDR_AUTOFILL_CC_VISA,
+ };
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ for (size_t i = 0; i < arraysize(kSupportedCardIdrs); ++i) {
+ SCOPED_TRACE(base::IntToString(i));
+ gfx::Image supported_card_icon = rb.GetImageNamed(kSupportedCardIdrs[i]);
+ EXPECT_GE(placeholder_icon.Width(), supported_card_icon.Width());
+ EXPECT_GE(placeholder_icon.Height(), supported_card_icon.Height());
+ }
+}
+
} // namespace autofill
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698