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 29 matching lines...) Expand all Loading... |
40 int GetLayerZPosition(const ui::Layer* child) { | 40 int GetLayerZPosition(const ui::Layer* child) { |
41 return GetZPosition<ui::Layer>(child); | 41 return GetZPosition<ui::Layer>(child); |
42 } | 42 } |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 class WindowAnimationsTest : public aura::test::AuraTestBase { | 46 class WindowAnimationsTest : public aura::test::AuraTestBase { |
47 public: | 47 public: |
48 WindowAnimationsTest() {} | 48 WindowAnimationsTest() {} |
49 | 49 |
50 virtual void TearDown() override { | 50 void TearDown() override { AuraTestBase::TearDown(); } |
51 AuraTestBase::TearDown(); | |
52 } | |
53 | 51 |
54 private: | 52 private: |
55 DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); | 53 DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); |
56 }; | 54 }; |
57 | 55 |
58 TEST_F(WindowAnimationsTest, LayerTargetVisibility) { | 56 TEST_F(WindowAnimationsTest, LayerTargetVisibility) { |
59 scoped_ptr<aura::Window> window( | 57 scoped_ptr<aura::Window> window( |
60 aura::test::CreateTestWindowWithId(0, NULL)); | 58 aura::test::CreateTestWindowWithId(0, NULL)); |
61 | 59 |
62 // Layer target visibility changes according to Show/Hide. | 60 // Layer target visibility changes according to Show/Hide. |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 EXPECT_EQ(3, GetLayerZPosition(other->layer())); | 246 EXPECT_EQ(3, GetLayerZPosition(other->layer())); |
249 // Make sure the animating layer is on top of all windows. | 247 // Make sure the animating layer is on top of all windows. |
250 EXPECT_EQ(4, GetLayerZPosition(animating_layer)); | 248 EXPECT_EQ(4, GetLayerZPosition(animating_layer)); |
251 } | 249 } |
252 } | 250 } |
253 | 251 |
254 // A simple AnimationHost implementation for the NotifyHideCompleted test. | 252 // A simple AnimationHost implementation for the NotifyHideCompleted test. |
255 class NotifyHideCompletedAnimationHost : public aura::client::AnimationHost { | 253 class NotifyHideCompletedAnimationHost : public aura::client::AnimationHost { |
256 public: | 254 public: |
257 NotifyHideCompletedAnimationHost() : hide_completed_(false) {} | 255 NotifyHideCompletedAnimationHost() : hide_completed_(false) {} |
258 virtual ~NotifyHideCompletedAnimationHost() {} | 256 ~NotifyHideCompletedAnimationHost() override {} |
259 | 257 |
260 // Overridden from TestWindowDelegate: | 258 // Overridden from TestWindowDelegate: |
261 virtual void OnWindowHidingAnimationCompleted() override { | 259 void OnWindowHidingAnimationCompleted() override { hide_completed_ = true; } |
262 hide_completed_ = true; | |
263 } | |
264 | 260 |
265 virtual void SetHostTransitionOffsets( | 261 void SetHostTransitionOffsets(const gfx::Vector2d& top_left, |
266 const gfx::Vector2d& top_left, | 262 const gfx::Vector2d& bottom_right) override {} |
267 const gfx::Vector2d& bottom_right) override {} | |
268 | 263 |
269 bool hide_completed() const { return hide_completed_; } | 264 bool hide_completed() const { return hide_completed_; } |
270 | 265 |
271 private: | 266 private: |
272 bool hide_completed_; | 267 bool hide_completed_; |
273 | 268 |
274 DISALLOW_COPY_AND_ASSIGN(NotifyHideCompletedAnimationHost); | 269 DISALLOW_COPY_AND_ASSIGN(NotifyHideCompletedAnimationHost); |
275 }; | 270 }; |
276 | 271 |
277 TEST_F(WindowAnimationsTest, NotifyHideCompleted) { | 272 TEST_F(WindowAnimationsTest, NotifyHideCompleted) { |
(...skipping 21 matching lines...) Expand all Loading... |
299 wm::SetWindowVisibilityAnimationType(window.get(), | 294 wm::SetWindowVisibilityAnimationType(window.get(), |
300 WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); | 295 WINDOW_VISIBILITY_ANIMATION_TYPE_ROTATE); |
301 | 296 |
302 AnimateOnChildWindowVisibilityChanged(window.get(), true); | 297 AnimateOnChildWindowVisibilityChanged(window.get(), true); |
303 AnimateOnChildWindowVisibilityChanged(window.get(), false); | 298 AnimateOnChildWindowVisibilityChanged(window.get(), false); |
304 | 299 |
305 animating_layer->GetAnimator()->StopAnimating(); | 300 animating_layer->GetAnimator()->StopAnimating(); |
306 } | 301 } |
307 | 302 |
308 } // namespace wm | 303 } // namespace wm |
OLD | NEW |