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" | |
9 #include "ui/aura/test/test_windows.h" | 8 #include "ui/aura/test/test_windows.h" |
10 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
11 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
12 #include "ui/compositor/layer_animator.h" | 11 #include "ui/compositor/layer_animator.h" |
13 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 12 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
14 #include "ui/gfx/animation/animation_container_element.h" | 13 #include "ui/gfx/animation/animation_container_element.h" |
15 #include "ui/gfx/vector2d.h" | 14 #include "ui/gfx/vector2d.h" |
16 #include "ui/wm/core/transient_window_manager.h" | 15 #include "ui/wm/core/transient_window_manager.h" |
17 #include "ui/wm/core/transient_window_stacking_client.h" | 16 #include "ui/wm/core/transient_window_stacking_client.h" |
18 #include "ui/wm/core/window_util.h" | 17 #include "ui/wm/core/window_util.h" |
19 #include "ui/wm/public/animation_host.h" | 18 #include "ui/wm/public/animation_host.h" |
| 19 #include "ui/wm/test/wm_test_base.h" |
20 | 20 |
21 using aura::Window; | 21 using aura::Window; |
22 using ui::Layer; | 22 using ui::Layer; |
23 | 23 |
24 namespace wm { | 24 namespace wm { |
25 namespace { | 25 namespace { |
26 | 26 |
27 template<typename T>int GetZPosition(const T* child) { | 27 template<typename T>int GetZPosition(const T* child) { |
28 const T* parent = child->parent(); | 28 const T* parent = child->parent(); |
29 const std::vector<T*> children = parent->children(); | 29 const std::vector<T*> children = parent->children(); |
30 typename std::vector<T*>::const_iterator iter = | 30 typename std::vector<T*>::const_iterator iter = |
31 std::find(children.begin(), children.end(), child); | 31 std::find(children.begin(), children.end(), child); |
32 DCHECK(iter != children.end()); | 32 DCHECK(iter != children.end()); |
33 return iter - children.begin(); | 33 return iter - children.begin(); |
34 } | 34 } |
35 | 35 |
36 int GetWindowZPosition(const aura::Window* child) { | 36 int GetWindowZPosition(const aura::Window* child) { |
37 return GetZPosition<aura::Window>(child); | 37 return GetZPosition<aura::Window>(child); |
38 } | 38 } |
39 | 39 |
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 WMTestBase { |
47 public: | 47 public: |
48 WindowAnimationsTest() {} | 48 WindowAnimationsTest() {} |
49 | 49 |
50 virtual void TearDown() OVERRIDE { | 50 virtual void TearDown() OVERRIDE { |
51 AuraTestBase::TearDown(); | 51 AuraTestBase::TearDown(); |
52 } | 52 } |
53 | 53 |
54 private: | 54 private: |
55 DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); | 55 DISALLOW_COPY_AND_ASSIGN(WindowAnimationsTest); |
56 }; | 56 }; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 window.get(), WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); | 282 window.get(), WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
283 AnimateOnChildWindowVisibilityChanged(window.get(), true); | 283 AnimateOnChildWindowVisibilityChanged(window.get(), true); |
284 EXPECT_TRUE(window->layer()->visible()); | 284 EXPECT_TRUE(window->layer()->visible()); |
285 | 285 |
286 EXPECT_FALSE(animation_host.hide_completed()); | 286 EXPECT_FALSE(animation_host.hide_completed()); |
287 AnimateOnChildWindowVisibilityChanged(window.get(), false); | 287 AnimateOnChildWindowVisibilityChanged(window.get(), false); |
288 EXPECT_TRUE(animation_host.hide_completed()); | 288 EXPECT_TRUE(animation_host.hide_completed()); |
289 } | 289 } |
290 | 290 |
291 } // namespace wm | 291 } // namespace wm |
OLD | NEW |