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 <utility> |
| 8 |
7 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 10 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_state.h" | 12 #include "ash/wm/window_state.h" |
11 #include "ash/wm/wm_event.h" | 13 #include "ash/wm/wm_event.h" |
12 #include "ui/aura/client/aura_constants.h" | 14 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/test/test_window_delegate.h" | 15 #include "ui/aura/test/test_window_delegate.h" |
14 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
15 | 17 |
16 namespace ash { | 18 namespace ash { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 window_state->GetStateType()))); | 301 window_state->GetStateType()))); |
300 EXPECT_TRUE(window_state->IsMaximized()); | 302 EXPECT_TRUE(window_state->IsMaximized()); |
301 } | 303 } |
302 | 304 |
303 // Test that the replacement of a state object, following a restore with the | 305 // Test that the replacement of a state object, following a restore with the |
304 // original one restores the window to its original state. | 306 // original one restores the window to its original state. |
305 TEST_F(WindowStateTest, StateSwapRestore) { | 307 TEST_F(WindowStateTest, StateSwapRestore) { |
306 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 308 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
307 WindowState* window_state = GetWindowState(window.get()); | 309 WindowState* window_state = GetWindowState(window.get()); |
308 EXPECT_FALSE(window_state->IsMaximized()); | 310 EXPECT_FALSE(window_state->IsMaximized()); |
309 scoped_ptr<WindowState::State> old(window_state->SetStateObject( | 311 scoped_ptr<WindowState::State> old( |
310 scoped_ptr<WindowState::State> (new AlwaysMaximizeTestState( | 312 window_state->SetStateObject(scoped_ptr<WindowState::State>( |
311 window_state->GetStateType()))).Pass()); | 313 new AlwaysMaximizeTestState(window_state->GetStateType())))); |
312 EXPECT_TRUE(window_state->IsMaximized()); | 314 EXPECT_TRUE(window_state->IsMaximized()); |
313 window_state->SetStateObject(old.Pass()); | 315 window_state->SetStateObject(std::move(old)); |
314 EXPECT_FALSE(window_state->IsMaximized()); | 316 EXPECT_FALSE(window_state->IsMaximized()); |
315 } | 317 } |
316 | 318 |
317 // Tests that a window that had same bounds as the work area shrinks after the | 319 // Tests that a window that had same bounds as the work area shrinks after the |
318 // window is maximized and then restored. | 320 // window is maximized and then restored. |
319 TEST_F(WindowStateTest, RestoredWindowBoundsShrink) { | 321 TEST_F(WindowStateTest, RestoredWindowBoundsShrink) { |
320 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 322 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
321 WindowState* window_state = GetWindowState(window.get()); | 323 WindowState* window_state = GetWindowState(window.get()); |
322 EXPECT_FALSE(window_state->IsMaximized()); | 324 EXPECT_FALSE(window_state->IsMaximized()); |
323 gfx::Rect work_area = | 325 gfx::Rect work_area = |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 | 363 |
362 // Exitting fullscreen will update the maximized widnow to the work area. | 364 // Exitting fullscreen will update the maximized widnow to the work area. |
363 EXPECT_EQ("0,0 900x653", maximized->GetBoundsInScreen().ToString()); | 365 EXPECT_EQ("0,0 900x653", maximized->GetBoundsInScreen().ToString()); |
364 } | 366 } |
365 | 367 |
366 // TODO(skuhne): Add more unit test to verify the correctness for the restore | 368 // TODO(skuhne): Add more unit test to verify the correctness for the restore |
367 // operation. | 369 // operation. |
368 | 370 |
369 } // namespace wm | 371 } // namespace wm |
370 } // namespace ash | 372 } // namespace ash |
OLD | NEW |