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/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
9 #include "ash/launcher/launcher_button.h" | 9 #include "ash/launcher/launcher_button.h" |
10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
11 #include "ash/launcher/launcher_view.h" | 11 #include "ash/launcher/launcher_view.h" |
| 12 #include "ash/root_window_controller.h" |
12 #include "ash/screen_ash.h" | 13 #include "ash/screen_ash.h" |
13 #include "ash/shelf_types.h" | 14 #include "ash/shelf/shelf_types.h" |
| 15 #include "ash/shelf/shelf_widget.h" |
14 #include "ash/shell.h" | 16 #include "ash/shell.h" |
15 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
16 #include "ash/test/ash_test_base.h" | 18 #include "ash/test/ash_test_base.h" |
17 #include "ash/test/launcher_view_test_api.h" | 19 #include "ash/test/launcher_view_test_api.h" |
18 #include "ash/test/shell_test_api.h" | 20 #include "ash/test/shell_test_api.h" |
19 #include "ash/test/test_launcher_delegate.h" | 21 #include "ash/test/test_launcher_delegate.h" |
20 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
21 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
22 #include "base/command_line.h" | 24 #include "base/command_line.h" |
23 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // takes a non-const Window. We can probably fix that. | 114 // takes a non-const Window. We can probably fix that. |
113 void IsPanelAboveLauncherIcon(aura::Window* panel) { | 115 void IsPanelAboveLauncherIcon(aura::Window* panel) { |
114 // Waits until all launcher view animations are done. | 116 // Waits until all launcher view animations are done. |
115 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); | 117 launcher_view_test()->RunMessageLoopUntilAnimationsDone(); |
116 | 118 |
117 Launcher* launcher = Launcher::ForPrimaryDisplay(); | 119 Launcher* launcher = Launcher::ForPrimaryDisplay(); |
118 gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel); | 120 gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(panel); |
119 ASSERT_FALSE(icon_bounds.IsEmpty()); | 121 ASSERT_FALSE(icon_bounds.IsEmpty()); |
120 | 122 |
121 gfx::Rect window_bounds = panel->GetBoundsInRootWindow(); | 123 gfx::Rect window_bounds = panel->GetBoundsInRootWindow(); |
122 gfx::Rect launcher_bounds = launcher->widget()->GetWindowBoundsInScreen(); | 124 gfx::Rect launcher_bounds = launcher->shelf_widget()-> |
| 125 GetWindowBoundsInScreen(); |
123 ShelfAlignment alignment = GetAlignment(); | 126 ShelfAlignment alignment = GetAlignment(); |
124 | 127 |
125 if (IsHorizontal(alignment)) { | 128 if (IsHorizontal(alignment)) { |
126 // The horizontal bounds of the panel window should contain the bounds of | 129 // The horizontal bounds of the panel window should contain the bounds of |
127 // the launcher icon. | 130 // the launcher icon. |
128 EXPECT_LE(window_bounds.x(), icon_bounds.x()); | 131 EXPECT_LE(window_bounds.x(), icon_bounds.x()); |
129 EXPECT_GE(window_bounds.right(), icon_bounds.right()); | 132 EXPECT_GE(window_bounds.right(), icon_bounds.right()); |
130 } else { | 133 } else { |
131 // The vertical bounds of the panel window should contain the bounds of | 134 // The vertical bounds of the panel window should contain the bounds of |
132 // the launcher icon. | 135 // the launcher icon. |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 TEST_F(PanelLayoutManagerTest, AlignmentTop) { | 543 TEST_F(PanelLayoutManagerTest, AlignmentTop) { |
541 gfx::Rect bounds(0, 0, 201, 201); | 544 gfx::Rect bounds(0, 0, 201, 201); |
542 scoped_ptr<aura::Window> w(CreatePanelWindow(bounds)); | 545 scoped_ptr<aura::Window> w(CreatePanelWindow(bounds)); |
543 SetAlignment(SHELF_ALIGNMENT_TOP); | 546 SetAlignment(SHELF_ALIGNMENT_TOP); |
544 IsPanelAboveLauncherIcon(w.get()); | 547 IsPanelAboveLauncherIcon(w.get()); |
545 IsCalloutAboveLauncherIcon(w.get()); | 548 IsCalloutAboveLauncherIcon(w.get()); |
546 } | 549 } |
547 | 550 |
548 } // namespace internal | 551 } // namespace internal |
549 } // namespace ash | 552 } // namespace ash |
OLD | NEW |