From 2a291911f39e27fccba073356cb4ca6a1942174e Mon Sep 17 00:00:00 2001 From: "jamescook@chromium.org" Date: Tue, 29 Jul 2014 04:22:05 +0000 Subject: Introduce NON_ZERO_DURATION for animation unit tests Animations are usually disabled in unit tests for performance. However, to test the animation system itself some tests request "normal" durations. Under some conditions (remote desktop, animation disabled for accessibility) the "normal" duration could still be zero. This was causing test failures and use-after-frees in ash_unittests on the drmemory bots and for developers using remote desktop. Introduce NON_ZERO_DURATION to signal that animation must be enabled and the duration must be non-zero, but other than that can be as short as possible. BUG=397478,396969 TEST=ash_unittests on drmemory, Windows and Chrome OS bots Review URL: https://codereview.chromium.org/420013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286089 0039d316-1c4b-4281-b951-d872f2087c98 --- .../desktop_background_controller_unittest.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'ash/desktop_background') diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc index fa2e2a4..8751a18 100644 --- a/ash/desktop_background/desktop_background_controller_unittest.cc +++ b/ash/desktop_background/desktop_background_controller_unittest.cc @@ -68,7 +68,8 @@ void RunAnimationForWidget(views::Widget* widget) { class DesktopBackgroundControllerTest : public test::AshTestBase { public: DesktopBackgroundControllerTest() - : controller_(NULL) { + : controller_(NULL), + wallpaper_delegate_(NULL) { } virtual ~DesktopBackgroundControllerTest() {} @@ -149,8 +150,8 @@ TEST_F(DesktopBackgroundControllerTest, BasicReparenting) { TEST_F(DesktopBackgroundControllerTest, ControllerOwnership) { // We cannot short-circuit animations for this test. - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); // Create wallpaper and background view. DesktopBackgroundController* controller = @@ -181,8 +182,8 @@ TEST_F(DesktopBackgroundControllerTest, ControllerOwnership) { // move all desktop views if there are more than one. TEST_F(DesktopBackgroundControllerTest, BackgroundMovementDuringUnlock) { // We cannot short-circuit animations for this test. - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); // Reset wallpaper state, see ControllerOwnership above. DesktopBackgroundController* controller = @@ -229,8 +230,8 @@ TEST_F(DesktopBackgroundControllerTest, BackgroundMovementDuringUnlock) { // animation and replace current wallpaper before next animation starts. TEST_F(DesktopBackgroundControllerTest, ChangeWallpaperQuick) { // We cannot short-circuit animations for this test. - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); // Reset wallpaper state, see ControllerOwnership above. DesktopBackgroundController* controller = -- cgit v1.1