| 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/common/wm/window_state.h" | 5 #include "ash/common/wm/window_state.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
| 10 #include "ash/common/wm/window_state_util.h" | 10 #include "ash/common/wm/window_state_util.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 369 |
| 370 // Update display triggers workspace event. | 370 // Update display triggers workspace event. |
| 371 UpdateDisplay("300x200"); | 371 UpdateDisplay("300x200"); |
| 372 EXPECT_EQ("0,0 300x200", window->GetBoundsInScreen().ToString()); | 372 EXPECT_EQ("0,0 300x200", window->GetBoundsInScreen().ToString()); |
| 373 | 373 |
| 374 // Unpin should work. | 374 // Unpin should work. |
| 375 window_state->Restore(); | 375 window_state->Restore(); |
| 376 EXPECT_FALSE(window_state->IsTrustedPinned()); | 376 EXPECT_FALSE(window_state->IsTrustedPinned()); |
| 377 } | 377 } |
| 378 | 378 |
| 379 TEST_F(WindowStateTest, AllowSetBoundsInMaximized) { | 379 TEST_F(WindowStateTest, AllowSetBoundsDirect) { |
| 380 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 380 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| 381 WindowState* window_state = GetWindowState(window.get()); | 381 WindowState* window_state = GetWindowState(window.get()); |
| 382 EXPECT_FALSE(window_state->IsMaximized()); | 382 EXPECT_FALSE(window_state->IsMaximized()); |
| 383 gfx::Rect work_area = | 383 gfx::Rect work_area = |
| 384 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | 384 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
| 385 gfx::Rect original_bounds(50, 50, 200, 200); | 385 gfx::Rect original_bounds(50, 50, 200, 200); |
| 386 window->SetBounds(original_bounds); | 386 window->SetBounds(original_bounds); |
| 387 ASSERT_EQ(original_bounds, window->bounds()); | 387 ASSERT_EQ(original_bounds, window->bounds()); |
| 388 | 388 |
| 389 window_state->set_allow_set_bounds_in_maximized(true); | 389 window_state->set_allow_set_bounds_direct(true); |
| 390 window_state->Maximize(); | 390 window_state->Maximize(); |
| 391 | 391 |
| 392 EXPECT_TRUE(window_state->IsMaximized()); | 392 EXPECT_TRUE(window_state->IsMaximized()); |
| 393 EXPECT_EQ(work_area, window->bounds()); | 393 EXPECT_EQ(work_area, window->bounds()); |
| 394 | 394 |
| 395 gfx::Rect new_bounds(10, 10, 300, 300); | 395 gfx::Rect new_bounds(10, 10, 300, 300); |
| 396 window->SetBounds(new_bounds); | 396 window->SetBounds(new_bounds); |
| 397 EXPECT_EQ(new_bounds, window->bounds()); | 397 EXPECT_EQ(new_bounds, window->bounds()); |
| 398 | 398 |
| 399 window_state->Restore(); | 399 window_state->Restore(); |
| 400 EXPECT_FALSE(window_state->IsMaximized()); | 400 EXPECT_FALSE(window_state->IsMaximized()); |
| 401 EXPECT_EQ(original_bounds, window->bounds()); | 401 EXPECT_EQ(original_bounds, window->bounds()); |
| 402 | 402 |
| 403 window_state->set_allow_set_bounds_in_maximized(false); | 403 window_state->set_allow_set_bounds_direct(false); |
| 404 window_state->Maximize(); | 404 window_state->Maximize(); |
| 405 | 405 |
| 406 EXPECT_TRUE(window_state->IsMaximized()); | 406 EXPECT_TRUE(window_state->IsMaximized()); |
| 407 EXPECT_EQ(work_area, window->bounds()); | 407 EXPECT_EQ(work_area, window->bounds()); |
| 408 window->SetBounds(new_bounds); | 408 window->SetBounds(new_bounds); |
| 409 EXPECT_EQ(work_area, window->bounds()); | 409 EXPECT_EQ(work_area, window->bounds()); |
| 410 } | 410 } |
| 411 | 411 |
| 412 TEST_F(WindowStateTest, FullscreenMinimizedSwitching) { | 412 TEST_F(WindowStateTest, FullscreenMinimizedSwitching) { |
| 413 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 413 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 // return to the state before minimizing and fullscreen. | 457 // return to the state before minimizing and fullscreen. |
| 458 ash::wm::ToggleFullScreen(window_state, nullptr); | 458 ash::wm::ToggleFullScreen(window_state, nullptr); |
| 459 ASSERT_TRUE(window_state->IsMaximized()); | 459 ASSERT_TRUE(window_state->IsMaximized()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 // TODO(skuhne): Add more unit test to verify the correctness for the restore | 462 // TODO(skuhne): Add more unit test to verify the correctness for the restore |
| 463 // operation. | 463 // operation. |
| 464 | 464 |
| 465 } // namespace wm | 465 } // namespace wm |
| 466 } // namespace ash | 466 } // namespace ash |
| OLD | NEW |