Commit 6087f972 authored by Monica Dinculescu's avatar Monica Dinculescu

Revert "[Merge] [Mac] Add tab and keyboard navigation to the new avatar bubble"

This reverts commit 9ed04f3e258e8f1ffdef74be2418fd87b1a47dfc.

Reason for revert: did a bad git merge in the original branch merge. :(

BUG=405056
TBR=noms@chromium.org

Review URL: https://codereview.chromium.org/533153003

Cr-Commit-Position: refs/heads/master@{#293169}
parent 0111c3c7
...@@ -85,7 +85,6 @@ const CGFloat kProfileButtonHeight = 30; ...@@ -85,7 +85,6 @@ const CGFloat kProfileButtonHeight = 30;
const int kBezelThickness = 3; // Width of the bezel on an NSButton. const int kBezelThickness = 3; // Width of the bezel on an NSButton.
const int kImageTitleSpacing = 10; const int kImageTitleSpacing = 10;
const int kBlueButtonHeight = 30; const int kBlueButtonHeight = 30;
const CGFloat kFocusRingLineWidth = 2;
// Fixed size for embedded sign in pages as defined in Gaia. // Fixed size for embedded sign in pages as defined in Gaia.
const CGFloat kFixedGaiaViewWidth = 360; const CGFloat kFixedGaiaViewWidth = 360;
...@@ -404,34 +403,22 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -404,34 +403,22 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
return buttonSize; return buttonSize;
} }
- (NSFocusRingType)focusRingType { @end
// This is taken care of by the custom drawing code.
return NSFocusRingTypeNone;
}
- (void)drawWithFrame:(NSRect)frame inView:(NSView *)controlView { // A custom button that has a transparent backround.
[super drawInteriorWithFrame:frame inView:controlView]; @interface TransparentBackgroundButton : NSButton
@end
// Focus ring. @implementation TransparentBackgroundButton
if ([self showsFirstResponder]) { - (id)initWithFrame:(NSRect)frameRect {
NSRect focusRingRect = if ((self = [super initWithFrame:frameRect])) {
NSInsetRect(frame, kFocusRingLineWidth, kFocusRingLineWidth); [self setBordered:NO];
// TODO(noms): When we are targetting 10.7, we should change this to use [self setFont:[NSFont labelFontOfSize:kTextFontSize]];
// -drawFocusRingMaskWithFrame instead. [self setButtonType:NSMomentaryChangeButton];
[[[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:1] set];
NSBezierPath* path = [NSBezierPath bezierPathWithRect:focusRingRect];
[path setLineWidth:kFocusRingLineWidth];
[path stroke];
} }
return self;
} }
@end
// A custom image view that has a transparent backround.
@interface TransparentBackgroundImageView : NSImageView
@end
@implementation TransparentBackgroundImageView
- (void)drawRect:(NSRect)dirtyRect { - (void)drawRect:(NSRect)dirtyRect {
NSColor* backgroundColor = [NSColor colorWithCalibratedWhite:1 alpha:0.6f]; NSColor* backgroundColor = [NSColor colorWithCalibratedWhite:1 alpha:0.6f];
[backgroundColor setFill]; [backgroundColor setFill];
...@@ -440,31 +427,13 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -440,31 +427,13 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
} }
@end @end
@interface CustomCircleImageCell : NSButtonCell
@end
@implementation CustomCircleImageCell
- (void)drawWithFrame:(NSRect)frame inView:(NSView *)controlView {
// Display everything as a circle that spans the entire control.
NSBezierPath* path = [NSBezierPath bezierPathWithOvalInRect:frame];
[path addClip];
[super drawImage:[self image] withFrame:frame inView:controlView];
// Focus ring.
if ([self showsFirstResponder]) {
[[[NSColor keyboardFocusIndicatorColor] colorWithAlphaComponent:1] set];
[path setLineWidth:kFocusRingLineWidth];
[path stroke];
}
}
@end
// A custom image control that shows a "Change" button when moused over. // A custom image control that shows a "Change" button when moused over.
@interface EditableProfilePhoto : HoverImageButton { @interface EditableProfilePhoto : NSImageView {
@private @private
AvatarMenu* avatarMenu_; // Weak; Owned by ProfileChooserController. AvatarMenu* avatarMenu_; // Weak; Owned by ProfileChooserController.
base::scoped_nsobject<TransparentBackgroundImageView> changePhotoImage_; base::scoped_nsobject<TransparentBackgroundButton> changePhotoButton_;
// Used to display the "Change" button on hover.
ui::ScopedCrTrackingArea trackingArea_;
ProfileChooserController* controller_; ProfileChooserController* controller_;
} }
...@@ -477,6 +446,16 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -477,6 +446,16 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
// Called when the "Change" button is clicked. // Called when the "Change" button is clicked.
- (void)editPhoto:(id)sender; - (void)editPhoto:(id)sender;
// When hovering over the profile photo, show the "Change" button.
- (void)mouseEntered:(NSEvent*)event;
// When hovering away from the profile photo, hide the "Change" button.
- (void)mouseExited:(NSEvent*)event;
@end
@interface EditableProfilePhoto (Private)
// Create the "Change" avatar photo button.
- (TransparentBackgroundButton*)changePhotoButtonWithRect:(NSRect)rect;
@end @end
@implementation EditableProfilePhoto @implementation EditableProfilePhoto
...@@ -488,29 +467,24 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -488,29 +467,24 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
if ((self = [super initWithFrame:frameRect])) { if ((self = [super initWithFrame:frameRect])) {
avatarMenu_ = avatarMenu; avatarMenu_ = avatarMenu;
controller_ = controller; controller_ = controller;
[self setImage:CreateProfileImage(
[self setBordered:NO];
base::scoped_nsobject<CustomCircleImageCell> cell(
[[CustomCircleImageCell alloc] init]);
[self setCell:cell.get()];
[self setDefaultImage:CreateProfileImage(
profileIcon, kLargeImageSide).ToNSImage()]; profileIcon, kLargeImageSide).ToNSImage()];
[self setImagePosition:NSImageOnly];
// Add a tracking area so that we can show/hide the button when hovering.
trackingArea_.reset([[CrTrackingArea alloc]
initWithRect:[self bounds]
options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways
owner:self
userInfo:nil]);
[self addTrackingArea:trackingArea_.get()];
NSRect bounds = NSMakeRect(0, 0, kLargeImageSide, kLargeImageSide); NSRect bounds = NSMakeRect(0, 0, kLargeImageSide, kLargeImageSide);
if (editingAllowed) { if (editingAllowed) {
[self setTarget:self]; changePhotoButton_.reset([self changePhotoButtonWithRect:bounds]);
[self setAction:@selector(editPhoto:)]; [self addSubview:changePhotoButton_];
changePhotoImage_.reset([[TransparentBackgroundImageView alloc]
initWithFrame:bounds]); // Hide the button until the image is hovered over.
[changePhotoImage_ setImage:ui::ResourceBundle::GetSharedInstance(). [changePhotoButton_ setHidden:YES];
GetNativeImageNamed(IDR_ICON_PROFILES_EDIT_CAMERA).AsNSImage()];
[self addSubview:changePhotoImage_];
// Hide the image until the button is hovered over.
[changePhotoImage_ setHidden:YES];
} }
// Set the image cell's accessibility strings to be the same as the // Set the image cell's accessibility strings to be the same as the
...@@ -542,15 +516,36 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -542,15 +516,36 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
return self; return self;
} }
- (void)drawRect:(NSRect)dirtyRect {
NSRect bounds = [self bounds];
// Display the profile picture as a circle.
NSBezierPath* path = [NSBezierPath bezierPathWithOvalInRect:bounds];
[path addClip];
[self.image drawAtPoint:bounds.origin
fromRect:bounds
operation:NSCompositeSourceOver
fraction:1.0];
}
- (void)editPhoto:(id)sender { - (void)editPhoto:(id)sender {
avatarMenu_->EditProfile(avatarMenu_->GetActiveProfileIndex()); avatarMenu_->EditProfile(avatarMenu_->GetActiveProfileIndex());
[controller_ [controller_
postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE]; postActionPerformed:ProfileMetrics::PROFILE_DESKTOP_MENU_EDIT_IMAGE];
} }
- (void)setHoverState:(HoverState)state { - (void)mouseEntered:(NSEvent*)event {
[super setHoverState:state]; [changePhotoButton_ setHidden:NO];
[changePhotoImage_ setHidden:([self hoverState] == kHoverStateNone)]; }
- (void)mouseExited:(NSEvent*)event {
[changePhotoButton_ setHidden:YES];
}
// Make sure the element is focusable for accessibility.
- (BOOL)canBecomeKeyView {
return YES;
} }
- (BOOL)accessibilityIsIgnored { - (BOOL)accessibilityIsIgnored {
...@@ -570,6 +565,16 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -570,6 +565,16 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
[super accessibilityPerformAction:action]; [super accessibilityPerformAction:action];
} }
- (TransparentBackgroundButton*)changePhotoButtonWithRect:(NSRect)rect {
TransparentBackgroundButton* button =
[[TransparentBackgroundButton alloc] initWithFrame:rect];
[button setImage:ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(
IDR_ICON_PROFILES_EDIT_CAMERA).AsNSImage()];
[button setImagePosition:NSImageOnly];
[button setTarget:self];
[button setAction:@selector(editPhoto:)];
return button;
}
@end @end
// A custom text control that turns into a textfield for editing when clicked. // A custom text control that turns into a textfield for editing when clicked.
...@@ -761,26 +766,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -761,26 +766,6 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
} }
@end @end
// A custom dummy button that is used to clear focus from the bubble's controls.
@interface DummyWindowFocusButton : NSButton
@end
@implementation DummyWindowFocusButton
// Ignore accessibility, as this is a placeholder button.
- (BOOL)accessibilityIsIgnored {
return YES;
}
- (id)accessibilityAttributeValue:(NSString*)attribute {
return @[];
}
- (BOOL)canBecomeKeyView {
return false;
}
@end
@interface ProfileChooserController () @interface ProfileChooserController ()
// Builds the profile chooser view. // Builds the profile chooser view.
- (NSView*)buildProfileChooserView; - (NSView*)buildProfileChooserView;
...@@ -1135,15 +1120,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -1135,15 +1120,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
if (viewMode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER) if (viewMode_ != profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER)
tutorialMode_ = profiles::TUTORIAL_MODE_NONE; tutorialMode_ = profiles::TUTORIAL_MODE_NONE;
// Add a dummy, empty element so that we don't initially display any
// focus rings.
NSButton* dummyFocusButton =
[[[DummyWindowFocusButton alloc] initWithFrame:NSZeroRect] autorelease];
[dummyFocusButton setNextKeyView:subView];
[[self window] makeFirstResponder:dummyFocusButton];
[contentView addSubview:subView]; [contentView addSubview:subView];
[contentView addSubview:dummyFocusButton];
SetWindowSize([self window], SetWindowSize([self window],
NSMakeSize(NSWidth([subView frame]), NSHeight([subView frame]))); NSMakeSize(NSWidth([subView frame]), NSHeight([subView frame])));
} }
...@@ -1687,8 +1664,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver, ...@@ -1687,8 +1664,7 @@ class ActiveProfileObserverBridge : public AvatarMenuObserver,
- (NSButton*)createOtherProfileView:(int)itemIndex { - (NSButton*)createOtherProfileView:(int)itemIndex {
const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex); const AvatarMenu::Item& item = avatarMenu_->GetItemAt(itemIndex);
NSRect rect = NSMakeRect( NSRect rect = NSMakeRect(0, 0, kFixedMenuWidth, kBlueButtonHeight);
0, 0, kFixedMenuWidth, kBlueButtonHeight + kSmallVerticalSpacing);
base::scoped_nsobject<BackgroundColorHoverButton> profileButton( base::scoped_nsobject<BackgroundColorHoverButton> profileButton(
[[BackgroundColorHoverButton alloc] [[BackgroundColorHoverButton alloc]
initWithFrame:rect initWithFrame:rect
......
...@@ -107,7 +107,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) { ...@@ -107,7 +107,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) {
StartProfileChooserController(); StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews]; NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]); ASSERT_EQ(1U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews]; subviews = [[subviews objectAtIndex:0] subviews];
// Three profiles means we should have one active card, one separator and // Three profiles means we should have one active card, one separator and
...@@ -146,7 +146,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) { ...@@ -146,7 +146,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) {
// Profile icon. // Profile icon.
NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2]; NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2];
EXPECT_TRUE([activeProfileImage isKindOfClass:[NSButton class]]); EXPECT_TRUE([activeProfileImage isKindOfClass:[NSImageView class]]);
// Profile name. // Profile name.
NSView* activeProfileName = [activeCardSubviews objectAtIndex:1]; NSView* activeProfileName = [activeCardSubviews objectAtIndex:1];
...@@ -174,7 +174,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithFastUserSwitcher) { ...@@ -174,7 +174,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithFastUserSwitcher) {
StartProfileChooserController(); StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews]; NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]); ASSERT_EQ(1U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews]; subviews = [[subviews objectAtIndex:0] subviews];
// Three profiles means we should have one active card and a // Three profiles means we should have one active card and a
...@@ -217,7 +217,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithFastUserSwitcher) { ...@@ -217,7 +217,7 @@ TEST_F(ProfileChooserControllerTest, InitialLayoutWithFastUserSwitcher) {
// Profile icon. // Profile icon.
NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2]; NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2];
EXPECT_TRUE([activeProfileImage isKindOfClass:[NSButton class]]); EXPECT_TRUE([activeProfileImage isKindOfClass:[NSImageView class]]);
// Profile name. // Profile name.
NSView* activeProfileName = [activeCardSubviews objectAtIndex:1]; NSView* activeProfileName = [activeCardSubviews objectAtIndex:1];
...@@ -248,7 +248,7 @@ TEST_F(ProfileChooserControllerTest, OtherProfilesSortedAlphabetically) { ...@@ -248,7 +248,7 @@ TEST_F(ProfileChooserControllerTest, OtherProfilesSortedAlphabetically) {
StartProfileChooserController(); StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews]; NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]); ASSERT_EQ(1U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews]; subviews = [[subviews objectAtIndex:0] subviews];
NSString* sortedNames[] = { @"Another Test", NSString* sortedNames[] = { @"Another Test",
@"New Profile", @"New Profile",
...@@ -280,7 +280,7 @@ TEST_F(ProfileChooserControllerTest, ...@@ -280,7 +280,7 @@ TEST_F(ProfileChooserControllerTest,
switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess());
StartProfileChooserController(); StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews]; NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]); ASSERT_EQ(1U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews]; subviews = [[subviews objectAtIndex:0] subviews];
NSArray* activeCardSubviews = [[subviews objectAtIndex:2] subviews]; NSArray* activeCardSubviews = [[subviews objectAtIndex:2] subviews];
NSArray* activeCardLinks = [[activeCardSubviews objectAtIndex:0] subviews]; NSArray* activeCardLinks = [[activeCardSubviews objectAtIndex:0] subviews];
...@@ -309,7 +309,7 @@ TEST_F(ProfileChooserControllerTest, ...@@ -309,7 +309,7 @@ TEST_F(ProfileChooserControllerTest,
StartProfileChooserController(); StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews]; NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]); ASSERT_EQ(1U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews]; subviews = [[subviews objectAtIndex:0] subviews];
NSArray* activeCardSubviews = [[subviews objectAtIndex:2] subviews]; NSArray* activeCardSubviews = [[subviews objectAtIndex:2] subviews];
NSArray* activeCardLinks = [[activeCardSubviews objectAtIndex:0] subviews]; NSArray* activeCardLinks = [[activeCardSubviews objectAtIndex:0] subviews];
...@@ -331,7 +331,7 @@ TEST_F(ProfileChooserControllerTest, ...@@ -331,7 +331,7 @@ TEST_F(ProfileChooserControllerTest,
StartProfileChooserController(); StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews]; NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]); ASSERT_EQ(1U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews]; subviews = [[subviews objectAtIndex:0] subviews];
NSArray* activeCardSubviews = [[subviews objectAtIndex:2] subviews]; NSArray* activeCardSubviews = [[subviews objectAtIndex:2] subviews];
NSArray* activeCardLinks = [[activeCardSubviews objectAtIndex:0] subviews]; NSArray* activeCardLinks = [[activeCardSubviews objectAtIndex:0] subviews];
...@@ -366,7 +366,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) { ...@@ -366,7 +366,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT];
NSArray* subviews = [[[controller() window] contentView] subviews]; NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]); ASSERT_EQ(1U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews]; subviews = [[subviews objectAtIndex:0] subviews];
// There should be one active card, one accounts container, two separators // There should be one active card, one accounts container, two separators
...@@ -443,7 +443,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) { ...@@ -443,7 +443,7 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
// Profile icon. // Profile icon.
NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2]; NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2];
EXPECT_TRUE([activeProfileImage isKindOfClass:[NSButton class]]); EXPECT_TRUE([activeProfileImage isKindOfClass:[NSImageView class]]);
// Profile name. // Profile name.
NSView* activeProfileName = [activeCardSubviews objectAtIndex:1]; NSView* activeProfileName = [activeCardSubviews objectAtIndex:1];
...@@ -459,69 +459,3 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) { ...@@ -459,69 +459,3 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
EXPECT_EQ(@selector(hideAccountManagement:), [link action]); EXPECT_EQ(@selector(hideAccountManagement:), [link action]);
EXPECT_EQ(controller(), [link target]); EXPECT_EQ(controller(), [link target]);
} }
TEST_F(ProfileChooserControllerTest, SignedInProfileLockDisabled) {
switches::EnableNewProfileManagementForTesting(
CommandLine::ForCurrentProcess());
// Sign in the first profile.
ProfileInfoCache* cache = testing_profile_manager()->profile_info_cache();
cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail));
cache->SetLocalAuthCredentialsOfProfileAtIndex(0, std::string());
StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews];
// Three profiles means we should have one active card, one separator, one
// option buttons view and a lock view. We also have an update promo for the
// new avatar menu.
// TODO(noms): Enforcing 5U fails on the waterfall debug bots, but it's not
// reproducible anywhere else.
ASSERT_GE([subviews count], 4U);
// There will be three buttons and two separators in the option buttons view.
NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
ASSERT_EQ(5U, [buttonSubviews count]);
// There should be a lock button.
NSButton* lockButton =
base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
ASSERT_TRUE(lockButton);
EXPECT_EQ(@selector(lockProfile:), [lockButton action]);
EXPECT_EQ(controller(), [lockButton target]);
EXPECT_FALSE([lockButton isEnabled]);
}
TEST_F(ProfileChooserControllerTest, SignedInProfileLockEnabled) {
switches::EnableNewProfileManagementForTesting(
CommandLine::ForCurrentProcess());
// Sign in the first profile.
ProfileInfoCache* cache = testing_profile_manager()->profile_info_cache();
cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail));
cache->SetLocalAuthCredentialsOfProfileAtIndex(0, "YourHashHere");
StartProfileChooserController();
NSArray* subviews = [[[controller() window] contentView] subviews];
ASSERT_EQ(2U, [subviews count]);
subviews = [[subviews objectAtIndex:0] subviews];
// Three profiles means we should have one active card, one separator, one
// option buttons view and a lock view. We also have an update promo for the
// new avatar menu.
// TODO(noms): Enforcing 5U fails on the waterfall debug bots, but it's not
// reproducible anywhere else.
ASSERT_GE([subviews count], 4U);
// There will be three buttons and two separators in the option buttons view.
NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
ASSERT_EQ(5U, [buttonSubviews count]);
// There should be a lock button.
NSButton* lockButton =
base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
ASSERT_TRUE(lockButton);
EXPECT_EQ(@selector(lockProfile:), [lockButton action]);
EXPECT_EQ(controller(), [lockButton target]);
EXPECT_TRUE([lockButton isEnabled]);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment