| 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/base_layout_manager.h" | 5 #include "ash/wm/base_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 gfx::Rect bounds(100, 100, 200, 200); | 50 gfx::Rect bounds(100, 100, 200, 200); |
| 51 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); | 51 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
| 52 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 52 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 53 // Maximized window fills the work area, not the whole monitor. | 53 // Maximized window fills the work area, not the whole monitor. |
| 54 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), | 54 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), |
| 55 window->bounds()); | 55 window->bounds()); |
| 56 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 56 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 57 EXPECT_EQ(bounds, window->bounds()); | 57 EXPECT_EQ(bounds, window->bounds()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Tests normal->minimize->normal. |
| 61 TEST_F(BaseLayoutManagerTest, Minimize) { |
| 62 gfx::Rect bounds(100, 100, 200, 200); |
| 63 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
| 64 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 65 // Note: Currently minimize doesn't do anything except set the state. |
| 66 // See crbug.com/104571. |
| 67 EXPECT_EQ(bounds, window->bounds()); |
| 68 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 69 EXPECT_EQ(bounds, window->bounds()); |
| 70 } |
| 71 |
| 60 // Tests maximized window size during root window resize. | 72 // Tests maximized window size during root window resize. |
| 61 TEST_F(BaseLayoutManagerTest, MaximizeRootWindowResize) { | 73 TEST_F(BaseLayoutManagerTest, MaximizeRootWindowResize) { |
| 62 gfx::Rect bounds(100, 100, 200, 200); | 74 gfx::Rect bounds(100, 100, 200, 200); |
| 63 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); | 75 scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); |
| 64 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 76 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 65 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), | 77 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), |
| 66 window->bounds()); | 78 window->bounds()); |
| 67 // Enlarge the root window. We should still match the work area size. | 79 // Enlarge the root window. We should still match the work area size. |
| 68 Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); | 80 Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); |
| 69 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), | 81 EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // Enlarging the root window does not change the window bounds. | 140 // Enlarging the root window does not change the window bounds. |
| 129 gfx::Rect old_bounds = window->bounds(); | 141 gfx::Rect old_bounds = window->bounds(); |
| 130 Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); | 142 Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); |
| 131 EXPECT_EQ(old_bounds.width(), window->bounds().width()); | 143 EXPECT_EQ(old_bounds.width(), window->bounds().width()); |
| 132 EXPECT_EQ(old_bounds.height(), window->bounds().height()); | 144 EXPECT_EQ(old_bounds.height(), window->bounds().height()); |
| 133 } | 145 } |
| 134 | 146 |
| 135 } // namespace | 147 } // namespace |
| 136 | 148 |
| 137 } // namespace ash | 149 } // namespace ash |
| OLD | NEW |