| 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/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/focus_cycler.h" | 7 #include "ash/focus_cycler.h" |
| 8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/shell_delegate.h" | 11 #include "ash/shell_delegate.h" |
| 12 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
| 13 #include "ash/system/tray/system_tray.h" |
| 13 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
| 14 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
| 15 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 16 #include "ui/aura/monitor_manager.h" | 17 #include "ui/aura/monitor_manager.h" |
| 17 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
| 18 #include "ui/aura/test/event_generator.h" | 19 #include "ui/aura/test/event_generator.h" |
| 19 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 20 #include "ui/base/animation/animation_container_element.h" | 21 #include "ui/base/animation/animation_container_element.h" |
| 21 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
| 22 #include "ui/compositor/layer_animator.h" | 23 #include "ui/compositor/layer_animator.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 const aura::MonitorManager* manager = | 501 const aura::MonitorManager* manager = |
| 501 aura::Env::GetInstance()->monitor_manager(); | 502 aura::Env::GetInstance()->monitor_manager(); |
| 502 gfx::Monitor monitor = | 503 gfx::Monitor monitor = |
| 503 manager->GetMonitorNearestWindow(Shell::GetRootWindow()); | 504 manager->GetMonitorNearestWindow(Shell::GetRootWindow()); |
| 504 ASSERT_NE(-1, monitor.id()); | 505 ASSERT_NE(-1, monitor.id()); |
| 505 EXPECT_EQ(shelf->GetIdealBounds().width(), | 506 EXPECT_EQ(shelf->GetIdealBounds().width(), |
| 506 monitor.GetWorkAreaInsets().left()); | 507 monitor.GetWorkAreaInsets().left()); |
| 507 EXPECT_GE( | 508 EXPECT_GE( |
| 508 launcher_bounds.width(), | 509 launcher_bounds.width(), |
| 509 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); | 510 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); |
| 511 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, |
| 512 Shell::GetInstance()->tray()->shelf_alignment()); |
| 513 gfx::Rect status_bounds(shelf->status()->GetWindowScreenBounds()); |
| 514 EXPECT_GE(status_bounds.width(), |
| 515 shelf->status()->GetContentsView()->GetPreferredSize().width()); |
| 510 EXPECT_EQ(shelf->GetIdealBounds().width(), | 516 EXPECT_EQ(shelf->GetIdealBounds().width(), |
| 511 monitor.GetWorkAreaInsets().left()); | 517 monitor.GetWorkAreaInsets().left()); |
| 512 EXPECT_EQ(0, monitor.GetWorkAreaInsets().top()); | 518 EXPECT_EQ(0, monitor.GetWorkAreaInsets().top()); |
| 513 EXPECT_EQ(0, monitor.GetWorkAreaInsets().bottom()); | 519 EXPECT_EQ(0, monitor.GetWorkAreaInsets().bottom()); |
| 514 EXPECT_EQ(0, monitor.GetWorkAreaInsets().right()); | 520 EXPECT_EQ(0, monitor.GetWorkAreaInsets().right()); |
| 515 EXPECT_EQ(monitor.bounds().x(), launcher_bounds.x()); | 521 EXPECT_EQ(monitor.bounds().x(), launcher_bounds.x()); |
| 516 EXPECT_EQ(monitor.bounds().y(), launcher_bounds.y()); | 522 EXPECT_EQ(monitor.bounds().y(), launcher_bounds.y()); |
| 517 EXPECT_EQ(monitor.bounds().height(), launcher_bounds.height()); | 523 EXPECT_EQ(monitor.bounds().height(), launcher_bounds.height()); |
| 518 | 524 |
| 519 | |
| 520 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); | 525 shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); |
| 521 launcher_bounds = shelf->launcher_widget()->GetWindowScreenBounds(); | 526 launcher_bounds = shelf->launcher_widget()->GetWindowScreenBounds(); |
| 522 monitor = manager->GetMonitorNearestWindow(Shell::GetRootWindow()); | 527 monitor = manager->GetMonitorNearestWindow(Shell::GetRootWindow()); |
| 523 ASSERT_NE(-1, monitor.id()); | 528 ASSERT_NE(-1, monitor.id()); |
| 524 EXPECT_EQ(shelf->GetIdealBounds().width(), | 529 EXPECT_EQ(shelf->GetIdealBounds().width(), |
| 525 monitor.GetWorkAreaInsets().right()); | 530 monitor.GetWorkAreaInsets().right()); |
| 526 EXPECT_GE( | 531 EXPECT_GE( |
| 527 launcher_bounds.width(), | 532 launcher_bounds.width(), |
| 528 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); | 533 shelf->launcher_widget()->GetContentsView()->GetPreferredSize().width()); |
| 534 EXPECT_EQ(SHELF_ALIGNMENT_RIGHT, |
| 535 Shell::GetInstance()->tray()->shelf_alignment()); |
| 536 status_bounds = gfx::Rect(shelf->status()->GetWindowScreenBounds()); |
| 537 EXPECT_GE(status_bounds.width(), |
| 538 shelf->status()->GetContentsView()->GetPreferredSize().width()); |
| 529 EXPECT_EQ(shelf->GetIdealBounds().width(), | 539 EXPECT_EQ(shelf->GetIdealBounds().width(), |
| 530 monitor.GetWorkAreaInsets().right()); | 540 monitor.GetWorkAreaInsets().right()); |
| 531 EXPECT_EQ(0, monitor.GetWorkAreaInsets().top()); | 541 EXPECT_EQ(0, monitor.GetWorkAreaInsets().top()); |
| 532 EXPECT_EQ(0, monitor.GetWorkAreaInsets().bottom()); | 542 EXPECT_EQ(0, monitor.GetWorkAreaInsets().bottom()); |
| 533 EXPECT_EQ(0, monitor.GetWorkAreaInsets().left()); | 543 EXPECT_EQ(0, monitor.GetWorkAreaInsets().left()); |
| 534 EXPECT_EQ(monitor.work_area().right(), launcher_bounds.x()); | 544 EXPECT_EQ(monitor.work_area().right(), launcher_bounds.x()); |
| 535 EXPECT_EQ(monitor.bounds().y(), launcher_bounds.y()); | 545 EXPECT_EQ(monitor.bounds().y(), launcher_bounds.y()); |
| 536 EXPECT_EQ(monitor.bounds().height(), launcher_bounds.height()); | 546 EXPECT_EQ(monitor.bounds().height(), launcher_bounds.height()); |
| 537 } | 547 } |
| 538 | 548 |
| 539 } // namespace internal | 549 } // namespace internal |
| 540 } // namespace ash | 550 } // namespace ash |
| OLD | NEW |