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/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include "ash/shell_window_ids.h" | 7 #include "ash/shell_window_ids.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
10 #include "ash/wm/workspace_controller.h" | 10 #include "ash/wm/workspace_controller.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 EXPECT_TRUE(window->layer()->visible()); | 88 EXPECT_TRUE(window->layer()->visible()); |
89 | 89 |
90 // Stays shown. | 90 // Stays shown. |
91 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + | 91 window->layer()->GetAnimator()->Step(base::TimeTicks::Now() + |
92 base::TimeDelta::FromSeconds(5)); | 92 base::TimeDelta::FromSeconds(5)); |
93 EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness()); | 93 EXPECT_EQ(0.0f, window->layer()->GetTargetBrightness()); |
94 EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale()); | 94 EXPECT_EQ(0.0f, window->layer()->GetTargetGrayscale()); |
95 EXPECT_TRUE(window->layer()->visible()); | 95 EXPECT_TRUE(window->layer()->visible()); |
96 } | 96 } |
97 | 97 |
| 98 TEST_F(WindowAnimationsTest, HideRotateAnimationNoLeak) { |
| 99 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| 100 window->Show(); |
| 101 ::wm::SetWindowVisibilityAnimationType( |
| 102 window.get(), |
| 103 ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); |
| 104 |
| 105 // Should not leak with LSAN enabled. |
| 106 EXPECT_NO_FATAL_FAILURE( |
| 107 AnimateOnChildWindowVisibilityChanged(window.get(), false)); |
| 108 } |
| 109 |
98 TEST_F(WindowAnimationsTest, LayerTargetVisibility) { | 110 TEST_F(WindowAnimationsTest, LayerTargetVisibility) { |
99 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 111 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
100 | 112 |
101 // Layer target visibility changes according to Show/Hide. | 113 // Layer target visibility changes according to Show/Hide. |
102 window->Show(); | 114 window->Show(); |
103 EXPECT_TRUE(window->layer()->GetTargetVisibility()); | 115 EXPECT_TRUE(window->layer()->GetTargetVisibility()); |
104 window->Hide(); | 116 window->Hide(); |
105 EXPECT_FALSE(window->layer()->GetTargetVisibility()); | 117 EXPECT_FALSE(window->layer()->GetTargetVisibility()); |
106 window->Show(); | 118 window->Show(); |
107 EXPECT_TRUE(window->layer()->GetTargetVisibility()); | 119 EXPECT_TRUE(window->layer()->GetTargetVisibility()); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 EXPECT_TRUE(layer->GetAnimator()->is_animating()); | 249 EXPECT_TRUE(layer->GetAnimator()->is_animating()); |
238 // Expect default duration (200ms for stock ash minimizing animation). | 250 // Expect default duration (200ms for stock ash minimizing animation). |
239 EXPECT_EQ(default_duration.InMilliseconds(), | 251 EXPECT_EQ(default_duration.InMilliseconds(), |
240 layer->GetAnimator()->GetTransitionDuration().InMilliseconds()); | 252 layer->GetAnimator()->GetTransitionDuration().InMilliseconds()); |
241 window->Show(); | 253 window->Show(); |
242 layer->GetAnimator()->StopAnimating(); | 254 layer->GetAnimator()->StopAnimating(); |
243 } | 255 } |
244 } | 256 } |
245 | 257 |
246 } // namespace ash | 258 } // namespace ash |
OLD | NEW |