Skip to content

Commit

Permalink
This is causing TestCSP to fail on chromium.mac
Browse files Browse the repository at this point in the history
Revert 207470 "[Mac] Fix the problem that a popup could be close..."

> [Mac] Fix the problem that a popup could be closed while it is still in animation.
> 
> This occurs when the test code creates a popup and close the collection immediately. The fix is to close the popup without animation for this case.
> 
> All the popup animations are coordinated by the popup collection. Added DCHECKs in the popup controller to guard the places that might trigger the 2nd animation while the previous animation has not ended.
> 
> BUG=249131
> TEST=reenable the disabled test
> R=dewittj@chromium.org, rsesek@chromium.org
> 
> Review URL: https://codereview.chromium.org/17468007

TBR=jianli@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207503 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rmsousa@chromium.org committed Jun 20, 2013
1 parent 5e193aa commit 59577f1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
9 changes: 1 addition & 8 deletions ui/message_center/cocoa/popup_collection.mm
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,7 @@ - (void)removeNotification:(const std::string&)notificationID {
}

- (void)removeAllNotifications {
// In rare cases, the popup collection would be gone while an animation is
// still playing. For exmaple, the test code could show a new notification
// and dispose the collection immediately. Close the popup without animation
// when this is the case.
if ([self isAnimating])
[popups_ makeObjectsPerformSelector:@selector(close)];
else
[popups_ makeObjectsPerformSelector:@selector(closeWithAnimation)];
[popups_ makeObjectsPerformSelector:@selector(closeWithAnimation)];
[popups_ makeObjectsPerformSelector:@selector(markPopupCollectionGone)];
[popups_ removeAllObjects];
}
Expand Down
4 changes: 3 additions & 1 deletion ui/message_center/cocoa/popup_collection_unittest.mm
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ void WaitForAnimationEnded() {
EXPECT_EQ("3", [[popups objectAtIndex:2] notificationID]);
}

TEST_F(PopupCollectionTest, CloseCollectionBeforeNewPopupAnimationEnds) {
// Test sometimes timesout. See http://crbug.com/249131
TEST_F(PopupCollectionTest,
DISABLED_CloseCollectionBeforeNewPopupAnimationEnds) {
// Add a notification and don't wait for the animation to finish.
scoped_ptr<message_center::Notification> notification;
notification.reset(new message_center::Notification(
Expand Down
3 changes: 0 additions & 3 deletions ui/message_center/cocoa/popup_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ - (void)showWithAnimation:(NSRect)newBounds {
NSViewAnimationEndFrameKey : [NSValue valueWithRect:newBounds],
NSViewAnimationEffectKey : NSViewAnimationFadeInEffect
};
DCHECK(!boundsAnimation_);
boundsAnimation_.reset([[NSViewAnimation alloc]
initWithViewAnimations:[NSArray arrayWithObject:animationDict]]);
[boundsAnimation_ setDuration:[popupCollection_ popupAnimationDuration]];
Expand All @@ -238,7 +237,6 @@ - (void)closeWithAnimation {
NSViewAnimationTargetKey : [self window],
NSViewAnimationEffectKey : NSViewAnimationFadeOutEffect
};
DCHECK(!boundsAnimation_);
boundsAnimation_.reset([[NSViewAnimation alloc]
initWithViewAnimations:[NSArray arrayWithObject:animationDict]]);
[boundsAnimation_ setDuration:[popupCollection_ popupAnimationDuration]];
Expand All @@ -263,7 +261,6 @@ - (void)setBounds:(NSRect)newBounds {
NSViewAnimationTargetKey : [self window],
NSViewAnimationEndFrameKey : [NSValue valueWithRect:newBounds]
};
DCHECK(!boundsAnimation_);
boundsAnimation_.reset([[NSViewAnimation alloc]
initWithViewAnimations:[NSArray arrayWithObject:animationDict]]);
[boundsAnimation_ setDuration:[popupCollection_ popupAnimationDuration]];
Expand Down

0 comments on commit 59577f1

Please sign in to comment.