From 8cd1bc519a047465b0fb6018a75f1f9458c77af1 Mon Sep 17 00:00:00 2001 From: "pinkerton@chromium.org" Date: Thu, 23 Apr 2009 14:37:32 +0000 Subject: Allow appkit-driven animations in unit tests to work correctly. Review URL: http://codereview.chromium.org/95003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14301 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/bookmark_bar_controller_unittest.mm | 5 +---- chrome/browser/cocoa/cocoa_test_helper.h | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm index 421867b..892a96f 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller_unittest.mm @@ -39,14 +39,11 @@ TEST_F(BookmarkBarControllerTest, ShowHide) { EXPECT_TRUE([[bar_ view] isHidden]); // Show and hide it by toggling. - // TODO(pinkerton): When visible, ensure the content area has been resized. - // When hidden again, ensure the content area is back to what it at the start. - // However, this can't currently be unit-tested due to CoreAnimation. [bar_ toggleBookmarkBar]; EXPECT_TRUE([bar_ isBookmarkBarVisible]); EXPECT_FALSE([[bar_ view] isHidden]); NSRect content_frame = [content_area_ frame]; - // EXPECT_NE(content_frame.size.height, kContentAreaHeight); + EXPECT_NE(content_frame.size.height, kContentAreaHeight); [bar_ toggleBookmarkBar]; EXPECT_FALSE([bar_ isBookmarkBarVisible]); EXPECT_TRUE([[bar_ view] isHidden]); diff --git a/chrome/browser/cocoa/cocoa_test_helper.h b/chrome/browser/cocoa/cocoa_test_helper.h index aca0df7..606a577 100644 --- a/chrome/browser/cocoa/cocoa_test_helper.h +++ b/chrome/browser/cocoa/cocoa_test_helper.h @@ -48,6 +48,10 @@ class CocoaTestHelper { backing:NSBackingStoreBuffered defer:NO]); [window_ orderFront:nil]; + + // Set the duration of AppKit-evaluated animations (such as frame changes) + // to zero for testing purposes. That way they take effect immediately. + [[NSAnimationContext currentContext] setDuration:0.0]; } // Access the Cocoa window created for the test. -- cgit v1.1