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

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

Issue 2542493002: Replace kCanMaximize/Minimize/Resize with kResizeBehavior. (Closed)
Patch Set: Fix int->bool compile issue. Created 4 years 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
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"
11 #include "ash/common/wm/wm_event.h" 11 #include "ash/common/wm/wm_event.h"
12 #include "ash/test/ash_md_test_base.h" 12 #include "ash/test/ash_md_test_base.h"
13 #include "ash/wm/window_state_aura.h" 13 #include "ash/wm/window_state_aura.h"
14 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
14 #include "ui/aura/client/aura_constants.h" 15 #include "ui/aura/client/aura_constants.h"
15 #include "ui/aura/test/test_window_delegate.h" 16 #include "ui/aura/test/test_window_delegate.h"
16 #include "ui/aura/window.h" 17 #include "ui/aura/window.h"
17 #include "ui/display/manager/display_manager.h" 18 #include "ui/display/manager/display_manager.h"
18 #include "ui/display/screen.h" 19 #include "ui/display/screen.h"
19 20
20 namespace ash { 21 namespace ash {
21 namespace wm { 22 namespace wm {
22 namespace { 23 namespace {
23 24
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 kWorkAreaBounds.width() - 1, kWorkAreaBounds.height()); 127 kWorkAreaBounds.width() - 1, kWorkAreaBounds.height());
127 EXPECT_EQ(expected.ToString(), window->GetBoundsInScreen().ToString()); 128 EXPECT_EQ(expected.ToString(), window->GetBoundsInScreen().ToString());
128 129
129 // It should not be possible to snap a window with a maximum size, or if it 130 // It should not be possible to snap a window with a maximum size, or if it
130 // cannot be maximized. 131 // cannot be maximized.
131 delegate.set_maximum_size(gfx::Size(kWorkAreaBounds.width() - 1, 0)); 132 delegate.set_maximum_size(gfx::Size(kWorkAreaBounds.width() - 1, 0));
132 EXPECT_FALSE(window_state->CanSnap()); 133 EXPECT_FALSE(window_state->CanSnap());
133 delegate.set_maximum_size(gfx::Size(0, kWorkAreaBounds.height() - 1)); 134 delegate.set_maximum_size(gfx::Size(0, kWorkAreaBounds.height() - 1));
134 EXPECT_FALSE(window_state->CanSnap()); 135 EXPECT_FALSE(window_state->CanSnap());
135 delegate.set_maximum_size(gfx::Size()); 136 delegate.set_maximum_size(gfx::Size());
136 window->SetProperty(aura::client::kCanMaximizeKey, false); 137 window->SetProperty(aura::client::kResizeBehaviorKey,
138 ui::mojom::kResizeBehaviorCanResize);
137 EXPECT_FALSE(window_state->CanSnap()); 139 EXPECT_FALSE(window_state->CanSnap());
138 } 140 }
139 141
140 // Test that the minimum size specified by aura::WindowDelegate gets respected. 142 // Test that the minimum size specified by aura::WindowDelegate gets respected.
141 TEST_P(WindowStateTest, TestRespectMinimumSize) { 143 TEST_P(WindowStateTest, TestRespectMinimumSize) {
142 UpdateDisplay("0+0-1024x768"); 144 UpdateDisplay("0+0-1024x768");
143 145
144 aura::test::TestWindowDelegate delegate; 146 aura::test::TestWindowDelegate delegate;
145 const gfx::Size minimum_size(gfx::Size(500, 300)); 147 const gfx::Size minimum_size(gfx::Size(500, 300));
146 delegate.set_minimum_size(minimum_size); 148 delegate.set_minimum_size(minimum_size);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 EXPECT_EQ(work_area, window->bounds()); 391 EXPECT_EQ(work_area, window->bounds());
390 window->SetBounds(new_bounds); 392 window->SetBounds(new_bounds);
391 EXPECT_EQ(work_area, window->bounds()); 393 EXPECT_EQ(work_area, window->bounds());
392 } 394 }
393 395
394 // TODO(skuhne): Add more unit test to verify the correctness for the restore 396 // TODO(skuhne): Add more unit test to verify the correctness for the restore
395 // operation. 397 // operation.
396 398
397 } // namespace wm 399 } // namespace wm
398 } // namespace ash 400 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/toplevel_window_event_handler_unittest.cc ('k') | ash/wm/workspace/workspace_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698