summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 14:37:32 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-23 14:37:32 +0000
commit8cd1bc519a047465b0fb6018a75f1f9458c77af1 (patch)
tree97d4e781e4d91f4e0efe11fa470e1d817f1c37cd
parent7f7a70fa4b41f770bd40bd82d9f7e2c207125153 (diff)
downloadchromium_src-8cd1bc519a047465b0fb6018a75f1f9458c77af1.zip
chromium_src-8cd1bc519a047465b0fb6018a75f1f9458c77af1.tar.gz
chromium_src-8cd1bc519a047465b0fb6018a75f1f9458c77af1.tar.bz2
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
-rw-r--r--chrome/browser/cocoa/bookmark_bar_controller_unittest.mm5
-rw-r--r--chrome/browser/cocoa/cocoa_test_helper.h4
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.