diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-30 14:59:38 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-30 14:59:38 +0000 |
commit | c41f5f4305fcac07b94d7f9100db49dc57edf806 (patch) | |
tree | 69038353f79f1dc5809f4c0fd0c578c0bd039231 /ash | |
parent | 9333526c498584579f0ecb82a6097e40c3a05cd7 (diff) | |
download | chromium_src-c41f5f4305fcac07b94d7f9100db49dc57edf806.zip chromium_src-c41f5f4305fcac07b94d7f9100db49dc57edf806.tar.gz chromium_src-c41f5f4305fcac07b94d7f9100db49dc57edf806.tar.bz2 |
Reland: 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.
(Original patch https://codereview.chromium.org/420013002/ was correlated with
app_list_unittests failures in AppListMainViewTest.DragLastItemFromFolderAndDropAtLastSlot
AppListViewTestAura.ReshowWithOpenFolder but testing locally and on the try
bots can't repro it, so calling it flake.)
BUG=397478, 396969
TEST=ash_unittests on drmemory, Windows and Chrome OS bots
TBR=oshima@chromium.org
Review URL: https://codereview.chromium.org/426973002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286517 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/desktop_background/desktop_background_controller_unittest.cc | 15 | ||||
-rw-r--r-- | ash/shelf/shelf_layout_manager_unittest.cc | 4 | ||||
-rw-r--r-- | ash/wm/overview/window_selector_unittest.cc | 12 | ||||
-rw-r--r-- | ash/wm/window_animations_unittest.cc | 11 | ||||
-rw-r--r-- | ash/wm/workspace_controller_unittest.cc | 4 |
5 files changed, 25 insertions, 21 deletions
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 = diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 8167b29..d033960 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -1668,7 +1668,7 @@ TEST_F(ShelfLayoutManagerTest, ShelfAnimatesWhenGestureComplete) { { // Enable animations so that we can make sure that they occur. ui::ScopedAnimationDurationScaleMode regular_animations( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); gfx::Rect shelf_bounds_in_screen = @@ -1697,7 +1697,7 @@ TEST_F(ShelfLayoutManagerTest, ShelfAnimatesWhenGestureComplete) { { // Enable the animations so that we can make sure they do occur. ui::ScopedAnimationDurationScaleMode regular_animations( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); gfx::Point start = GetShelfWidget()->GetWindowBoundsInScreen().CenterPoint(); diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index c53664c..55c3f02 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -458,15 +458,15 @@ TEST_F(WindowSelectorTest, DISABLED_MinimizedWindowVisibility) { EXPECT_FALSE(window1->IsVisible()); EXPECT_FALSE(window1->layer()->GetTargetVisibility()); { - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); ToggleOverview(); EXPECT_TRUE(window1->IsVisible()); EXPECT_TRUE(window1->layer()->GetTargetVisibility()); } { - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); ToggleOverview(); EXPECT_FALSE(window1->IsVisible()); EXPECT_FALSE(window1->layer()->GetTargetVisibility()); @@ -561,8 +561,8 @@ TEST_F(WindowSelectorTest, QuickReentryRestoresInitialTransform) { // animating when we reenter. We cannot short circuit animations for this but // we also don't have to wait for them to complete. { - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); ToggleOverview(); ToggleOverview(); } diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc index 0e1a4d8..4e4c518 100644 --- a/ash/wm/window_animations_unittest.cc +++ b/ash/wm/window_animations_unittest.cc @@ -65,6 +65,9 @@ class MinimizeAnimationObserver : public ui::LayerAnimationObserver { }; TEST_F(WindowAnimationsTest, HideShowBrightnessGrayscaleAnimation) { + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); + scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); window->Show(); EXPECT_TRUE(window->layer()->visible()); @@ -110,8 +113,8 @@ TEST_F(WindowAnimationsTest, LayerTargetVisibility) { namespace wm { TEST_F(WindowAnimationsTest, CrossFadeToBounds) { - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); scoped_ptr<Window> window(CreateTestWindowInShellWithId(0)); window->SetBounds(gfx::Rect(5, 10, 320, 240)); @@ -168,8 +171,8 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) { } // namespace wm TEST_F(WindowAnimationsTest, LockAnimationDuration) { - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); scoped_ptr<Window> window(CreateTestWindowInShellWithId(0)); Layer* layer = window->layer(); diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc index e00390e..77f001f 100644 --- a/ash/wm/workspace_controller_unittest.cc +++ b/ash/wm/workspace_controller_unittest.cc @@ -1203,8 +1203,8 @@ TEST_F(WorkspaceControllerTest, NormToMaxToNormRepositionsRemaining) { // Test that animations are triggered. TEST_F(WorkspaceControllerTest, AnimatedNormToMaxToNormRepositionsRemaining) { - ui::ScopedAnimationDurationScaleMode normal_duration_mode( - ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); + ui::ScopedAnimationDurationScaleMode test_duration_mode( + ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0)); window1->Hide(); window1->SetBounds(gfx::Rect(16, 32, 640, 320)); |