summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 05:06:17 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-29 05:06:17 +0000
commit507e2ce928c1df3c3a97bbee47e8391762988d9c (patch)
treef6e8272c3c76285a8951f3a539a8f5fe8a090651
parent20e37e874b2a1415609b5c1cf58ba2d18b516262 (diff)
downloadchromium_src-507e2ce928c1df3c3a97bbee47e8391762988d9c.zip
chromium_src-507e2ce928c1df3c3a97bbee47e8391762988d9c.tar.gz
chromium_src-507e2ce928c1df3c3a97bbee47e8391762988d9c.tar.bz2
Revert of Introduce NON_ZERO_DURATION for animation unit tests (https://codereview.chromium.org/420013002/)
Reason for revert: I suspect this is causing Linux Tests dbg (2) failures in app_list_unittests: http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29/builds/47929 Strangely I had green try runs for linux_chromium_rel for app_list_unittests. Original issue's description: > 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 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=286089 TBR=oshima@chromium.org,ajuma@chromium.org,sky@chromium.org NOTREECHECKS=true NOTRY=true BUG=397478,396969 Review URL: https://codereview.chromium.org/413403011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@286102 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/desktop_background/desktop_background_controller_unittest.cc15
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc4
-rw-r--r--ash/wm/overview/window_selector_unittest.cc12
-rw-r--r--ash/wm/window_animations_unittest.cc11
-rw-r--r--ash/wm/workspace_controller_unittest.cc4
-rw-r--r--content/browser/web_contents/aura/window_slider_unittest.cc3
-rw-r--r--tools/valgrind/drmemory/suppressions.txt18
-rw-r--r--tools/valgrind/gtest_exclude/ash_unittests.gtest-drmemory_win32.txt6
-rw-r--r--ui/aura/window_unittest.cc20
-rw-r--r--ui/compositor/layer_animation_element.cc16
-rw-r--r--ui/compositor/layer_animator_unittest.cc4
-rw-r--r--ui/compositor/scoped_animation_duration_scale_mode.h4
-rw-r--r--ui/keyboard/keyboard_controller_unittest.cc4
-rw-r--r--ui/views/controls/textfield/textfield.cc1
-rw-r--r--ui/views/widget/widget_unittest.cc2
-rw-r--r--ui/wm/core/visibility_controller_unittest.cc4
-rw-r--r--ui/wm/core/window_animations.cc22
17 files changed, 74 insertions, 76 deletions
diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc
index 8751a18..fa2e2a4 100644
--- a/ash/desktop_background/desktop_background_controller_unittest.cc
+++ b/ash/desktop_background/desktop_background_controller_unittest.cc
@@ -68,8 +68,7 @@ void RunAnimationForWidget(views::Widget* widget) {
class DesktopBackgroundControllerTest : public test::AshTestBase {
public:
DesktopBackgroundControllerTest()
- : controller_(NULL),
- wallpaper_delegate_(NULL) {
+ : controller_(NULL) {
}
virtual ~DesktopBackgroundControllerTest() {}
@@ -150,8 +149,8 @@ TEST_F(DesktopBackgroundControllerTest, BasicReparenting) {
TEST_F(DesktopBackgroundControllerTest, ControllerOwnership) {
// We cannot short-circuit animations for this test.
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
// Create wallpaper and background view.
DesktopBackgroundController* controller =
@@ -182,8 +181,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 test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
// Reset wallpaper state, see ControllerOwnership above.
DesktopBackgroundController* controller =
@@ -230,8 +229,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 test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_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 d033960..8167b29 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::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode::NORMAL_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::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode::NORMAL_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 55c3f02..c53664c 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 test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
ToggleOverview();
EXPECT_TRUE(window1->IsVisible());
EXPECT_TRUE(window1->layer()->GetTargetVisibility());
}
{
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_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 test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
ToggleOverview();
ToggleOverview();
}
diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc
index 4e4c518..0e1a4d8 100644
--- a/ash/wm/window_animations_unittest.cc
+++ b/ash/wm/window_animations_unittest.cc
@@ -65,9 +65,6 @@ 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());
@@ -113,8 +110,8 @@ TEST_F(WindowAnimationsTest, LayerTargetVisibility) {
namespace wm {
TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_ptr<Window> window(CreateTestWindowInShellWithId(0));
window->SetBounds(gfx::Rect(5, 10, 320, 240));
@@ -171,8 +168,8 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
} // namespace wm
TEST_F(WindowAnimationsTest, LockAnimationDuration) {
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_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 77f001f..e00390e 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 test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_ptr<aura::Window> window1(CreateTestWindowInShellWithId(0));
window1->Hide();
window1->SetBounds(gfx::Rect(16, 32, 640, 320));
diff --git a/content/browser/web_contents/aura/window_slider_unittest.cc b/content/browser/web_contents/aura/window_slider_unittest.cc
index a65a127..da9d1c6 100644
--- a/content/browser/web_contents/aura/window_slider_unittest.cc
+++ b/content/browser/web_contents/aura/window_slider_unittest.cc
@@ -589,8 +589,7 @@ TEST_F(WindowSliderTest, SwipeDuringSwipeAnimation) {
WindowSliderDelegateTest slider_delegate;
new WindowSlider(&slider_delegate, root_window(), window.get());
- // This test uses explicit durations so needs a normal duration.
- ui::ScopedAnimationDurationScaleMode normal_duration(
+ ui::ScopedAnimationDurationScaleMode normal_duration_(
ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
ui::LayerAnimator* animator = window->layer()->GetAnimator();
animator->set_disable_timer_for_test(true);
diff --git a/tools/valgrind/drmemory/suppressions.txt b/tools/valgrind/drmemory/suppressions.txt
index cae23f7..1fb2268 100644
--- a/tools/valgrind/drmemory/suppressions.txt
+++ b/tools/valgrind/drmemory/suppressions.txt
@@ -646,3 +646,21 @@ content.dll!content::DesktopCaptureDevice::Core::DoStopAndDeAllocate
UNADDRESSABLE ACCESS
name=http://code.google.com/p/dynamorio/issues/detail?id=1443
dynamorio.dll!*
+
+UNADDRESSABLE ACCESS
+name=http://crbug.com/397124
+...
+*!ash::wm::WindowAnimationsTest_CrossFadeToBounds_Test::TestBody
+
+# Unfortunately there's some FPO and the TestBody is skipped:
+UNADDRESSABLE ACCESS
+name=http://crbug.com/397124_b
+compositor.dll!ui::Layer::GetTargetOpacity
+*!testing::internal::HandleExceptionsInMethodIfSupported<>
+
+# Unfortunately there's some FPO and the TestBody is skipped:
+UNADDRESSABLE ACCESS
+name=http://crbug.com/397124_c
+compositor.dll!ui::Layer::SetAnimator
+compositor.dll!ui::Layer::GetAnimator
+*!testing::internal::HandleExceptionsInMethodIfSupported<>
diff --git a/tools/valgrind/gtest_exclude/ash_unittests.gtest-drmemory_win32.txt b/tools/valgrind/gtest_exclude/ash_unittests.gtest-drmemory_win32.txt
new file mode 100644
index 0000000..470e16a
--- /dev/null
+++ b/tools/valgrind/gtest_exclude/ash_unittests.gtest-drmemory_win32.txt
@@ -0,0 +1,6 @@
+# http://crbug.com/396969
+DesktopBackgroundControllerTest.*
+# http://crbug.com/397478
+WindowAnimationsTest.HideShowBrightnessGrayscaleAnimation
+WindowAnimationsTest.LockAnimationDuration
+WorkspaceControllerTest.AnimatedNormToMaxToNormRepositionsRemaining
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 69f7ff9..ae548c4 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -1623,8 +1623,8 @@ TEST_F(WindowTest, OwnedProperty) {
TEST_F(WindowTest, SetBoundsInternalShouldCheckTargetBounds) {
// We cannot short-circuit animations in this test.
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_ptr<Window> w1(
CreateTestWindowWithBounds(gfx::Rect(0, 0, 100, 100), root_window()));
@@ -2242,8 +2242,8 @@ TEST_F(WindowTest, RootWindowSetWhenReparenting) {
parent1.AddChild(&child);
// We need animations to start in order to observe the bounds changes.
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode animation_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
ui::ScopedLayerAnimationSettings settings1(child.layer()->GetAnimator());
settings1.SetTransitionDuration(base::TimeDelta::FromMilliseconds(100));
gfx::Rect new_bounds(gfx::Rect(35, 35, 50, 50));
@@ -2357,8 +2357,8 @@ TEST_F(WindowTest, DelegateNotifiedAsBoundsChange) {
BoundsChangeDelegate delegate;
// We cannot short-circuit animations in this test.
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_ptr<Window> window(
CreateTestWindowWithDelegate(&delegate, 1,
@@ -2392,8 +2392,8 @@ TEST_F(WindowTest, DelegateNotifiedAsBoundsChangeInHiddenLayer) {
BoundsChangeDelegate delegate;
// We cannot short-circuit animations in this test.
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_ptr<Window> window(
CreateTestWindowWithDelegate(&delegate, 1,
@@ -3395,8 +3395,8 @@ class TestLayerAnimationObserver : public ui::LayerAnimationObserver {
}
TEST_F(WindowTest, WindowDestroyCompletesAnimations) {
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_refptr<ui::LayerAnimator> animator =
ui::LayerAnimator::CreateImplicitAnimator();
TestLayerAnimationObserver observer;
diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc
index 290b865..c25e4a1 100644
--- a/ui/compositor/layer_animation_element.cc
+++ b/ui/compositor/layer_animation_element.cc
@@ -20,11 +20,11 @@ namespace ui {
namespace {
-// The factor by which duration is scaled up or down when using
-// ScopedAnimationDurationScaleMode.
-const int kSlowDurationScaleMultiplier = 4;
-const int kFastDurationScaleDivisor = 4;
-const int kTestDurationScaleDivisor = 100;
+// The factor by which duration is scaled up or down when
+// ScopedAnimationDurationScaleMode::duration_scale_mode() is SLOW_DURATION or
+// FAST_DURATION.
+const int kSlowDurationScaleFactor = 4;
+const int kFastDurationScaleFactor = 4;
// Pause -----------------------------------------------------------------------
class Pause : public LayerAnimationElement {
@@ -761,11 +761,9 @@ base::TimeDelta LayerAnimationElement::GetEffectiveDuration(
case ScopedAnimationDurationScaleMode::NORMAL_DURATION:
return duration;
case ScopedAnimationDurationScaleMode::FAST_DURATION:
- return duration / kFastDurationScaleDivisor;
+ return duration / kFastDurationScaleFactor;
case ScopedAnimationDurationScaleMode::SLOW_DURATION:
- return duration * kSlowDurationScaleMultiplier;
- case ScopedAnimationDurationScaleMode::NON_ZERO_DURATION:
- return duration / kTestDurationScaleDivisor;
+ return duration * kSlowDurationScaleFactor;
case ScopedAnimationDurationScaleMode::ZERO_DURATION:
return base::TimeDelta();
default:
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index c72eab9..3ae8c2b 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -2000,8 +2000,8 @@ TEST(LayerAnimatorTest, CallbackDeletesAnimationInProgress) {
// tests the behavior when the OnLayerAnimationAborted() callback causes
// all of the animator's other animations to be deleted.
TEST(LayerAnimatorTest, ObserverDeletesAnimationsOnAbort) {
- ScopedAnimationDurationScaleMode test_duration_mode(
- ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ScopedAnimationDurationScaleMode normal_duration_mode(
+ ScopedAnimationDurationScaleMode::NORMAL_DURATION);
scoped_refptr<LayerAnimator> animator(new TestLayerAnimator());
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
diff --git a/ui/compositor/scoped_animation_duration_scale_mode.h b/ui/compositor/scoped_animation_duration_scale_mode.h
index 9444651..a0ac5d3 100644
--- a/ui/compositor/scoped_animation_duration_scale_mode.h
+++ b/ui/compositor/scoped_animation_duration_scale_mode.h
@@ -17,10 +17,6 @@ class COMPOSITOR_EXPORT ScopedAnimationDurationScaleMode {
NORMAL_DURATION,
FAST_DURATION,
SLOW_DURATION,
- // A very short but guaranteed non-zero duration for individual tests that
- // need to assert things about animations after creating them.
- NON_ZERO_DURATION,
- // Animations complete immediately after being created. Used by most tests.
ZERO_DURATION
};
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc
index 9a68561..7f97a5f 100644
--- a/ui/keyboard/keyboard_controller_unittest.cc
+++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -471,8 +471,8 @@ class KeyboardControllerAnimationTest : public KeyboardControllerTest,
virtual void SetUp() OVERRIDE {
// We cannot short-circuit animations for this test.
- ui::ScopedAnimationDurationScaleMode test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
KeyboardControllerTest::SetUp();
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index e05f969..c26fe36 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -70,7 +70,6 @@ int GetDragSelectionDelay() {
case ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION: return 100;
case ui::ScopedAnimationDurationScaleMode::FAST_DURATION: return 25;
case ui::ScopedAnimationDurationScaleMode::SLOW_DURATION: return 400;
- case ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION: return 1;
case ui::ScopedAnimationDurationScaleMode::ZERO_DURATION: return 0;
}
return 100;
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index 232064f..f6d1ea2 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -1856,7 +1856,7 @@ TEST_F(WidgetTest, CloseWidgetWhileAnimating) {
// Normal animations for tests have ZERO_DURATION, make sure we are actually
// animating the movement.
ui::ScopedAnimationDurationScaleMode animation_scale_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION);
ui::ScopedLayerAnimationSettings animation_settings(
widget->GetLayer()->GetAnimator());
animation_settings.AddObserver(&animation_observer);
diff --git a/ui/wm/core/visibility_controller_unittest.cc b/ui/wm/core/visibility_controller_unittest.cc
index 01731ef..5825d495 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 test_duration_mode(
- ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
+ ui::ScopedAnimationDurationScaleMode normal_duration_mode(
+ ui::ScopedAnimationDurationScaleMode::NORMAL_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 8284990..22fd43d 100644
--- a/ui/wm/core/window_animations.cc
+++ b/ui/wm/core/window_animations.cc
@@ -26,7 +26,6 @@
#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"
@@ -650,23 +649,10 @@ bool AnimateWindow(aura::Window* window, WindowAnimationType type) {
}
bool WindowAnimationsDisabled(aura::Window* window) {
- // 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();
+ return (!gfx::Animation::ShouldRenderRichAnimation() || (window &&
+ window->GetProperty(aura::client::kAnimationsDisabledKey)) ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kWindowAnimationsDisabled));
}
} // namespace wm