summaryrefslogtreecommitdiffstats
path: root/ui/wm
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-30 14:59:38 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-30 14:59:38 +0000
commitc41f5f4305fcac07b94d7f9100db49dc57edf806 (patch)
tree69038353f79f1dc5809f4c0fd0c578c0bd039231 /ui/wm
parent9333526c498584579f0ecb82a6097e40c3a05cd7 (diff)
downloadchromium_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 'ui/wm')
-rw-r--r--ui/wm/core/visibility_controller_unittest.cc4
-rw-r--r--ui/wm/core/window_animations.cc22
2 files changed, 20 insertions, 6 deletions
diff --git a/ui/wm/core/visibility_controller_unittest.cc b/ui/wm/core/visibility_controller_unittest.cc
index 5825d495..01731ef 100644
--- a/ui/wm/core/visibility_controller_unittest.cc
+++ b/ui/wm/core/visibility_controller_unittest.cc
@@ -22,8 +22,8 @@ typedef aura::test::AuraTestBase VisibilityControllerTest;
// ignored.
TEST_F(VisibilityControllerTest, AnimateTransparencyToZeroAndHideHides) {
// We cannot disable animations for this test.
- ui::ScopedAnimationDurationScaleMode normal_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
+ ui::ScopedAnimationDurationScaleMode test_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
VisibilityController controller;
aura::client::SetVisibilityClient(root_window(), &controller);
diff --git a/ui/wm/core/window_animations.cc b/ui/wm/core/window_animations.cc
index 22fd43d..8284990 100644
--- a/ui/wm/core/window_animations.cc
+++ b/ui/wm/core/window_animations.cc
@@ -26,6 +26,7 @@
#include "ui/compositor/layer_animation_sequence.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/layer_tree_owner.h"
+#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/animation/animation.h"
#include "ui/gfx/interpolated_transform.h"
@@ -649,10 +650,23 @@ bool AnimateWindow(aura::Window* window, WindowAnimationType type) {
}
bool WindowAnimationsDisabled(aura::Window* window) {
- return (!gfx::Animation::ShouldRenderRichAnimation() || (window &&
- window->GetProperty(aura::client::kAnimationsDisabledKey)) ||
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kWindowAnimationsDisabled));
+ // Individual windows can choose to skip animations.
+ if (window && window->GetProperty(aura::client::kAnimationsDisabledKey))
+ return true;
+
+ // Animations can be disabled globally for testing.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kWindowAnimationsDisabled))
+ return true;
+
+ // Tests of animations themselves should still run even if the machine is
+ // being accessed via Remote Desktop.
+ if (ui::ScopedAnimationDurationScaleMode::duration_scale_mode() ==
+ ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION)
+ return false;
+
+ // Let the user decide whether or not to play the animation.
+ return !gfx::Animation::ShouldRenderRichAnimation();
}
} // namespace wm