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