| 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 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 generator.MoveMouseTo(off_shelf.x(), off_shelf.y()); | 1328 generator.MoveMouseTo(off_shelf.x(), off_shelf.y()); |
| 1328 EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest()); | 1329 EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest()); |
| 1329 generator.MoveMouseTo(on_shelf.x(), on_shelf.y()); | 1330 generator.MoveMouseTo(on_shelf.x(), on_shelf.y()); |
| 1330 EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest()); | 1331 EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest()); |
| 1331 shelf->shelf_widget()->ForceUndimming(true); | 1332 shelf->shelf_widget()->ForceUndimming(true); |
| 1332 EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest()); | 1333 EXPECT_EQ(0, shelf->shelf_widget()->GetDimmingAlphaForTest()); |
| 1333 } | 1334 } |
| 1334 | 1335 |
| 1335 // Verifies the shelf is visible when status/shelf is focused. | 1336 // Verifies the shelf is visible when status/shelf is focused. |
| 1336 TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrShelfFocused) { | 1337 TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrShelfFocused) { |
| 1338 if (!SupporsHostWindowResize()) |
| 1339 return; |
| 1340 |
| 1337 // Since ShelfLayoutManager queries for mouse location, move the mouse so | 1341 // Since ShelfLayoutManager queries for mouse location, move the mouse so |
| 1338 // it isn't over the shelf. | 1342 // it isn't over the shelf. |
| 1339 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 1343 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 1340 gfx::Point()); | 1344 gfx::Point()); |
| 1341 generator.MoveMouseTo(0, 0); | 1345 generator.MoveMouseTo(0, 0); |
| 1342 | 1346 |
| 1343 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 1347 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 1344 views::Widget* widget = new views::Widget; | 1348 views::Widget* widget = new views::Widget; |
| 1345 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 1349 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 1346 params.bounds = gfx::Rect(0, 0, 200, 200); | 1350 params.bounds = gfx::Rect(0, 0, 200, 200); |
| (...skipping 915 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 |