| 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 2a4958e4bd583e1341289ee2271222bd444f5abf..72494dc36fc11ad076243047baf488904417727c 100644
|
| --- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
|
| +++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
|
| @@ -95,6 +95,11 @@ class ProfileChooserControllerTest : public CocoaProfileTest {
|
| switches::kFastUserSwitching);
|
| }
|
|
|
| + NSButton* GetButtonFromButtonContainer(NSView* container) {
|
| + return base::mac::ObjCCast<NSButton>(
|
| + [[container subviews] objectAtIndex:0]);
|
| + }
|
| +
|
| ProfileChooserController* controller() { return controller_; }
|
| AvatarMenu* menu() { return menu_; }
|
|
|
| @@ -129,7 +134,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) {
|
|
|
| // There should be an incognito button.
|
| NSButton* incognitoButton =
|
| - base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
|
| + GetButtonFromButtonContainer([buttonSubviews objectAtIndex:0]);
|
| EXPECT_EQ(@selector(goIncognito:), [incognitoButton action]);
|
| EXPECT_EQ(controller(), [incognitoButton target]);
|
|
|
| @@ -138,7 +143,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) {
|
|
|
| // There should be a user switcher button.
|
| NSButton* userSwitcherButton =
|
| - base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:2]);
|
| + GetButtonFromButtonContainer([buttonSubviews objectAtIndex:2]);
|
| EXPECT_EQ(@selector(showUserManager:), [userSwitcherButton action]);
|
| EXPECT_EQ(controller(), [userSwitcherButton target]);
|
|
|
| @@ -207,7 +212,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithFastUserSwitcher) {
|
| // Each profile button has a separator.
|
| EXPECT_TRUE([[subviews objectAtIndex:i] isKindOfClass:[NSBox class]]);
|
|
|
| - NSButton* button = base::mac::ObjCCast<NSButton>(
|
| + NSButton* button = GetButtonFromButtonContainer(
|
| [subviews objectAtIndex:i-1]);
|
| EXPECT_EQ(menu()->GetItemAt(profileIndex).name,
|
| base::SysNSStringToUTF16([button title]));
|
| @@ -276,7 +281,7 @@ TEST_F(ProfileChooserControllerTest, OtherProfilesSortedAlphabetically) {
|
| int sortedNameIndex = 0;
|
| for (int i = 9; i >= 2; i -= 2) {
|
| // The item at index i is the separator.
|
| - NSButton* button = base::mac::ObjCCast<NSButton>(
|
| + NSButton* button = GetButtonFromButtonContainer(
|
| [subviews objectAtIndex:i-1]);
|
| EXPECT_TRUE(
|
| [[button title] isEqualToString:sortedNames[sortedNameIndex++]]);
|
| @@ -398,7 +403,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
|
|
|
| // There should be an incognito button.
|
| NSButton* incognitoButton =
|
| - base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
|
| + GetButtonFromButtonContainer([buttonSubviews objectAtIndex:0]);
|
| EXPECT_EQ(@selector(goIncognito:), [incognitoButton action]);
|
| EXPECT_EQ(controller(), [incognitoButton target]);
|
|
|
| @@ -407,7 +412,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
|
|
|
| // There should be a user switcher button.
|
| NSButton* userSwitcherButton =
|
| - base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:2]);
|
| + GetButtonFromButtonContainer([buttonSubviews objectAtIndex:2]);
|
| EXPECT_EQ(@selector(showUserManager:), [userSwitcherButton action]);
|
| EXPECT_EQ(controller(), [userSwitcherButton target]);
|
|
|
| @@ -428,7 +433,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
|
| NSButton* genericAccount =
|
| base::mac::ObjCCast<NSButton>([accountsListSubviews objectAtIndex:0]);
|
| NSButton* genericAccountDelete = base::mac::ObjCCast<NSButton>(
|
| - [[genericAccount subviews] objectAtIndex:0]);
|
| + [[genericAccount subviews] objectAtIndex:0]);
|
| EXPECT_EQ(@selector(showAccountRemovalView:), [genericAccountDelete action]);
|
| EXPECT_EQ(controller(), [genericAccountDelete target]);
|
| EXPECT_NE(-1, [genericAccountDelete tag]);
|
| @@ -490,7 +495,7 @@ TEST_F(ProfileChooserControllerTest, SignedInProfileLockDisabled) {
|
|
|
| // The last button should not be the lock button.
|
| NSButton* lastButton =
|
| - base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
|
| + GetButtonFromButtonContainer([buttonSubviews objectAtIndex:0]);
|
| ASSERT_TRUE(lastButton);
|
| EXPECT_NE(@selector(lockProfile:), [lastButton action]);
|
| }
|
| @@ -518,7 +523,7 @@ TEST_F(ProfileChooserControllerTest, SignedInProfileLockEnabled) {
|
|
|
| // There should be a lock button.
|
| NSButton* lockButton =
|
| - base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
|
| + GetButtonFromButtonContainer([buttonSubviews objectAtIndex:0]);
|
| ASSERT_TRUE(lockButton);
|
| EXPECT_EQ(@selector(lockProfile:), [lockButton action]);
|
| EXPECT_EQ(controller(), [lockButton target]);
|
|
|