| 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 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 window_tree_host_manager->GetAllRootWindows(); | 1466 window_tree_host_manager->GetAllRootWindows(); |
| 1467 EXPECT_EQ(root_windows.size(), 2U); | 1467 EXPECT_EQ(root_windows.size(), 2U); |
| 1468 | 1468 |
| 1469 // Get the shelves in both displays and set them to be 'AutoHide'. | 1469 // Get the shelves in both displays and set them to be 'AutoHide'. |
| 1470 ShelfLayoutManager* shelf_1 = | 1470 ShelfLayoutManager* shelf_1 = |
| 1471 GetRootWindowController(root_windows[0])->GetShelfLayoutManager(); | 1471 GetRootWindowController(root_windows[0])->GetShelfLayoutManager(); |
| 1472 ShelfLayoutManager* shelf_2 = | 1472 ShelfLayoutManager* shelf_2 = |
| 1473 GetRootWindowController(root_windows[1])->GetShelfLayoutManager(); | 1473 GetRootWindowController(root_windows[1])->GetShelfLayoutManager(); |
| 1474 EXPECT_NE(shelf_1, shelf_2); | 1474 EXPECT_NE(shelf_1, shelf_2); |
| 1475 EXPECT_NE(shelf_1->shelf_widget()->GetNativeWindow()->GetRootWindow(), | 1475 EXPECT_NE(shelf_1->shelf_widget()->GetNativeWindow()->GetRootWindow(), |
| 1476 shelf_2->shelf_widget()->GetNativeWindow()-> | 1476 shelf_2->shelf_widget()->GetNativeWindow()->GetRootWindow()); |
| 1477 GetRootWindow()); | |
| 1478 shelf_1->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1477 shelf_1->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1479 shelf_1->LayoutShelf(); | 1478 shelf_1->LayoutShelf(); |
| 1480 shelf_2->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1479 shelf_2->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1481 shelf_2->LayoutShelf(); | 1480 shelf_2->LayoutShelf(); |
| 1482 | 1481 |
| 1483 // Create a window in each display and show them in maximized state. | 1482 // Create a window in each display and show them in maximized state. |
| 1484 aura::Window* window_1 = | 1483 aura::Window* window_1 = CreateTestWindowInParent(root_windows[0]); |
| 1485 CreateTestWindowInParent(root_windows[0]); | |
| 1486 window_1->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1484 window_1->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1487 window_1->SetProperty(aura::client::kShowStateKey, | 1485 window_1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1488 ui::SHOW_STATE_MAXIMIZED); | |
| 1489 window_1->Show(); | 1486 window_1->Show(); |
| 1490 aura::Window* window_2 = | 1487 aura::Window* window_2 = CreateTestWindowInParent(root_windows[1]); |
| 1491 CreateTestWindowInParent(root_windows[1]); | |
| 1492 window_2->SetBounds(gfx::Rect(201, 0, 100, 100)); | 1488 window_2->SetBounds(gfx::Rect(201, 0, 100, 100)); |
| 1493 window_2->SetProperty(aura::client::kShowStateKey, | 1489 window_2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1494 ui::SHOW_STATE_MAXIMIZED); | |
| 1495 window_2->Show(); | 1490 window_2->Show(); |
| 1496 | 1491 |
| 1497 EXPECT_EQ(shelf_1->shelf_widget()->GetNativeWindow()->GetRootWindow(), | 1492 EXPECT_EQ(shelf_1->shelf_widget()->GetNativeWindow()->GetRootWindow(), |
| 1498 window_1->GetRootWindow()); | 1493 window_1->GetRootWindow()); |
| 1499 EXPECT_EQ(shelf_2->shelf_widget()->GetNativeWindow()->GetRootWindow(), | 1494 EXPECT_EQ(shelf_2->shelf_widget()->GetNativeWindow()->GetRootWindow(), |
| 1500 window_2->GetRootWindow()); | 1495 window_2->GetRootWindow()); |
| 1501 | 1496 |
| 1502 // Activate one window in one display and manually trigger the update of shelf | 1497 // Activate one window in one display and manually trigger the update of shelf |
| 1503 // visibility. | 1498 // visibility. |
| 1504 wm::ActivateWindow(window_1); | 1499 wm::ActivateWindow(window_1); |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 StatusAreaWidget* status_area_widget = | 2360 StatusAreaWidget* status_area_widget = |
| 2366 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); | 2361 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); |
| 2367 EXPECT_TRUE(status_area_widget->IsVisible()); | 2362 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 2368 // Shelf should be in the first display's area. | 2363 // Shelf should be in the first display's area. |
| 2369 // TODO: make this test more robust against changes in font, font size. | 2364 // TODO: make this test more robust against changes in font, font size. |
| 2370 EXPECT_EQ("353,453 147x47", | 2365 EXPECT_EQ("353,453 147x47", |
| 2371 status_area_widget->GetWindowBoundsInScreen().ToString()); | 2366 status_area_widget->GetWindowBoundsInScreen().ToString()); |
| 2372 } | 2367 } |
| 2373 | 2368 |
| 2374 } // namespace ash | 2369 } // namespace ash |
| OLD | NEW |