Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1177)

Side by Side Diff: ash/wm/window_state_unittest.cc

Issue 2250713006: Allow updating arc widget bounds in maximize/fullscreen state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/wm/window_state.h ('k') | components/exo/shell_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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);
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 window_state->set_allow_set_bounds_in_maximized(false);
403 window_state->Maximize();
404
405 EXPECT_TRUE(window_state->IsMaximized());
406 EXPECT_EQ(work_area, window->bounds());
407 window->SetBounds(new_bounds);
408 EXPECT_EQ(work_area, window->bounds());
409 }
410
378 // TODO(skuhne): Add more unit test to verify the correctness for the restore 411 // TODO(skuhne): Add more unit test to verify the correctness for the restore
379 // operation. 412 // operation.
380 413
381 } // namespace wm 414 } // namespace wm
382 } // namespace ash 415 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/window_state.h ('k') | components/exo/shell_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698