| 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/toplevel_layout_manager.h" | 5 #include "ash/wm/toplevel_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/screen_ash.h" | 7 #include "ash/screen_ash.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
| 10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 public: | 26 public: |
| 27 ToplevelLayoutManagerTest() : layout_manager_(NULL) {} | 27 ToplevelLayoutManagerTest() : layout_manager_(NULL) {} |
| 28 virtual ~ToplevelLayoutManagerTest() {} | 28 virtual ~ToplevelLayoutManagerTest() {} |
| 29 | 29 |
| 30 internal::ToplevelLayoutManager* layout_manager() { | 30 internal::ToplevelLayoutManager* layout_manager() { |
| 31 return layout_manager_; | 31 return layout_manager_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() OVERRIDE { |
| 35 test::AshTestBase::SetUp(); | 35 test::AshTestBase::SetUp(); |
| 36 Shell::GetInstance()->SetScreenWorkAreaInsets( | 36 Shell::GetInstance()->SetMonitorWorkAreaInsets( |
| 37 Shell::GetRootWindow(), |
| 37 gfx::Insets(1, 2, 3, 4)); | 38 gfx::Insets(1, 2, 3, 4)); |
| 38 Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); | 39 Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); |
| 39 aura::Window* default_container = Shell::GetInstance()->GetContainer( | 40 aura::Window* default_container = Shell::GetInstance()->GetContainer( |
| 40 internal::kShellWindowId_DefaultContainer); | 41 internal::kShellWindowId_DefaultContainer); |
| 41 layout_manager_ = new internal::ToplevelLayoutManager(); | 42 layout_manager_ = new internal::ToplevelLayoutManager(); |
| 42 default_container->SetLayoutManager(layout_manager_); | 43 default_container->SetLayoutManager(layout_manager_); |
| 43 } | 44 } |
| 44 | 45 |
| 45 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { | 46 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { |
| 46 return aura::test::CreateTestWindowWithBounds(bounds, NULL); | 47 return aura::test::CreateTestWindowWithBounds(bounds, NULL); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 window->bounds()); | 99 window->bounds()); |
| 99 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 100 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 100 EXPECT_EQ(bounds, window->bounds()); | 101 EXPECT_EQ(bounds, window->bounds()); |
| 101 } | 102 } |
| 102 | 103 |
| 103 // Tests maximized window resizing on work area insets change. | 104 // Tests maximized window resizing on work area insets change. |
| 104 TEST_F(ToplevelLayoutManagerTest, | 105 TEST_F(ToplevelLayoutManagerTest, |
| 105 ResizeMaximizedWindowOnWorkAreaInsetsChange) { | 106 ResizeMaximizedWindowOnWorkAreaInsetsChange) { |
| 106 gfx::Rect bounds(100, 100, 200, 200); | 107 gfx::Rect bounds(100, 100, 200, 200); |
| 107 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); | 108 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
| 108 Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets(0, 0, 30, 0)); | 109 Shell::GetInstance()->SetMonitorWorkAreaInsets( |
| 110 Shell::GetRootWindow(), |
| 111 gfx::Insets(0, 0, 30, 0)); |
| 109 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 112 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 110 // Maximized window fills the work area. | 113 // Maximized window fills the work area. |
| 111 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), | 114 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), |
| 112 window->bounds()); | 115 window->bounds()); |
| 113 | 116 |
| 114 // Change work area insets. | 117 // Change work area insets. |
| 115 Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets(0, 0, 60, 0)); | 118 Shell::GetInstance()->SetMonitorWorkAreaInsets( |
| 119 Shell::GetRootWindow(), |
| 120 gfx::Insets(0, 0, 60, 0)); |
| 116 // Maximized window fills the changed work area. | 121 // Maximized window fills the changed work area. |
| 117 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), | 122 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), |
| 118 window->bounds()); | 123 window->bounds()); |
| 119 } | 124 } |
| 120 | 125 |
| 121 // Tests fullscreen window size during root window resize. | 126 // Tests fullscreen window size during root window resize. |
| 122 TEST_F(ToplevelLayoutManagerTest, FullscreenRootWindowResize) { | 127 TEST_F(ToplevelLayoutManagerTest, FullscreenRootWindowResize) { |
| 123 gfx::Rect bounds(100, 100, 200, 200); | 128 gfx::Rect bounds(100, 100, 200, 200); |
| 124 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); | 129 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
| 125 // Fullscreen window fills the whole monitor. | 130 // Fullscreen window fills the whole monitor. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 window.reset(); | 225 window.reset(); |
| 221 // shelf_layout_manager is observing these animations so clean them up first. | 226 // shelf_layout_manager is observing these animations so clean them up first. |
| 222 launcher->GetNativeView()->layer()->GetAnimator()->StopAnimating(); | 227 launcher->GetNativeView()->layer()->GetAnimator()->StopAnimating(); |
| 223 status->GetNativeView()->layer()->GetAnimator()->StopAnimating(); | 228 status->GetNativeView()->layer()->GetAnimator()->StopAnimating(); |
| 224 shelf_layout_manager.reset(); | 229 shelf_layout_manager.reset(); |
| 225 } | 230 } |
| 226 | 231 |
| 227 } // namespace | 232 } // namespace |
| 228 | 233 |
| 229 } // namespace ash | 234 } // namespace ash |
| OLD | NEW |