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/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
11 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
12 #include "ash/focus_cycler.h" | 12 #include "ash/focus_cycler.h" |
13 #include "ash/root_window_controller.h" | 13 #include "ash/root_window_controller.h" |
14 #include "ash/session/session_state_delegate.h" | 14 #include "ash/session/session_state_delegate.h" |
15 #include "ash/shelf/shelf.h" | 15 #include "ash/shelf/shelf.h" |
16 #include "ash/shelf/shelf_layout_manager_observer.h" | 16 #include "ash/shelf/shelf_layout_manager_observer.h" |
17 #include "ash/shelf/shelf_view.h" | 17 #include "ash/shelf/shelf_view.h" |
18 #include "ash/shelf/shelf_widget.h" | 18 #include "ash/shelf/shelf_widget.h" |
19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
20 #include "ash/shell_window_ids.h" | 20 #include "ash/shell_window_ids.h" |
21 #include "ash/system/status_area_widget.h" | 21 #include "ash/system/status_area_widget.h" |
22 #include "ash/system/tray/system_tray.h" | 22 #include "ash/system/tray/system_tray.h" |
23 #include "ash/system/tray/system_tray_item.h" | 23 #include "ash/system/tray/system_tray_item.h" |
24 #include "ash/test/ash_test_base.h" | 24 #include "ash/test/ash_test_base.h" |
| 25 #include "ash/test/display_manager_test_api.h" |
25 #include "ash/test/shelf_test_api.h" | 26 #include "ash/test/shelf_test_api.h" |
26 #include "ash/wm/window_state.h" | 27 #include "ash/wm/window_state.h" |
27 #include "ash/wm/window_util.h" | 28 #include "ash/wm/window_util.h" |
28 #include "base/command_line.h" | 29 #include "base/command_line.h" |
29 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
30 #include "ui/aura/client/aura_constants.h" | 31 #include "ui/aura/client/aura_constants.h" |
31 #include "ui/aura/client/window_tree_client.h" | 32 #include "ui/aura/client/window_tree_client.h" |
32 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
33 #include "ui/aura/window_event_dispatcher.h" | 34 #include "ui/aura/window_event_dispatcher.h" |
34 #include "ui/compositor/layer.h" | 35 #include "ui/compositor/layer.h" |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 | 1026 |
1026 // Moving to the left edge of the secondary display without first crossing | 1027 // Moving to the left edge of the secondary display without first crossing |
1027 // the primary display's right aligned shelf first should not show the shelf. | 1028 // the primary display's right aligned shelf first should not show the shelf. |
1028 generator.MoveMouseTo(right_edge + 2, y); | 1029 generator.MoveMouseTo(right_edge + 2, y); |
1029 UpdateAutoHideStateNow(); | 1030 UpdateAutoHideStateNow(); |
1030 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 1031 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
1031 } | 1032 } |
1032 | 1033 |
1033 // Assertions around the lock screen showing. | 1034 // Assertions around the lock screen showing. |
1034 TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { | 1035 TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { |
| 1036 if (!SupportsHostWindowResize()) |
| 1037 return; |
| 1038 |
1035 // Since ShelfLayoutManager queries for mouse location, move the mouse so | 1039 // Since ShelfLayoutManager queries for mouse location, move the mouse so |
1036 // it isn't over the shelf. | 1040 // it isn't over the shelf. |
1037 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 1041 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
1038 gfx::Point()); | 1042 gfx::Point()); |
1039 generator.MoveMouseTo(0, 0); | 1043 generator.MoveMouseTo(0, 0); |
1040 | 1044 |
1041 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 1045 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
1042 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1046 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1043 views::Widget* widget = new views::Widget; | 1047 views::Widget* widget = new views::Widget; |
1044 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 1048 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 | 2266 |
2263 shelf->ShutdownStatusAreaWidget(); | 2267 shelf->ShutdownStatusAreaWidget(); |
2264 shelf_manager->PrepareForShutdown(); | 2268 shelf_manager->PrepareForShutdown(); |
2265 | 2269 |
2266 // Deleting a focused maximized window will switch focus to |window2|. This | 2270 // Deleting a focused maximized window will switch focus to |window2|. This |
2267 // would normally cause the ShelfLayoutManager to update its state. However | 2271 // would normally cause the ShelfLayoutManager to update its state. However |
2268 // during shutdown we want to handle this without crashing. | 2272 // during shutdown we want to handle this without crashing. |
2269 delete window1; | 2273 delete window1; |
2270 } | 2274 } |
2271 | 2275 |
| 2276 TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { |
| 2277 if (!SupportsMultipleDisplays()) |
| 2278 return; |
| 2279 |
| 2280 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 2281 test::DisplayManagerTestApi test_api(display_manager); |
| 2282 test_api.SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
| 2283 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); |
| 2284 UpdateDisplay("500x500, 500x500"); |
| 2285 |
| 2286 StatusAreaWidget* status_area_widget = |
| 2287 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); |
| 2288 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 2289 // Shelf should be in the first display's area. |
| 2290 EXPECT_EQ("348,453 152x47", |
| 2291 status_area_widget->GetWindowBoundsInScreen().ToString()); |
| 2292 } |
| 2293 |
2272 } // namespace ash | 2294 } // namespace ash |
OLD | NEW |