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 "ash/wm/visibility_controller.h" | 5 #include "ash/wm/visibility_controller.h" |
6 | 6 |
7 #include "ash/test/aura_shell_test_base.h" | 7 #include "ash/test/aura_shell_test_base.h" |
8 #include "ui/aura/test/test_windows.h" | 8 #include "ui/aura/test/test_windows.h" |
9 #include "ui/aura/test/test_window_delegate.h" | 9 #include "ui/aura/test/test_window_delegate.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/gfx/compositor/layer_animator.h" |
11 | 12 |
12 namespace ash { | 13 namespace ash { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
15 typedef test::AuraShellTestBase VisibilityControllerTest; | 16 typedef test::AuraShellTestBase VisibilityControllerTest; |
16 | 17 |
17 // Hiding a window in an animatable container should not hide the window's layer | 18 // Hiding a window in an animatable container should not hide the window's layer |
18 // immediately. | 19 // immediately. |
19 TEST_F(VisibilityControllerTest, AnimateHideDoesntHideWindowLayer) { | 20 TEST_F(VisibilityControllerTest, AnimateHideDoesntHideWindowLayer) { |
| 21 // We cannot disable animations for this test. |
| 22 ui::LayerAnimator::set_disable_animations_for_test(false); |
| 23 |
20 scoped_ptr<aura::Window> container( | 24 scoped_ptr<aura::Window> container( |
21 aura::test::CreateTestWindowWithId(-1, NULL)); | 25 aura::test::CreateTestWindowWithId(-1, NULL)); |
22 SetChildWindowVisibilityChangesAnimated(container.get()); | 26 SetChildWindowVisibilityChangesAnimated(container.get()); |
23 | 27 |
24 aura::test::TestWindowDelegate d; | 28 aura::test::TestWindowDelegate d; |
25 scoped_ptr<aura::Window> animatable( | 29 scoped_ptr<aura::Window> animatable( |
26 aura::test::CreateTestWindowWithDelegate( | 30 aura::test::CreateTestWindowWithDelegate( |
27 &d, -2, gfx::Rect(0, 0, 50, 50), container.get())); | 31 &d, -2, gfx::Rect(0, 0, 50, 50), container.get())); |
28 scoped_ptr<aura::Window> non_animatable( | 32 scoped_ptr<aura::Window> non_animatable( |
29 aura::test::CreateTestWindowWithDelegateAndType( | 33 aura::test::CreateTestWindowWithDelegateAndType( |
30 &d, aura::client::WINDOW_TYPE_CONTROL, -3, gfx::Rect(51, 51, 50, 50), | 34 &d, aura::client::WINDOW_TYPE_CONTROL, -3, gfx::Rect(51, 51, 50, 50), |
31 container.get())); | 35 container.get())); |
32 EXPECT_TRUE(animatable->IsVisible()); | 36 EXPECT_TRUE(animatable->IsVisible()); |
33 EXPECT_TRUE(animatable->layer()->visible()); | 37 EXPECT_TRUE(animatable->layer()->visible()); |
34 animatable->Hide(); | 38 animatable->Hide(); |
35 EXPECT_FALSE(animatable->IsVisible()); | 39 EXPECT_FALSE(animatable->IsVisible()); |
36 EXPECT_TRUE(animatable->layer()->visible()); | 40 EXPECT_TRUE(animatable->layer()->visible()); |
37 | 41 |
38 EXPECT_TRUE(non_animatable->IsVisible()); | 42 EXPECT_TRUE(non_animatable->IsVisible()); |
39 EXPECT_TRUE(non_animatable->layer()->visible()); | 43 EXPECT_TRUE(non_animatable->layer()->visible()); |
40 non_animatable->Hide(); | 44 non_animatable->Hide(); |
41 EXPECT_FALSE(non_animatable->IsVisible()); | 45 EXPECT_FALSE(non_animatable->IsVisible()); |
42 EXPECT_FALSE(non_animatable->layer()->visible()); | 46 EXPECT_FALSE(non_animatable->layer()->visible()); |
43 } | 47 } |
44 | 48 |
45 } // namespace internal | 49 } // namespace internal |
46 } // namespace ash | 50 } // namespace ash |
OLD | NEW |