| 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_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2268 | 2268 |
| 2269 aura::Window* window1 = CreateTestWindowInShellWithId(0); | 2269 aura::Window* window1 = CreateTestWindowInShellWithId(0); |
| 2270 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); | 2270 window1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 2271 window1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 2271 window1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 2272 window1->Show(); | 2272 window1->Show(); |
| 2273 std::unique_ptr<aura::Window> window2(CreateTestWindowInShellWithId(0)); | 2273 std::unique_ptr<aura::Window> window2(CreateTestWindowInShellWithId(0)); |
| 2274 window2->SetBounds(gfx::Rect(0, 0, 100, 100)); | 2274 window2->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 2275 window2->Show(); | 2275 window2->Show(); |
| 2276 wm::ActivateWindow(window1); | 2276 wm::ActivateWindow(window1); |
| 2277 | 2277 |
| 2278 shelf->ShutdownStatusAreaWidget(); | 2278 shelf->Shutdown(); |
| 2279 shelf_manager->PrepareForShutdown(); | |
| 2280 | 2279 |
| 2281 // Deleting a focused maximized window will switch focus to |window2|. This | 2280 // Deleting a focused maximized window will switch focus to |window2|. This |
| 2282 // would normally cause the ShelfLayoutManager to update its state. However | 2281 // would normally cause the ShelfLayoutManager to update its state. However |
| 2283 // during shutdown we want to handle this without crashing. | 2282 // during shutdown we want to handle this without crashing. |
| 2284 delete window1; | 2283 delete window1; |
| 2285 } | 2284 } |
| 2286 | 2285 |
| 2287 TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { | 2286 TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { |
| 2288 if (!SupportsMultipleDisplays()) | 2287 if (!SupportsMultipleDisplays()) |
| 2289 return; | 2288 return; |
| 2290 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); | 2289 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); |
| 2291 | 2290 |
| 2292 UpdateDisplay("500x400, 500x400"); | 2291 UpdateDisplay("500x400, 500x400"); |
| 2293 | 2292 |
| 2294 StatusAreaWidget* status_area_widget = | 2293 StatusAreaWidget* status_area_widget = |
| 2295 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); | 2294 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); |
| 2296 EXPECT_TRUE(status_area_widget->IsVisible()); | 2295 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 2297 // Shelf should be in the first display's area. | 2296 // Shelf should be in the first display's area. |
| 2298 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 2297 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
| 2299 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 2298 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
| 2300 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 2299 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
| 2301 } | 2300 } |
| 2302 | 2301 |
| 2303 } // namespace ash | 2302 } // namespace ash |
| OLD | NEW |