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

Unified Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm

Issue 2034093003: Added flags for previous code change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More unittest fix Created 4 years, 6 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/cocoa/profiles/profile_chooser_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
index de07815fc145e72ae8a148808911e4952a1eb93a..22630a8db093e11f48ea28c9df72b31ce8a5611d 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
@@ -181,11 +181,31 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) {
// There should be one button in the option buttons view.
NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
- ASSERT_EQ(1U, [buttonSubviews count]);
-
- // There should be a user switcher button.
- NSButton* userSwitcherButton =
+ NSButton* userSwitcherButton;
+ if (switches::IsMaterialDesignUserMenu()) {
+ ASSERT_EQ(1U, [buttonSubviews count]);
+ // There should be a user switcher button.
+ userSwitcherButton =
base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
+ } else {
+ // For non-material-design user menu, there should be two buttons and a
+ // separator in the option buttons view.
+ ASSERT_EQ(3U, [buttonSubviews count]);
+
+ // There should be an incognito button.
+ NSButton* incognitoButton =
+ base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
+ EXPECT_EQ(@selector(goIncognito:), [incognitoButton action]);
+ EXPECT_EQ(controller(), [incognitoButton target]);
+
+ // There should be a separator.
+ EXPECT_TRUE([[subviews objectAtIndex:1] isKindOfClass:[NSBox class]]);
+
+ // There should be a user switcher button.
+ userSwitcherButton =
+ base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:2]);
+ }
+
Roger Tawa OOO till Jul 10th 2016/06/06 13:37:12 This won't test both cases, only the default case.
EXPECT_EQ(@selector(showUserManager:), [userSwitcherButton action]);
EXPECT_EQ(controller(), [userSwitcherButton target]);
@@ -422,13 +442,33 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
// and one option buttons view.
ASSERT_EQ(5U, [subviews count]);
- // There should be one button in the option buttons view.
NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
- ASSERT_EQ(1U, [buttonSubviews count]);
+ NSButton* userSwitcherButton;
+ if (switches::IsMaterialDesignUserMenu()) {
+ // There should be one button in the option buttons view.
+ ASSERT_EQ(1U, [buttonSubviews count]);
+ // There should be a user switcher button.
+ userSwitcherButton =
+ base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
+ } else {
+ // For non-material-design user menu, there should be two buttons and one
+ // separator in the option buttons view.
+ ASSERT_EQ(3U, [buttonSubviews count]);
+
+ // There should be an incognito button.
+ NSButton* incognitoButton =
+ base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
+ EXPECT_EQ(@selector(goIncognito:), [incognitoButton action]);
+ EXPECT_EQ(controller(), [incognitoButton target]);
+
+ // There should be a separator.
+ EXPECT_TRUE([[buttonSubviews objectAtIndex:1] isKindOfClass:[NSBox class]]);
+
+ // There should be a user switcher button.
+ userSwitcherButton =
+ base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:2]);
+ }
- // There should be a user switcher button.
- NSButton* userSwitcherButton =
- base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
EXPECT_EQ(@selector(showUserManager:), [userSwitcherButton action]);
EXPECT_EQ(controller(), [userSwitcherButton target]);
@@ -508,9 +548,15 @@ TEST_F(ProfileChooserControllerTest, SignedInProfileLockDisabled) {
ASSERT_EQ(2U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews];
- // There will be one button in the option buttons view.
NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
- ASSERT_EQ(1U, [buttonSubviews count]);
+ if (switches::IsMaterialDesignUserMenu()) {
+ // There will be one button in the option buttons view.
+ ASSERT_EQ(1U, [buttonSubviews count]);
+ } else {
+ // For non-material-design user menu, there will be two buttons and one
+ // separators in the option buttons view.
+ ASSERT_EQ(3U, [buttonSubviews count]);
+ }
// The last button should not be the lock button.
NSButton* lastButton =
@@ -538,9 +584,15 @@ TEST_F(ProfileChooserControllerTest, SignedInProfileLockEnabled) {
ASSERT_EQ(2U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews];
- // There will be two buttons and one separator in the option buttons view.
NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
- ASSERT_EQ(3U, [buttonSubviews count]);
+ if (switches::IsMaterialDesignUserMenu()) {
+ // There will be two buttons and one separator in the option buttons view.
+ ASSERT_EQ(3U, [buttonSubviews count]);
+ } else {
+ // FOr non-material-design user menu, There will be three buttons and two
+ // separators in the option buttons view.
+ ASSERT_EQ(5U, [buttonSubviews count]);
+ }
// There should be a lock button.
NSButton* lockButton =

Powered by Google App Engine
This is Rietveld 408576698