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