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

Side by Side Diff: ash/mus/workspace/workspace_layout_manager_unittest.cc

Issue 2227643003: Converts mash to use the common non-client frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@native_widget_mus_fix
Patch Set: feedback 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/mus/window_manager.cc ('k') | mash/example/window_type_launcher/window_type_launcher.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/workspace/workspace_layout_manager.h" 5 #include "ash/common/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/wm/fullscreen_window_finder.h" 10 #include "ash/common/wm/fullscreen_window_finder.h"
11 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
12 #include "ash/common/wm/wm_event.h" 12 #include "ash/common/wm/wm_event.h"
13 #include "ash/common/wm/wm_screen_util.h" 13 #include "ash/common/wm/wm_screen_util.h"
14 #include "ash/common/wm_root_window_controller_observer.h" 14 #include "ash/common/wm_root_window_controller_observer.h"
15 #include "ash/mus/bridge/wm_root_window_controller_mus.h" 15 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
16 #include "ash/mus/bridge/wm_window_mus.h" 16 #include "ash/mus/bridge/wm_window_mus.h"
17 #include "ash/mus/bridge/wm_window_mus_test_api.h"
17 #include "ash/mus/test/wm_test_base.h" 18 #include "ash/mus/test/wm_test_base.h"
18 #include "base/run_loop.h" 19 #include "base/run_loop.h"
19 #include "services/ui/public/cpp/tests/test_window.h" 20 #include "services/ui/public/cpp/tests/test_window.h"
20 #include "ui/display/display.h" 21 #include "ui/display/display.h"
21 22
22 namespace ash { 23 namespace ash {
23 namespace mus { 24 namespace mus {
24 namespace { 25 namespace {
25 26
26 // TODO(sky): no tests for multiple displays yet: http://crbug.com/612627. 27 // TODO(sky): no tests for multiple displays yet: http://crbug.com/612627.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } // namespace 81 } // namespace
81 82
82 using WorkspaceLayoutManagerTest = WmTestBase; 83 using WorkspaceLayoutManagerTest = WmTestBase;
83 84
84 // Verifies that a window containing a restore coordinate will be restored to 85 // Verifies that a window containing a restore coordinate will be restored to
85 // to the size prior to minimize, keeping the restore rectangle in tact (if 86 // to the size prior to minimize, keeping the restore rectangle in tact (if
86 // there is one). 87 // there is one).
87 TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) { 88 TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) {
88 ui::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); 89 ui::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4));
89 WmWindow* window = WmWindowMus::Get(mus_window); 90 WmWindow* window = WmWindowMus::Get(mus_window);
91 WmWindowMusTestApi(window).set_use_empty_minimum_size(true);
90 gfx::Rect bounds(10, 15, 25, 35); 92 gfx::Rect bounds(10, 15, 25, 35);
91 window->SetBounds(bounds); 93 window->SetBounds(bounds);
92 94
93 wm::WindowState* window_state = window->GetWindowState(); 95 wm::WindowState* window_state = window->GetWindowState();
94 96
95 // This will not be used for un-minimizing window. 97 // This will not be used for un-minimizing window.
96 window_state->SetRestoreBoundsInScreen(gfx::Rect(0, 0, 100, 100)); 98 window_state->SetRestoreBoundsInScreen(gfx::Rect(0, 0, 100, 100));
97 window_state->Minimize(); 99 window_state->Minimize();
98 window_state->Restore(); 100 window_state->Restore();
99 EXPECT_EQ("0,0 100x100", window_state->GetRestoreBoundsInScreen().ToString()); 101 EXPECT_EQ("0,0 100x100", window_state->GetRestoreBoundsInScreen().ToString());
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 692
691 wm::WindowState* window_state = window->GetWindowState(); 693 wm::WindowState* window_state = window->GetWindowState();
692 window_state->SetRestoreBoundsInParent(gfx::Rect(10, 11, 12, 13)); 694 window_state->SetRestoreBoundsInParent(gfx::Rect(10, 11, 12, 13));
693 695
694 // Maximize it, which will keep the previous restore bounds. 696 // Maximize it, which will keep the previous restore bounds.
695 window->SetShowState(ui::SHOW_STATE_MAXIMIZED); 697 window->SetShowState(ui::SHOW_STATE_MAXIMIZED);
696 EXPECT_EQ("10,11 12x13", window_state->GetRestoreBoundsInParent().ToString()); 698 EXPECT_EQ("10,11 12x13", window_state->GetRestoreBoundsInParent().ToString());
697 } 699 }
698 700
699 // Verifies that the restore bounds do not get reset when restoring to a 701 // Verifies that the restore bounds do not get reset when restoring to a
700 // maximzied state from a minimized state. 702 // maximized state from a minimized state.
701 TEST_F(WorkspaceLayoutManagerSoloTest, 703 TEST_F(WorkspaceLayoutManagerSoloTest,
702 BoundsAfterRestoringToMaximizeFromMinimize) { 704 BoundsAfterRestoringToMaximizeFromMinimize) {
703 ui::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); 705 ui::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4));
704 WmWindow* window = WmWindowMus::Get(mus_window); 706 WmWindow* window = WmWindowMus::Get(mus_window);
707 WmWindowMusTestApi(window).set_use_empty_minimum_size(true);
705 gfx::Rect bounds(10, 15, 25, 35); 708 gfx::Rect bounds(10, 15, 25, 35);
706 window->SetBounds(bounds); 709 window->SetBounds(bounds);
707 710
708 wm::WindowState* window_state = window->GetWindowState(); 711 wm::WindowState* window_state = window->GetWindowState();
709 // Maximize it, which should reset restore bounds. 712 // Maximize it, which should reset restore bounds.
710 window_state->Maximize(); 713 window_state->Maximize();
711 EXPECT_EQ(bounds.ToString(), 714 EXPECT_EQ(bounds.ToString(),
712 window_state->GetRestoreBoundsInParent().ToString()); 715 window_state->GetRestoreBoundsInParent().ToString());
713 // Minimize the window. The restore bounds should not change. 716 // Minimize the window. The restore bounds should not change.
714 window_state->Minimize(); 717 window_state->Minimize();
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 occluded_window_bounds.width(), 1097 occluded_window_bounds.width(),
1095 occluded_window_bounds.height()).ToString(), 1098 occluded_window_bounds.height()).ToString(),
1096 window->bounds().ToString()); 1099 window->bounds().ToString());
1097 HideKeyboard(); 1100 HideKeyboard();
1098 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString()); 1101 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString());
1099 } 1102 }
1100 */ 1103 */
1101 1104
1102 } // namespace mus 1105 } // namespace mus
1103 } // namespace ash 1106 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager.cc ('k') | mash/example/window_type_launcher/window_type_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698