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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/common/accelerators/accelerator_controller.h" | 8 #include "ash/common/accelerators/accelerator_controller.h" |
9 #include "ash/common/accelerators/accelerator_table.h" | 9 #include "ash/common/accelerators/accelerator_table.h" |
10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ash/shelf/shelf_view.h" | 25 #include "ash/shelf/shelf_view.h" |
26 #include "ash/shelf/shelf_widget.h" | 26 #include "ash/shelf/shelf_widget.h" |
27 #include "ash/shell.h" | 27 #include "ash/shell.h" |
28 #include "ash/test/ash_test_base.h" | 28 #include "ash/test/ash_test_base.h" |
29 #include "ash/test/display_manager_test_api.h" | 29 #include "ash/test/display_manager_test_api.h" |
30 #include "ash/test/shelf_test_api.h" | 30 #include "ash/test/shelf_test_api.h" |
31 #include "ash/test/test_system_tray_item.h" | 31 #include "ash/test/test_system_tray_item.h" |
32 #include "ash/wm/window_state_aura.h" | 32 #include "ash/wm/window_state_aura.h" |
33 #include "ash/wm/window_util.h" | 33 #include "ash/wm/window_util.h" |
34 #include "base/command_line.h" | 34 #include "base/command_line.h" |
| 35 #include "base/run_loop.h" |
35 #include "ui/aura/client/aura_constants.h" | 36 #include "ui/aura/client/aura_constants.h" |
36 #include "ui/aura/client/window_tree_client.h" | 37 #include "ui/aura/client/window_tree_client.h" |
37 #include "ui/aura/window.h" | 38 #include "ui/aura/window.h" |
38 #include "ui/aura/window_event_dispatcher.h" | 39 #include "ui/aura/window_event_dispatcher.h" |
39 #include "ui/compositor/layer.h" | 40 #include "ui/compositor/layer.h" |
40 #include "ui/compositor/layer_animator.h" | 41 #include "ui/compositor/layer_animator.h" |
41 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 42 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
42 #include "ui/display/display.h" | 43 #include "ui/display/display.h" |
43 #include "ui/display/manager/display_layout.h" | 44 #include "ui/display/manager/display_layout.h" |
44 #include "ui/display/screen.h" | 45 #include "ui/display/screen.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 GetShelfWidget()->AddObserver(this); | 83 GetShelfWidget()->AddObserver(this); |
83 } | 84 } |
84 | 85 |
85 ~ShelfAnimationWaiter() override { GetShelfWidget()->RemoveObserver(this); } | 86 ~ShelfAnimationWaiter() override { GetShelfWidget()->RemoveObserver(this); } |
86 | 87 |
87 // Wait till the shelf finishes animating to its expected bounds. | 88 // Wait till the shelf finishes animating to its expected bounds. |
88 void WaitTillDoneAnimating() { | 89 void WaitTillDoneAnimating() { |
89 if (IsDoneAnimating()) | 90 if (IsDoneAnimating()) |
90 done_waiting_ = true; | 91 done_waiting_ = true; |
91 else | 92 else |
92 base::MessageLoop::current()->Run(); | 93 base::RunLoop().Run(); |
93 } | 94 } |
94 | 95 |
95 // Returns true if the animation has completed and it was valid. | 96 // Returns true if the animation has completed and it was valid. |
96 bool WasValidAnimation() const { | 97 bool WasValidAnimation() const { |
97 return done_waiting_ && animation_steps_ > 0; | 98 return done_waiting_ && animation_steps_ > 0; |
98 } | 99 } |
99 | 100 |
100 private: | 101 private: |
101 // Returns true if shelf has finished animating to the target size. | 102 // Returns true if shelf has finished animating to the target size. |
102 bool IsDoneAnimating() const { | 103 bool IsDoneAnimating() const { |
(...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 | 2033 |
2033 StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); | 2034 StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); |
2034 EXPECT_TRUE(status_area_widget->IsVisible()); | 2035 EXPECT_TRUE(status_area_widget->IsVisible()); |
2035 // Shelf should be in the first display's area. | 2036 // Shelf should be in the first display's area. |
2036 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 2037 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
2037 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 2038 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
2038 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 2039 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
2039 } | 2040 } |
2040 | 2041 |
2041 } // namespace ash | 2042 } // namespace ash |
OLD | NEW |