OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/wm/core/window_animations.h" | 5 #include "ui/wm/core/window_animations.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "ui/aura/test/aura_test_base.h" | 8 #include "ui/aura/test/aura_test_base.h" |
9 #include "ui/aura/test/test_windows.h" | 9 #include "ui/aura/test/test_windows.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 wm::SetWindowVisibilityAnimationType( | 281 wm::SetWindowVisibilityAnimationType( |
282 window.get(), WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 282 window.get(), WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
283 AnimateOnChildWindowVisibilityChanged(window.get(), true); | 283 AnimateOnChildWindowVisibilityChanged(window.get(), true); |
284 EXPECT_TRUE(window->layer()->visible()); | 284 EXPECT_TRUE(window->layer()->visible()); |
285 | 285 |
286 EXPECT_FALSE(animation_host.hide_completed()); | 286 EXPECT_FALSE(animation_host.hide_completed()); |
287 AnimateOnChildWindowVisibilityChanged(window.get(), false); | 287 AnimateOnChildWindowVisibilityChanged(window.get(), false); |
288 EXPECT_TRUE(animation_host.hide_completed()); | 288 EXPECT_TRUE(animation_host.hide_completed()); |
289 } | 289 } |
290 | 290 |
| 291 // The rotation animation for hiding a window should not leak the animation |
| 292 // observer. |
| 293 TEST_F(WindowAnimationsTest, RotateHideNoLeak) { |
| 294 ui::ScopedAnimationDurationScaleMode scale_mode( |
| 295 ui::ScopedAnimationDurationScaleMode::FAST_DURATION); |
| 296 |
| 297 scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithId(0, NULL)); |
| 298 ui::Layer* animating_layer = window->layer(); |
| 299 wm::SetWindowVisibilityAnimationType(window.get(), |
| 300 WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); |
| 301 |
| 302 AnimateOnChildWindowVisibilityChanged(window.get(), true); |
| 303 AnimateOnChildWindowVisibilityChanged(window.get(), false); |
| 304 |
| 305 animating_layer->GetAnimator()->StopAnimating(); |
| 306 } |
| 307 |
291 } // namespace wm | 308 } // namespace wm |
OLD | NEW |