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

Unified Diff: chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration_unittest.mm

Issue 1959473002: [Mac][Material Design] Fix ManagePasswordsDecoration unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/ui/cocoa/location_bar/manage_passwords_decoration.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration_unittest.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration_unittest.mm b/chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration_unittest.mm
index a1201415ad702475edea59c15fccf0970ad00665..543bae849a4f3f2e646230c9a6a2396ba868b06b 100644
--- a/chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration_unittest.mm
+++ b/chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration_unittest.mm
@@ -17,7 +17,12 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gtest_mac.h"
#include "ui/base/l10n/l10n_util_mac.h"
+#include "ui/base/material_design/material_design_controller.h"
+#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia_util_mac.h"
+#include "ui/gfx/paint_vector_icon.h"
+#include "ui/gfx/vector_icons_public.h"
namespace {
@@ -96,10 +101,24 @@ TEST_P(ManagePasswordsDecorationStateTest, TestState) {
decoration()->icon()->SetState(GetParam().state);
decoration()->icon()->SetActive(GetParam().active);
EXPECT_EQ(GetParam().visible, decoration()->IsVisible());
- EXPECT_TRUE(ImagesEqual(
- GetParam().image ? OmniboxViewMac::ImageForResource(GetParam().image)
- : nil,
- decoration()->GetImage()));
+ NSImage* expected_image = nil;
+ if (GetParam().image) {
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ // IDR_SAVE_PASSWORD_ACTIVE and IDR_SAVE_PASSWORD_INACTIVE map to
+ // gfx::VectorIconId::AUTOLOGIN in Material Design - fail the test if
+ // somehow some other value is present.
+ EXPECT_TRUE(GetParam().image == IDR_SAVE_PASSWORD_ACTIVE ||
+ GetParam().image == IDR_SAVE_PASSWORD_INACTIVE);
+ const int kIconSize = 16;
+ expected_image = NSImageFromImageSkia(
+ gfx::CreateVectorIcon(gfx::VectorIconId::AUTOLOGIN,
+ kIconSize,
+ gfx::kChromeIconGrey));
+ } else {
+ expected_image = OmniboxViewMac::ImageForResource(GetParam().image);
+ }
+ }
+ EXPECT_TRUE(ImagesEqual(expected_image, decoration()->GetImage()));
EXPECT_NSEQ(GetParam().toolTip
? l10n_util::GetNSStringWithFixup(GetParam().toolTip)
: nil,
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698