Chromium Code Reviews| 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/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 // Updating display size will update the maximum window size. | 368 // Updating display size will update the maximum window size. |
| 369 UpdateDisplay("900x700"); | 369 UpdateDisplay("900x700"); |
| 370 EXPECT_EQ("0,0 900x700", maximized->GetBoundsInScreen().ToString()); | 370 EXPECT_EQ("0,0 900x700", maximized->GetBoundsInScreen().ToString()); |
| 371 fullscreen.reset(); | 371 fullscreen.reset(); |
| 372 | 372 |
| 373 // Exiting fullscreen will update the maximized window to the work area. | 373 // Exiting fullscreen will update the maximized window to the work area. |
| 374 EXPECT_EQ(gfx::Rect(0, 0, 900, 653 + height_offset).ToString(), | 374 EXPECT_EQ(gfx::Rect(0, 0, 900, 653 + height_offset).ToString(), |
| 375 maximized->GetBoundsInScreen().ToString()); | 375 maximized->GetBoundsInScreen().ToString()); |
| 376 } | 376 } |
| 377 | 377 |
| 378 TEST_P(WindowStateTest, AllowSetBoundsInMaximized) { | |
| 379 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | |
| 380 WindowState* window_state = GetWindowState(window.get()); | |
| 381 EXPECT_FALSE(window_state->IsMaximized()); | |
| 382 gfx::Rect work_area = | |
| 383 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | |
| 384 gfx::Rect original_bounds(50, 50, 200, 200); | |
| 385 window->SetBounds(original_bounds); | |
| 386 ASSERT_EQ(original_bounds, window->bounds()); | |
| 387 | |
| 388 window_state->set_allow_set_bounds_in_maximized(true); | |
|
reveman
2016/08/11 19:07:25
can you test that restoring it to false after this
| |
| 389 window_state->Maximize(); | |
| 390 | |
| 391 EXPECT_TRUE(window_state->IsMaximized()); | |
| 392 EXPECT_EQ(work_area, window->bounds()); | |
| 393 | |
| 394 gfx::Rect new_bounds(10, 10, 300, 300); | |
| 395 window->SetBounds(new_bounds); | |
| 396 EXPECT_EQ(new_bounds, window->bounds()); | |
| 397 | |
| 398 window_state->Restore(); | |
| 399 EXPECT_FALSE(window_state->IsMaximized()); | |
| 400 EXPECT_EQ(original_bounds, window->bounds()); | |
| 401 } | |
| 402 | |
| 378 // TODO(skuhne): Add more unit test to verify the correctness for the restore | 403 // TODO(skuhne): Add more unit test to verify the correctness for the restore |
| 379 // operation. | 404 // operation. |
| 380 | 405 |
| 381 } // namespace wm | 406 } // namespace wm |
| 382 } // namespace ash | 407 } // namespace ash |
| OLD | NEW |