OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ui/aura/client/aura_constants.h" | 24 #include "ui/aura/client/aura_constants.h" |
25 #include "ui/aura/test/event_generator.h" | 25 #include "ui/aura/test/event_generator.h" |
26 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
27 #include "ui/aura/test/test_windows.h" | 27 #include "ui/aura/test/test_windows.h" |
28 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
29 #include "ui/aura/window_event_dispatcher.h" | 29 #include "ui/aura/window_event_dispatcher.h" |
30 #include "ui/base/hit_test.h" | 30 #include "ui/base/hit_test.h" |
31 #include "ui/base/ui_base_types.h" | 31 #include "ui/base/ui_base_types.h" |
32 #include "ui/compositor/layer.h" | 32 #include "ui/compositor/layer.h" |
33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
34 #include "ui/compositor/test/draw_waiter_for_test.h" | |
35 #include "ui/events/event_utils.h" | 34 #include "ui/events/event_utils.h" |
36 #include "ui/gfx/screen.h" | 35 #include "ui/gfx/screen.h" |
37 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
38 #include "ui/wm/core/window_animations.h" | 37 #include "ui/wm/core/window_animations.h" |
39 #include "ui/wm/core/window_util.h" | 38 #include "ui/wm/core/window_util.h" |
40 | 39 |
41 using aura::Window; | 40 using aura::Window; |
42 | 41 |
43 namespace ash { | 42 namespace ash { |
44 | 43 |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 EXPECT_TRUE(window1->layer()->GetAnimator()->is_animating()); | 1229 EXPECT_TRUE(window1->layer()->GetAnimator()->is_animating()); |
1231 EXPECT_TRUE(window2->layer()->GetAnimator()->is_animating()); | 1230 EXPECT_TRUE(window2->layer()->GetAnimator()->is_animating()); |
1232 | 1231 |
1233 window1->layer()->GetAnimator()->StopAnimating(); | 1232 window1->layer()->GetAnimator()->StopAnimating(); |
1234 window2->layer()->GetAnimator()->StopAnimating(); | 1233 window2->layer()->GetAnimator()->StopAnimating(); |
1235 // |window1| should be flush right and |window2| flush left. | 1234 // |window1| should be flush right and |window2| flush left. |
1236 EXPECT_EQ(base::IntToString( | 1235 EXPECT_EQ(base::IntToString( |
1237 desktop_area.width() - window1->bounds().width()) + | 1236 desktop_area.width() - window1->bounds().width()) + |
1238 ",32 640x320", window1->bounds().ToString()); | 1237 ",32 640x320", window1->bounds().ToString()); |
1239 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); | 1238 EXPECT_EQ("0,48 256x512", window2->bounds().ToString()); |
1240 | |
1241 // Wait for the compositor to draw, which would terminate the pending | |
1242 // animations. | |
1243 ui::Compositor* compositor = window2->layer()->GetCompositor(); | |
1244 while (compositor->layer_animator_collection()->HasActiveAnimators()) | |
1245 ui::DrawWaiterForTest::Wait(compositor); | |
1246 } | 1239 } |
1247 | 1240 |
1248 // This tests simulates a browser and an app and verifies the ordering of the | 1241 // This tests simulates a browser and an app and verifies the ordering of the |
1249 // windows and layers doesn't get out of sync as various operations occur. Its | 1242 // windows and layers doesn't get out of sync as various operations occur. Its |
1250 // really testing code in FocusController, but easier to simulate here. Just as | 1243 // really testing code in FocusController, but easier to simulate here. Just as |
1251 // with a real browser the browser here has a transient child window | 1244 // with a real browser the browser here has a transient child window |
1252 // (corresponds to the status bubble). | 1245 // (corresponds to the status bubble). |
1253 TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) { | 1246 TEST_F(WorkspaceControllerTest, VerifyLayerOrdering) { |
1254 scoped_ptr<Window> browser(aura::test::CreateTestWindowWithDelegate( | 1247 scoped_ptr<Window> browser(aura::test::CreateTestWindowWithDelegate( |
1255 NULL, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 6, 7, 8), NULL)); | 1248 NULL, ui::wm::WINDOW_TYPE_NORMAL, gfx::Rect(5, 6, 7, 8), NULL)); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 ui::EventTimeForNow()); | 1609 ui::EventTimeForNow()); |
1617 target = targeter->FindTargetForEvent(root, &touch); | 1610 target = targeter->FindTargetForEvent(root, &touch); |
1618 if (points[i].is_target_hit) | 1611 if (points[i].is_target_hit) |
1619 EXPECT_EQ(window.get(), target); | 1612 EXPECT_EQ(window.get(), target); |
1620 else | 1613 else |
1621 EXPECT_NE(window.get(), target); | 1614 EXPECT_NE(window.get(), target); |
1622 } | 1615 } |
1623 } | 1616 } |
1624 | 1617 |
1625 } // namespace ash | 1618 } // namespace ash |
OLD | NEW |