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