Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2044)

Unified Diff: ash/wm/window_animations_unittest.cc

Issue 10869066: Attempt 2 at Fixes crash introduced @ 153047 (you can hit crash by maximizing a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better fix Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/wm/window_animations_unittest.cc
diff --git a/ash/wm/window_animations_unittest.cc b/ash/wm/window_animations_unittest.cc
index 0a5f62569d2767c6ca48f3359436339e751ec6ca..b4a2618012b922bf10ab26b91392f204f8971f17 100644
--- a/ash/wm/window_animations_unittest.cc
+++ b/ash/wm/window_animations_unittest.cc
@@ -19,7 +19,18 @@ using ui::Layer;
namespace ash {
namespace internal {
-typedef ash::test::AshTestBase WindowAnimationsTest;
+class WindowAnimationsTest : public ash::test::AshTestBase {
+ public:
+ WindowAnimationsTest() {}
+
+ virtual void TearDown() OVERRIDE {
+ ui::LayerAnimator::set_disable_animations_for_test(true);
+ AshTestBase::TearDown();
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest);
+};
TEST_F(WindowAnimationsTest, HideShow) {
scoped_ptr<aura::Window> window(
@@ -140,7 +151,7 @@ TEST_F(WindowAnimationsTest, LayerTargetVisibility) {
}
TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
- internal::SetDelayedOldLayerDeletionInCrossFadeForTest(true);
+ ui::LayerAnimator::set_disable_animations_for_test(false);
scoped_ptr<Window> window(
aura::test::CreateTestWindowWithId(0, NULL));
@@ -165,8 +176,11 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
EXPECT_EQ(ui::Transform(), window->layer()->GetTargetTransform());
- // Allow the animation observer to delete itself.
- RunAllPendingInMessageLoop();
+ // Run the animations to completion.
+ static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
+ base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
+ static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())->
+ Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
// Cross fade to a smaller size, as in a restore animation.
old_layer = window->layer();
@@ -184,8 +198,10 @@ TEST_F(WindowAnimationsTest, CrossFadeToBounds) {
EXPECT_EQ(1.0f, window->layer()->GetTargetOpacity());
EXPECT_EQ(ui::Transform(), window->layer()->GetTargetTransform());
- RunAllPendingInMessageLoop();
- internal::SetDelayedOldLayerDeletionInCrossFadeForTest(false);
+ static_cast<ui::AnimationContainerElement*>(old_layer->GetAnimator())->Step(
+ base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
+ static_cast<ui::AnimationContainerElement*>(window->layer()->GetAnimator())->
+ Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1));
}
TEST_F(WindowAnimationsTest, GetCrossFadeDuration) {

Powered by Google App Engine
This is Rietveld 408576698