OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/window_state.h" | 5 #include "ash/wm/window_state.h" |
6 | 6 |
7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 WindowState* window_state = GetWindowState(window.get()); | 305 WindowState* window_state = GetWindowState(window.get()); |
306 EXPECT_FALSE(window_state->IsMaximized()); | 306 EXPECT_FALSE(window_state->IsMaximized()); |
307 scoped_ptr<WindowState::State> old(window_state->SetStateObject( | 307 scoped_ptr<WindowState::State> old(window_state->SetStateObject( |
308 scoped_ptr<WindowState::State> (new AlwaysMaximizeTestState( | 308 scoped_ptr<WindowState::State> (new AlwaysMaximizeTestState( |
309 window_state->GetStateType()))).Pass()); | 309 window_state->GetStateType()))).Pass()); |
310 EXPECT_TRUE(window_state->IsMaximized()); | 310 EXPECT_TRUE(window_state->IsMaximized()); |
311 window_state->SetStateObject(old.Pass()); | 311 window_state->SetStateObject(old.Pass()); |
312 EXPECT_FALSE(window_state->IsMaximized()); | 312 EXPECT_FALSE(window_state->IsMaximized()); |
313 } | 313 } |
314 | 314 |
| 315 // Tests that a window that had same bounds as the work area shrinks after the |
| 316 // window is maximized and then restored. |
| 317 TEST_F(WindowStateTest, RestoredWindowBoundsShrink) { |
| 318 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| 319 WindowState* window_state = GetWindowState(window.get()); |
| 320 EXPECT_FALSE(window_state->IsMaximized()); |
| 321 gfx::Rect work_area = |
| 322 ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); |
| 323 |
| 324 window->SetBounds(work_area); |
| 325 window_state->Maximize(); |
| 326 EXPECT_TRUE(window_state->IsMaximized()); |
| 327 EXPECT_EQ(work_area.ToString(), window->bounds().ToString()); |
| 328 |
| 329 window_state->Restore(); |
| 330 EXPECT_FALSE(window_state->IsMaximized()); |
| 331 EXPECT_NE(work_area.ToString(), window->bounds().ToString()); |
| 332 EXPECT_TRUE(work_area.Contains(window->bounds())); |
| 333 } |
| 334 |
315 // TODO(skuhne): Add more unit test to verify the correctness for the restore | 335 // TODO(skuhne): Add more unit test to verify the correctness for the restore |
316 // operation. | 336 // operation. |
317 | 337 |
318 } // namespace wm | 338 } // namespace wm |
319 } // namespace ash | 339 } // namespace ash |
OLD | NEW |