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

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

Issue 2029883002: Moves mash/wm into ash/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_static_assert
Patch Set: move comment Created 4 years, 6 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_unittest.cc ('k') | chrome/app/mash/BUILD.gn » ('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_root_window_controller_observer.h" 13 #include "ash/common/wm/wm_root_window_controller_observer.h"
14 #include "ash/common/wm/wm_screen_util.h" 14 #include "ash/common/wm/wm_screen_util.h"
15 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
16 #include "ash/mus/bridge/wm_window_mus.h"
17 #include "ash/mus/test/wm_test_base.h"
15 #include "components/mus/public/cpp/tests/test_window.h" 18 #include "components/mus/public/cpp/tests/test_window.h"
16 #include "mash/wm/bridge/wm_root_window_controller_mus.h"
17 #include "mash/wm/bridge/wm_window_mus.h"
18 #include "mash/wm/test/wm_test_base.h"
19 #include "ui/display/display.h" 19 #include "ui/display/display.h"
20 20
21 namespace mash { 21 namespace ash {
22 namespace wm { 22 namespace mus {
23 namespace { 23 namespace {
24 24
25 // TODO(sky): no tests for multiple displays yet: http://crbug.com/612627. 25 // TODO(sky): no tests for multiple displays yet: http://crbug.com/612627.
26 /* 26 /*
27 class MaximizeDelegateView : public views::WidgetDelegateView { 27 class MaximizeDelegateView : public views::WidgetDelegateView {
28 public: 28 public:
29 explicit MaximizeDelegateView(const gfx::Rect& initial_bounds) 29 explicit MaximizeDelegateView(const gfx::Rect& initial_bounds)
30 : initial_bounds_(initial_bounds) { 30 : initial_bounds_(initial_bounds) {
31 } 31 }
32 ~MaximizeDelegateView() override {} 32 ~MaximizeDelegateView() override {}
33 33
34 bool GetSavedWindowPlacement(const views::Widget* widget, 34 bool GetSavedWindowPlacement(const views::Widget* widget,
35 gfx::Rect* bounds, 35 gfx::Rect* bounds,
36 ui::WindowShowState* show_state) const override { 36 ui::WindowShowState* show_state) const override {
37 *bounds = initial_bounds_; 37 *bounds = initial_bounds_;
38 *show_state = ui::SHOW_STATE_MAXIMIZED; 38 *show_state = ui::SHOW_STATE_MAXIMIZED;
39 return true; 39 return true;
40 } 40 }
41 41
42 private: 42 private:
43 const gfx::Rect initial_bounds_; 43 const gfx::Rect initial_bounds_;
44 44
45 DISALLOW_COPY_AND_ASSIGN(MaximizeDelegateView); 45 DISALLOW_COPY_AND_ASSIGN(MaximizeDelegateView);
46 }; 46 };
47 */ 47 */
48 48
49 class FullscreenObserver : public ash::wm::WmRootWindowControllerObserver { 49 class FullscreenObserver : public wm::WmRootWindowControllerObserver {
50 public: 50 public:
51 explicit FullscreenObserver( 51 explicit FullscreenObserver(
52 ash::wm::WmRootWindowController* root_window_controller) 52 wm::WmRootWindowController* root_window_controller)
53 : root_window_controller_(root_window_controller), 53 : root_window_controller_(root_window_controller),
54 call_count_(0), 54 call_count_(0),
55 is_fullscreen_(false) { 55 is_fullscreen_(false) {
56 root_window_controller_->AddObserver(this); 56 root_window_controller_->AddObserver(this);
57 } 57 }
58 58
59 ~FullscreenObserver() override { 59 ~FullscreenObserver() override {
60 root_window_controller_->RemoveObserver(this); 60 root_window_controller_->RemoveObserver(this);
61 } 61 }
62 62
63 void OnFullscreenStateChanged(bool is_fullscreen) override { 63 void OnFullscreenStateChanged(bool is_fullscreen) override {
64 call_count_++; 64 call_count_++;
65 is_fullscreen_ = is_fullscreen; 65 is_fullscreen_ = is_fullscreen;
66 } 66 }
67 67
68 int call_count() const { return call_count_; } 68 int call_count() const { return call_count_; }
69 69
70 bool is_fullscreen() const { return is_fullscreen_; } 70 bool is_fullscreen() const { return is_fullscreen_; }
71 71
72 private: 72 private:
73 ash::wm::WmRootWindowController* root_window_controller_; 73 wm::WmRootWindowController* root_window_controller_;
74 int call_count_; 74 int call_count_;
75 bool is_fullscreen_; 75 bool is_fullscreen_;
76 76
77 DISALLOW_COPY_AND_ASSIGN(FullscreenObserver); 77 DISALLOW_COPY_AND_ASSIGN(FullscreenObserver);
78 }; 78 };
79 79
80 } // namespace 80 } // namespace
81 81
82 using WorkspaceLayoutManagerTest = WmTestBase; 82 using WorkspaceLayoutManagerTest = WmTestBase;
83 83
84 // Verifies that a window containing a restore coordinate will be restored to 84 // 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 85 // to the size prior to minimize, keeping the restore rectangle in tact (if
86 // there is one). 86 // there is one).
87 TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) { 87 TEST_F(WorkspaceLayoutManagerTest, RestoreFromMinimizeKeepsRestore) {
88 mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); 88 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4));
89 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 89 wm::WmWindow* window = WmWindowMus::Get(mus_window);
90 gfx::Rect bounds(10, 15, 25, 35); 90 gfx::Rect bounds(10, 15, 25, 35);
91 window->SetBounds(bounds); 91 window->SetBounds(bounds);
92 92
93 ash::wm::WindowState* window_state = window->GetWindowState(); 93 wm::WindowState* window_state = window->GetWindowState();
94 94
95 // This will not be used for un-minimizing window. 95 // This will not be used for un-minimizing window.
96 window_state->SetRestoreBoundsInScreen(gfx::Rect(0, 0, 100, 100)); 96 window_state->SetRestoreBoundsInScreen(gfx::Rect(0, 0, 100, 100));
97 window_state->Minimize(); 97 window_state->Minimize();
98 window_state->Restore(); 98 window_state->Restore();
99 EXPECT_EQ("0,0 100x100", window_state->GetRestoreBoundsInScreen().ToString()); 99 EXPECT_EQ("0,0 100x100", window_state->GetRestoreBoundsInScreen().ToString());
100 EXPECT_EQ("10,15 25x35", mus_window->bounds().ToString()); 100 EXPECT_EQ("10,15 25x35", mus_window->bounds().ToString());
101 101
102 if (!SupportsMultipleDisplays()) 102 if (!SupportsMultipleDisplays())
103 return; 103 return;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 CreateTestWindowInShellWithBounds(gfx::Rect(10, -600, 200, 200))); 142 CreateTestWindowInShellWithBounds(gfx::Rect(10, -600, 200, 200)));
143 EXPECT_EQ("10,-500 200x200", window2->GetBoundsInScreen().ToString()); 143 EXPECT_EQ("10,-500 200x200", window2->GetBoundsInScreen().ToString());
144 } 144 }
145 */ 145 */
146 146
147 TEST_F(WorkspaceLayoutManagerTest, NoMinimumVisibilityForPopupWindows) { 147 TEST_F(WorkspaceLayoutManagerTest, NoMinimumVisibilityForPopupWindows) {
148 UpdateDisplay("300x400"); 148 UpdateDisplay("300x400");
149 149
150 // Create a popup window out of display boundaries and make sure it is not 150 // Create a popup window out of display boundaries and make sure it is not
151 // moved to have minimum visibility. 151 // moved to have minimum visibility.
152 mus::Window* mus_window = 152 ::mus::Window* mus_window =
153 CreateTestWindow(gfx::Rect(400, 100, 50, 50), ui::wm::WINDOW_TYPE_POPUP); 153 CreateTestWindow(gfx::Rect(400, 100, 50, 50), ui::wm::WINDOW_TYPE_POPUP);
154 WmWindowMus* window = WmWindowMus::Get(mus_window); 154 WmWindowMus* window = WmWindowMus::Get(mus_window);
155 EXPECT_EQ("400,100 50x50", window->GetBoundsInScreen().ToString()); 155 EXPECT_EQ("400,100 50x50", window->GetBoundsInScreen().ToString());
156 } 156 }
157 157
158 /* 158 /*
159 TEST_F(WorkspaceLayoutManagerTest, KeepRestoredWindowInDisplay) { 159 TEST_F(WorkspaceLayoutManagerTest, KeepRestoredWindowInDisplay) {
160 if (!SupportsHostWindowResize()) 160 if (!SupportsHostWindowResize())
161 return; 161 return;
162 std::unique_ptr<aura::Window> window( 162 std::unique_ptr<aura::Window> window(
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 window_observer.set_window(window2.get()); 344 window_observer.set_window(window2.get());
345 window_state->Maximize(); 345 window_state->Maximize();
346 EXPECT_EQ("10,20 30x40", 346 EXPECT_EQ("10,20 30x40",
347 window_state->GetRestoreBoundsInScreen().ToString()); 347 window_state->GetRestoreBoundsInScreen().ToString());
348 window->RemoveObserver(&window_observer); 348 window->RemoveObserver(&window_observer);
349 } 349 }
350 */ 350 */
351 351
352 // Verifies when a window is maximized all descendant windows have a size. 352 // Verifies when a window is maximized all descendant windows have a size.
353 TEST_F(WorkspaceLayoutManagerTest, ChildBoundsResetOnMaximize) { 353 TEST_F(WorkspaceLayoutManagerTest, ChildBoundsResetOnMaximize) {
354 mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40)); 354 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40));
355 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 355 wm::WmWindow* window = WmWindowMus::Get(mus_window);
356 356
357 ash::wm::WindowState* window_state = window->GetWindowState(); 357 wm::WindowState* window_state = window->GetWindowState();
358 window_state->Activate(); 358 window_state->Activate();
359 mus::Window* child_window = 359 ::mus::Window* child_window =
360 CreateChildTestWindow(mus_window, gfx::Rect(5, 6, 7, 8)); 360 CreateChildTestWindow(mus_window, gfx::Rect(5, 6, 7, 8));
361 window_state->Maximize(); 361 window_state->Maximize();
362 EXPECT_EQ("5,6 7x8", child_window->bounds().ToString()); 362 EXPECT_EQ("5,6 7x8", child_window->bounds().ToString());
363 } 363 }
364 364
365 // Verifies a window created with maximized state has the maximized 365 // Verifies a window created with maximized state has the maximized
366 // bounds. 366 // bounds.
367 TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) { 367 TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) {
368 mus::Window* mus_window = CreateTestWindow(gfx::Rect()); 368 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect());
369 WmWindowMus* window = WmWindowMus::Get(mus_window); 369 WmWindowMus* window = WmWindowMus::Get(mus_window);
370 window->GetWindowState()->Maximize(); 370 window->GetWindowState()->Maximize();
371 gfx::Rect work_area(GetPrimaryDisplay().work_area()); 371 gfx::Rect work_area(GetPrimaryDisplay().work_area());
372 EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString()); 372 EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString());
373 } 373 }
374 374
375 TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) { 375 TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) {
376 // Normal window bounds shouldn't be changed. 376 // Normal window bounds shouldn't be changed.
377 gfx::Rect window_bounds(100, 100, 200, 200); 377 gfx::Rect window_bounds(100, 100, 200, 200);
378 mus::Window* mus_window = CreateTestWindow(window_bounds); 378 ::mus::Window* mus_window = CreateTestWindow(window_bounds);
379 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 379 wm::WmWindow* window = WmWindowMus::Get(mus_window);
380 EXPECT_EQ(window_bounds, mus_window->bounds()); 380 EXPECT_EQ(window_bounds, mus_window->bounds());
381 381
382 // If the window is out of the workspace, it would be moved on screen. 382 // If the window is out of the workspace, it would be moved on screen.
383 gfx::Rect root_window_bounds = GetPrimaryRootWindow()->bounds(); 383 gfx::Rect root_window_bounds = GetPrimaryRootWindow()->bounds();
384 window_bounds.Offset(root_window_bounds.width(), root_window_bounds.height()); 384 window_bounds.Offset(root_window_bounds.width(), root_window_bounds.height());
385 ASSERT_FALSE(window_bounds.Intersects(root_window_bounds)); 385 ASSERT_FALSE(window_bounds.Intersects(root_window_bounds));
386 mus::Window* out_mus_window = CreateTestWindow(window_bounds); 386 ::mus::Window* out_mus_window = CreateTestWindow(window_bounds);
387 ash::wm::WmWindow* out_window = WmWindowMus::Get(out_mus_window); 387 wm::WmWindow* out_window = WmWindowMus::Get(out_mus_window);
388 EXPECT_EQ(window_bounds.size(), out_mus_window->bounds().size()); 388 EXPECT_EQ(window_bounds.size(), out_mus_window->bounds().size());
389 gfx::Rect bounds = out_mus_window->bounds(); 389 gfx::Rect bounds = out_mus_window->bounds();
390 bounds.Intersect(root_window_bounds); 390 bounds.Intersect(root_window_bounds);
391 391
392 // 30% of the window edge must be visible. 392 // 30% of the window edge must be visible.
393 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29); 393 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29);
394 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29); 394 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29);
395 395
396 mus::Window* mus_parent = out_mus_window->parent(); 396 ::mus::Window* mus_parent = out_mus_window->parent();
397 mus_parent->RemoveChild(out_mus_window); 397 mus_parent->RemoveChild(out_mus_window);
398 out_window->SetBounds(gfx::Rect(-200, -200, 200, 200)); 398 out_window->SetBounds(gfx::Rect(-200, -200, 200, 200));
399 // UserHasChangedWindowPositionOrSize flag shouldn't turn off this behavior. 399 // UserHasChangedWindowPositionOrSize flag shouldn't turn off this behavior.
400 window->GetWindowState()->set_bounds_changed_by_user(true); 400 window->GetWindowState()->set_bounds_changed_by_user(true);
401 mus_parent->AddChild(out_mus_window); 401 mus_parent->AddChild(out_mus_window);
402 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29); 402 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29);
403 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29); 403 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29);
404 404
405 // Make sure we always make more than 1/3 of the window edge visible even 405 // Make sure we always make more than 1/3 of the window edge visible even
406 // if the initial bounds intersects with display. 406 // if the initial bounds intersects with display.
407 window_bounds.SetRect(-150, -150, 200, 200); 407 window_bounds.SetRect(-150, -150, 200, 200);
408 bounds = window_bounds; 408 bounds = window_bounds;
409 bounds.Intersect(root_window_bounds); 409 bounds.Intersect(root_window_bounds);
410 410
411 // Make sure that the initial bounds' visible area is less than 26% 411 // Make sure that the initial bounds' visible area is less than 26%
412 // so that the auto adjustment logic kicks in. 412 // so that the auto adjustment logic kicks in.
413 ASSERT_LT(bounds.width(), out_mus_window->bounds().width() * 0.26); 413 ASSERT_LT(bounds.width(), out_mus_window->bounds().width() * 0.26);
414 ASSERT_LT(bounds.height(), out_mus_window->bounds().height() * 0.26); 414 ASSERT_LT(bounds.height(), out_mus_window->bounds().height() * 0.26);
415 ASSERT_TRUE(window_bounds.Intersects(root_window_bounds)); 415 ASSERT_TRUE(window_bounds.Intersects(root_window_bounds));
416 416
417 mus::Window* partially_out_mus_window = CreateTestWindow(window_bounds); 417 ::mus::Window* partially_out_mus_window = CreateTestWindow(window_bounds);
418 EXPECT_EQ(window_bounds.size(), partially_out_mus_window->bounds().size()); 418 EXPECT_EQ(window_bounds.size(), partially_out_mus_window->bounds().size());
419 bounds = partially_out_mus_window->bounds(); 419 bounds = partially_out_mus_window->bounds();
420 bounds.Intersect(root_window_bounds); 420 bounds.Intersect(root_window_bounds);
421 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29); 421 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29);
422 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29); 422 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29);
423 423
424 // Make sure the window whose 30% width/height is bigger than display 424 // Make sure the window whose 30% width/height is bigger than display
425 // will be placed correctly. 425 // will be placed correctly.
426 window_bounds.SetRect(-1900, -1900, 3000, 3000); 426 window_bounds.SetRect(-1900, -1900, 3000, 3000);
427 mus::Window* mus_window_bigger_than_display = CreateTestWindow(window_bounds); 427 ::mus::Window* mus_window_bigger_than_display =
428 CreateTestWindow(window_bounds);
428 EXPECT_GE(root_window_bounds.width(), 429 EXPECT_GE(root_window_bounds.width(),
429 mus_window_bigger_than_display->bounds().width()); 430 mus_window_bigger_than_display->bounds().width());
430 EXPECT_GE(root_window_bounds.height(), 431 EXPECT_GE(root_window_bounds.height(),
431 mus_window_bigger_than_display->bounds().height()); 432 mus_window_bigger_than_display->bounds().height());
432 433
433 bounds = mus_window_bigger_than_display->bounds(); 434 bounds = mus_window_bigger_than_display->bounds();
434 bounds.Intersect(root_window_bounds); 435 bounds.Intersect(root_window_bounds);
435 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29); 436 EXPECT_GT(bounds.width(), out_mus_window->bounds().width() * 0.29);
436 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29); 437 EXPECT_GT(bounds.height(), out_mus_window->bounds().height() * 0.29);
437 } 438 }
438 439
439 // Verifies the size of a window is enforced to be smaller than the work area. 440 // Verifies the size of a window is enforced to be smaller than the work area.
440 TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) { 441 TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) {
441 // Normal window bounds shouldn't be changed. 442 // Normal window bounds shouldn't be changed.
442 gfx::Size work_area(GetPrimaryDisplay().work_area().size()); 443 gfx::Size work_area(GetPrimaryDisplay().work_area().size());
443 const gfx::Rect window_bounds(100, 101, work_area.width() + 1, 444 const gfx::Rect window_bounds(100, 101, work_area.width() + 1,
444 work_area.height() + 2); 445 work_area.height() + 2);
445 mus::Window* window = CreateTestWindow(window_bounds); 446 ::mus::Window* window = CreateTestWindow(window_bounds);
446 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), 447 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(),
447 window->bounds().ToString()); 448 window->bounds().ToString());
448 449
449 // Directly setting the bounds triggers a slightly different code path. Verify 450 // Directly setting the bounds triggers a slightly different code path. Verify
450 // that too. 451 // that too.
451 WmWindowMus::Get(window)->SetBounds(window_bounds); 452 WmWindowMus::Get(window)->SetBounds(window_bounds);
452 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(), 453 EXPECT_EQ(gfx::Rect(gfx::Point(100, 101), work_area).ToString(),
453 window->bounds().ToString()); 454 window->bounds().ToString());
454 } 455 }
455 456
456 TEST_F(WorkspaceLayoutManagerTest, NotifyFullscreenChanges) { 457 TEST_F(WorkspaceLayoutManagerTest, NotifyFullscreenChanges) {
457 FullscreenObserver observer( 458 FullscreenObserver observer(
458 WmWindowMus::Get(GetPrimaryRootWindow())->GetRootWindowController()); 459 WmWindowMus::Get(GetPrimaryRootWindow())->GetRootWindowController());
459 mus::Window* window1 = CreateTestWindow(gfx::Rect(1, 2, 30, 40)); 460 ::mus::Window* window1 = CreateTestWindow(gfx::Rect(1, 2, 30, 40));
460 mus::Window* window2 = CreateTestWindow(gfx::Rect(1, 2, 30, 40)); 461 ::mus::Window* window2 = CreateTestWindow(gfx::Rect(1, 2, 30, 40));
461 ash::wm::WindowState* window_state1 = 462 wm::WindowState* window_state1 = WmWindowMus::Get(window1)->GetWindowState();
462 WmWindowMus::Get(window1)->GetWindowState(); 463 wm::WindowState* window_state2 = WmWindowMus::Get(window2)->GetWindowState();
463 ash::wm::WindowState* window_state2 =
464 WmWindowMus::Get(window2)->GetWindowState();
465 window_state2->Activate(); 464 window_state2->Activate();
466 465
467 const ash::wm::WMEvent toggle_fullscreen_event( 466 const wm::WMEvent toggle_fullscreen_event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
468 ash::wm::WM_EVENT_TOGGLE_FULLSCREEN);
469 window_state2->OnWMEvent(&toggle_fullscreen_event); 467 window_state2->OnWMEvent(&toggle_fullscreen_event);
470 EXPECT_EQ(1, observer.call_count()); 468 EXPECT_EQ(1, observer.call_count());
471 EXPECT_TRUE(observer.is_fullscreen()); 469 EXPECT_TRUE(observer.is_fullscreen());
472 470
473 // When window1 moves to the front the fullscreen state should change. 471 // When window1 moves to the front the fullscreen state should change.
474 window_state1->Activate(); 472 window_state1->Activate();
475 EXPECT_EQ(2, observer.call_count()); 473 EXPECT_EQ(2, observer.call_count());
476 EXPECT_FALSE(observer.is_fullscreen()); 474 EXPECT_FALSE(observer.is_fullscreen());
477 475
478 // It should change back if window2 becomes active again. 476 // It should change back if window2 becomes active again.
(...skipping 13 matching lines...) Expand all
492 window2->Destroy(); 490 window2->Destroy();
493 EXPECT_EQ(6, observer.call_count()); 491 EXPECT_EQ(6, observer.call_count());
494 EXPECT_FALSE(observer.is_fullscreen()); 492 EXPECT_FALSE(observer.is_fullscreen());
495 } 493 }
496 // Following "Solo" tests were originally written for BaseLayoutManager. 494 // Following "Solo" tests were originally written for BaseLayoutManager.
497 using WorkspaceLayoutManagerSoloTest = WmTestBase; 495 using WorkspaceLayoutManagerSoloTest = WmTestBase;
498 496
499 // Tests normal->maximize->normal. 497 // Tests normal->maximize->normal.
500 TEST_F(WorkspaceLayoutManagerSoloTest, Maximize) { 498 TEST_F(WorkspaceLayoutManagerSoloTest, Maximize) {
501 gfx::Rect bounds(100, 100, 200, 200); 499 gfx::Rect bounds(100, 100, 200, 200);
502 mus::Window* mus_window = CreateTestWindow(bounds); 500 ::mus::Window* mus_window = CreateTestWindow(bounds);
503 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 501 wm::WmWindow* window = WmWindowMus::Get(mus_window);
504 window->SetShowState(ui::SHOW_STATE_MAXIMIZED); 502 window->SetShowState(ui::SHOW_STATE_MAXIMIZED);
505 // Maximized window fills the work area, not the whole display. 503 // Maximized window fills the work area, not the whole display.
506 EXPECT_EQ(ash::wm::GetMaximizedWindowBoundsInParent(window).ToString(), 504 EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(),
507 mus_window->bounds().ToString()); 505 mus_window->bounds().ToString());
508 window->SetShowState(ui::SHOW_STATE_NORMAL); 506 window->SetShowState(ui::SHOW_STATE_NORMAL);
509 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString()); 507 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString());
510 } 508 }
511 509
512 // Tests normal->minimize->normal. 510 // Tests normal->minimize->normal.
513 TEST_F(WorkspaceLayoutManagerSoloTest, Minimize) { 511 TEST_F(WorkspaceLayoutManagerSoloTest, Minimize) {
514 gfx::Rect bounds(100, 100, 200, 200); 512 gfx::Rect bounds(100, 100, 200, 200);
515 mus::Window* mus_window = CreateTestWindow(bounds); 513 ::mus::Window* mus_window = CreateTestWindow(bounds);
516 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 514 wm::WmWindow* window = WmWindowMus::Get(mus_window);
517 window->SetShowState(ui::SHOW_STATE_MINIMIZED); 515 window->SetShowState(ui::SHOW_STATE_MINIMIZED);
518 // Note: Currently minimize doesn't do anything except set the state. 516 // Note: Currently minimize doesn't do anything except set the state.
519 // See crbug.com/104571. 517 // See crbug.com/104571.
520 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString()); 518 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString());
521 window->SetShowState(ui::SHOW_STATE_NORMAL); 519 window->SetShowState(ui::SHOW_STATE_NORMAL);
522 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString()); 520 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString());
523 } 521 }
524 522
525 // A WindowObserver which sets the focus when the window becomes visible. 523 // A WindowObserver which sets the focus when the window becomes visible.
526 class FocusObserver : public mus::WindowObserver { 524 class FocusObserver : public ::mus::WindowObserver {
527 public: 525 public:
528 explicit FocusObserver(mus::Window* window) 526 explicit FocusObserver(::mus::Window* window)
529 : window_(window), show_state_(ui::SHOW_STATE_END) { 527 : window_(window), show_state_(ui::SHOW_STATE_END) {
530 window_->AddObserver(this); 528 window_->AddObserver(this);
531 } 529 }
532 ~FocusObserver() override { window_->RemoveObserver(this); } 530 ~FocusObserver() override { window_->RemoveObserver(this); }
533 531
534 // aura::test::TestWindowDelegate overrides: 532 // aura::test::TestWindowDelegate overrides:
535 void OnWindowVisibilityChanged(mus::Window* window) override { 533 void OnWindowVisibilityChanged(::mus::Window* window) override {
536 if (window_->visible()) 534 if (window_->visible())
537 window_->SetFocus(); 535 window_->SetFocus();
538 show_state_ = WmWindowMus::Get(window_)->GetShowState(); 536 show_state_ = WmWindowMus::Get(window_)->GetShowState();
539 } 537 }
540 538
541 ui::WindowShowState GetShowStateAndReset() { 539 ui::WindowShowState GetShowStateAndReset() {
542 ui::WindowShowState ret = show_state_; 540 ui::WindowShowState ret = show_state_;
543 show_state_ = ui::SHOW_STATE_END; 541 show_state_ = ui::SHOW_STATE_END;
544 return ret; 542 return ret;
545 } 543 }
546 544
547 private: 545 private:
548 mus::Window* window_; 546 ::mus::Window* window_;
549 ui::WindowShowState show_state_; 547 ui::WindowShowState show_state_;
550 548
551 DISALLOW_COPY_AND_ASSIGN(FocusObserver); 549 DISALLOW_COPY_AND_ASSIGN(FocusObserver);
552 }; 550 };
553 551
554 // Make sure that the window's show state is correct in 552 // Make sure that the window's show state is correct in
555 // |mus::WindowObserver::OnWindowVisibilityChanged|, and setting 553 // |mus::WindowObserver::OnWindowVisibilityChanged|, and setting
556 // focus in this callback doesn't cause DCHECK error. See 554 // focus in this callback doesn't cause DCHECK error. See
557 // crbug.com/168383. 555 // crbug.com/168383.
558 // NOTE: this was adapted from the ash test of the same name, I suspect this 556 // NOTE: this was adapted from the ash test of the same name, I suspect this
559 // test isn't particularly useful for mash. 557 // test isn't particularly useful for mash.
560 TEST_F(WorkspaceLayoutManagerSoloTest, FocusDuringUnminimize) { 558 TEST_F(WorkspaceLayoutManagerSoloTest, FocusDuringUnminimize) {
561 mus::Window* mus_window = CreateTestWindow(gfx::Rect(100, 100, 100, 100)); 559 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(100, 100, 100, 100));
562 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 560 wm::WmWindow* window = WmWindowMus::Get(mus_window);
563 FocusObserver observer(mus_window); 561 FocusObserver observer(mus_window);
564 window->SetShowState(ui::SHOW_STATE_MINIMIZED); 562 window->SetShowState(ui::SHOW_STATE_MINIMIZED);
565 EXPECT_FALSE(window->IsVisible()); 563 EXPECT_FALSE(window->IsVisible());
566 EXPECT_EQ(ui::SHOW_STATE_MINIMIZED, observer.GetShowStateAndReset()); 564 EXPECT_EQ(ui::SHOW_STATE_MINIMIZED, observer.GetShowStateAndReset());
567 window->Show(); 565 window->Show();
568 EXPECT_TRUE(window->IsVisible()); 566 EXPECT_TRUE(window->IsVisible());
569 EXPECT_EQ(ui::SHOW_STATE_NORMAL, observer.GetShowStateAndReset()); 567 EXPECT_EQ(ui::SHOW_STATE_NORMAL, observer.GetShowStateAndReset());
570 } 568 }
571 569
572 // Tests maximized window size during root window resize. 570 // Tests maximized window size during root window resize.
573 TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeRootWindowResize) { 571 TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeRootWindowResize) {
574 gfx::Rect bounds(100, 100, 200, 200); 572 gfx::Rect bounds(100, 100, 200, 200);
575 mus::Window* mus_window = CreateTestWindow(bounds); 573 ::mus::Window* mus_window = CreateTestWindow(bounds);
576 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 574 wm::WmWindow* window = WmWindowMus::Get(mus_window);
577 window->SetShowState(ui::SHOW_STATE_MAXIMIZED); 575 window->SetShowState(ui::SHOW_STATE_MAXIMIZED);
578 gfx::Rect initial_work_area_bounds = 576 gfx::Rect initial_work_area_bounds =
579 ash::wm::GetMaximizedWindowBoundsInParent(window); 577 wm::GetMaximizedWindowBoundsInParent(window);
580 EXPECT_EQ(initial_work_area_bounds.ToString(), 578 EXPECT_EQ(initial_work_area_bounds.ToString(),
581 mus_window->bounds().ToString()); 579 mus_window->bounds().ToString());
582 // Enlarge the root window. We should still match the work area size. 580 // Enlarge the root window. We should still match the work area size.
583 UpdateDisplay("900x700"); 581 UpdateDisplay("900x700");
584 EXPECT_EQ(ash::wm::GetMaximizedWindowBoundsInParent(window).ToString(), 582 EXPECT_EQ(wm::GetMaximizedWindowBoundsInParent(window).ToString(),
585 mus_window->bounds().ToString()); 583 mus_window->bounds().ToString());
586 EXPECT_NE(initial_work_area_bounds.ToString(), 584 EXPECT_NE(initial_work_area_bounds.ToString(),
587 ash::wm::GetMaximizedWindowBoundsInParent(window).ToString()); 585 wm::GetMaximizedWindowBoundsInParent(window).ToString());
588 } 586 }
589 587
590 // Tests normal->fullscreen->normal. 588 // Tests normal->fullscreen->normal.
591 TEST_F(WorkspaceLayoutManagerSoloTest, Fullscreen) { 589 TEST_F(WorkspaceLayoutManagerSoloTest, Fullscreen) {
592 gfx::Rect bounds(100, 100, 200, 200); 590 gfx::Rect bounds(100, 100, 200, 200);
593 mus::Window* mus_window = CreateTestWindow(bounds); 591 ::mus::Window* mus_window = CreateTestWindow(bounds);
594 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 592 wm::WmWindow* window = WmWindowMus::Get(mus_window);
595 window->SetShowState(ui::SHOW_STATE_FULLSCREEN); 593 window->SetShowState(ui::SHOW_STATE_FULLSCREEN);
596 // Fullscreen window fills the whole display. 594 // Fullscreen window fills the whole display.
597 EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(), 595 EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(),
598 mus_window->bounds().ToString()); 596 mus_window->bounds().ToString());
599 window->SetShowState(ui::SHOW_STATE_NORMAL); 597 window->SetShowState(ui::SHOW_STATE_NORMAL);
600 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString()); 598 EXPECT_EQ(bounds.ToString(), mus_window->bounds().ToString());
601 } 599 }
602 600
603 // Tests that fullscreen window causes always_on_top windows to stack below. 601 // Tests that fullscreen window causes always_on_top windows to stack below.
604 TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenSuspendsAlwaysOnTop) { 602 TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenSuspendsAlwaysOnTop) {
605 gfx::Rect bounds(100, 100, 200, 200); 603 gfx::Rect bounds(100, 100, 200, 200);
606 mus::Window* mus_fullscreen_window = CreateTestWindow(bounds); 604 ::mus::Window* mus_fullscreen_window = CreateTestWindow(bounds);
607 WmWindowMus* fullscreen_window = WmWindowMus::Get(mus_fullscreen_window); 605 WmWindowMus* fullscreen_window = WmWindowMus::Get(mus_fullscreen_window);
608 mus::Window* mus_always_on_top_window1 = CreateTestWindow(bounds); 606 ::mus::Window* mus_always_on_top_window1 = CreateTestWindow(bounds);
609 WmWindowMus* always_on_top_window1 = 607 WmWindowMus* always_on_top_window1 =
610 WmWindowMus::Get(mus_always_on_top_window1); 608 WmWindowMus::Get(mus_always_on_top_window1);
611 mus::Window* mus_always_on_top_window2 = CreateTestWindow(bounds); 609 ::mus::Window* mus_always_on_top_window2 = CreateTestWindow(bounds);
612 WmWindowMus* always_on_top_window2 = 610 WmWindowMus* always_on_top_window2 =
613 WmWindowMus::Get(mus_always_on_top_window2); 611 WmWindowMus::Get(mus_always_on_top_window2);
614 always_on_top_window1->SetAlwaysOnTop(true); 612 always_on_top_window1->SetAlwaysOnTop(true);
615 always_on_top_window2->SetAlwaysOnTop(true); 613 always_on_top_window2->SetAlwaysOnTop(true);
616 // Making a window fullscreen temporarily suspends always on top state. 614 // Making a window fullscreen temporarily suspends always on top state.
617 fullscreen_window->SetShowState(ui::SHOW_STATE_FULLSCREEN); 615 fullscreen_window->SetShowState(ui::SHOW_STATE_FULLSCREEN);
618 EXPECT_FALSE(always_on_top_window1->IsAlwaysOnTop()); 616 EXPECT_FALSE(always_on_top_window1->IsAlwaysOnTop());
619 EXPECT_FALSE(always_on_top_window2->IsAlwaysOnTop()); 617 EXPECT_FALSE(always_on_top_window2->IsAlwaysOnTop());
620 EXPECT_TRUE(GetWindowForFullscreenMode(fullscreen_window)); 618 EXPECT_TRUE(GetWindowForFullscreenMode(fullscreen_window));
621 // Making fullscreen window normal restores always on top windows. 619 // Making fullscreen window normal restores always on top windows.
622 fullscreen_window->SetShowState(ui::SHOW_STATE_NORMAL); 620 fullscreen_window->SetShowState(ui::SHOW_STATE_NORMAL);
623 EXPECT_TRUE(always_on_top_window1->IsAlwaysOnTop()); 621 EXPECT_TRUE(always_on_top_window1->IsAlwaysOnTop());
624 EXPECT_TRUE(always_on_top_window2->IsAlwaysOnTop()); 622 EXPECT_TRUE(always_on_top_window2->IsAlwaysOnTop());
625 EXPECT_FALSE(GetWindowForFullscreenMode(fullscreen_window)); 623 EXPECT_FALSE(GetWindowForFullscreenMode(fullscreen_window));
626 } 624 }
627 625
628 // Tests fullscreen window size during root window resize. 626 // Tests fullscreen window size during root window resize.
629 TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) { 627 TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) {
630 gfx::Rect bounds(100, 100, 200, 200); 628 gfx::Rect bounds(100, 100, 200, 200);
631 mus::Window* mus_window = CreateTestWindow(bounds); 629 ::mus::Window* mus_window = CreateTestWindow(bounds);
632 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 630 wm::WmWindow* window = WmWindowMus::Get(mus_window);
633 // Fullscreen window fills the whole display. 631 // Fullscreen window fills the whole display.
634 window->SetShowState(ui::SHOW_STATE_FULLSCREEN); 632 window->SetShowState(ui::SHOW_STATE_FULLSCREEN);
635 EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(), 633 EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(),
636 mus_window->bounds().ToString()); 634 mus_window->bounds().ToString());
637 // Enlarge the root window. We should still match the display size. 635 // Enlarge the root window. We should still match the display size.
638 UpdateDisplay("1001x1201"); 636 UpdateDisplay("1001x1201");
639 EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(), 637 EXPECT_EQ(window->GetDisplayNearestWindow().bounds().ToString(),
640 mus_window->bounds().ToString()); 638 mus_window->bounds().ToString());
641 } 639 }
642 640
643 // Tests that when the screen gets smaller the windows aren't bigger than 641 // Tests that when the screen gets smaller the windows aren't bigger than
644 // the screen. 642 // the screen.
645 TEST_F(WorkspaceLayoutManagerSoloTest, RootWindowResizeShrinksWindows) { 643 TEST_F(WorkspaceLayoutManagerSoloTest, RootWindowResizeShrinksWindows) {
646 mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 500, 400)); 644 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 500, 400));
647 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 645 wm::WmWindow* window = WmWindowMus::Get(mus_window);
648 gfx::Rect work_area = window->GetDisplayNearestWindow().work_area(); 646 gfx::Rect work_area = window->GetDisplayNearestWindow().work_area();
649 // Invariant: Window is smaller than work area. 647 // Invariant: Window is smaller than work area.
650 EXPECT_LE(mus_window->bounds().width(), work_area.width()); 648 EXPECT_LE(mus_window->bounds().width(), work_area.width());
651 EXPECT_LE(mus_window->bounds().height(), work_area.height()); 649 EXPECT_LE(mus_window->bounds().height(), work_area.height());
652 650
653 // Make the root window narrower than our window. 651 // Make the root window narrower than our window.
654 UpdateDisplay("300x400"); 652 UpdateDisplay("300x400");
655 work_area = window->GetDisplayNearestWindow().work_area(); 653 work_area = window->GetDisplayNearestWindow().work_area();
656 EXPECT_LE(mus_window->bounds().width(), work_area.width()); 654 EXPECT_LE(mus_window->bounds().width(), work_area.width());
657 EXPECT_LE(mus_window->bounds().height(), work_area.height()); 655 EXPECT_LE(mus_window->bounds().height(), work_area.height());
658 656
659 // Make the root window shorter than our window. 657 // Make the root window shorter than our window.
660 UpdateDisplay("300x200"); 658 UpdateDisplay("300x200");
661 work_area = window->GetDisplayNearestWindow().work_area(); 659 work_area = window->GetDisplayNearestWindow().work_area();
662 EXPECT_LE(mus_window->bounds().width(), work_area.width()); 660 EXPECT_LE(mus_window->bounds().width(), work_area.width());
663 EXPECT_LE(mus_window->bounds().height(), work_area.height()); 661 EXPECT_LE(mus_window->bounds().height(), work_area.height());
664 662
665 // Enlarging the root window does not change the window bounds. 663 // Enlarging the root window does not change the window bounds.
666 gfx::Rect old_bounds = mus_window->bounds(); 664 gfx::Rect old_bounds = mus_window->bounds();
667 UpdateDisplay("800x600"); 665 UpdateDisplay("800x600");
668 EXPECT_EQ(old_bounds.width(), mus_window->bounds().width()); 666 EXPECT_EQ(old_bounds.width(), mus_window->bounds().width());
669 EXPECT_EQ(old_bounds.height(), mus_window->bounds().height()); 667 EXPECT_EQ(old_bounds.height(), mus_window->bounds().height());
670 } 668 }
671 669
672 // Verifies maximizing sets the restore bounds, and restoring 670 // Verifies maximizing sets the restore bounds, and restoring
673 // restores the bounds. 671 // restores the bounds.
674 TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeSetsRestoreBounds) { 672 TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeSetsRestoreBounds) {
675 mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40)); 673 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(10, 20, 30, 40));
676 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 674 wm::WmWindow* window = WmWindowMus::Get(mus_window);
677 ash::wm::WindowState* window_state = window->GetWindowState(); 675 wm::WindowState* window_state = window->GetWindowState();
678 676
679 // Maximize it, which will keep the previous restore bounds. 677 // Maximize it, which will keep the previous restore bounds.
680 window->SetShowState(ui::SHOW_STATE_MAXIMIZED); 678 window->SetShowState(ui::SHOW_STATE_MAXIMIZED);
681 EXPECT_EQ("10,20 30x40", window_state->GetRestoreBoundsInParent().ToString()); 679 EXPECT_EQ("10,20 30x40", window_state->GetRestoreBoundsInParent().ToString());
682 680
683 // Restore it, which should restore bounds and reset restore bounds. 681 // Restore it, which should restore bounds and reset restore bounds.
684 window->SetShowState(ui::SHOW_STATE_NORMAL); 682 window->SetShowState(ui::SHOW_STATE_NORMAL);
685 EXPECT_EQ("10,20 30x40", mus_window->bounds().ToString()); 683 EXPECT_EQ("10,20 30x40", mus_window->bounds().ToString());
686 EXPECT_FALSE(window_state->HasRestoreBounds()); 684 EXPECT_FALSE(window_state->HasRestoreBounds());
687 } 685 }
688 686
689 // Verifies maximizing keeps the restore bounds if set. 687 // Verifies maximizing keeps the restore bounds if set.
690 TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeResetsRestoreBounds) { 688 TEST_F(WorkspaceLayoutManagerSoloTest, MaximizeResetsRestoreBounds) {
691 mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); 689 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4));
692 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 690 wm::WmWindow* window = WmWindowMus::Get(mus_window);
693 691
694 ash::wm::WindowState* window_state = window->GetWindowState(); 692 wm::WindowState* window_state = window->GetWindowState();
695 window_state->SetRestoreBoundsInParent(gfx::Rect(10, 11, 12, 13)); 693 window_state->SetRestoreBoundsInParent(gfx::Rect(10, 11, 12, 13));
696 694
697 // Maximize it, which will keep the previous restore bounds. 695 // Maximize it, which will keep the previous restore bounds.
698 window->SetShowState(ui::SHOW_STATE_MAXIMIZED); 696 window->SetShowState(ui::SHOW_STATE_MAXIMIZED);
699 EXPECT_EQ("10,11 12x13", window_state->GetRestoreBoundsInParent().ToString()); 697 EXPECT_EQ("10,11 12x13", window_state->GetRestoreBoundsInParent().ToString());
700 } 698 }
701 699
702 // Verifies that the restore bounds do not get reset when restoring to a 700 // Verifies that the restore bounds do not get reset when restoring to a
703 // maximzied state from a minimized state. 701 // maximzied state from a minimized state.
704 TEST_F(WorkspaceLayoutManagerSoloTest, 702 TEST_F(WorkspaceLayoutManagerSoloTest,
705 BoundsAfterRestoringToMaximizeFromMinimize) { 703 BoundsAfterRestoringToMaximizeFromMinimize) {
706 mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4)); 704 ::mus::Window* mus_window = CreateTestWindow(gfx::Rect(1, 2, 3, 4));
707 ash::wm::WmWindow* window = WmWindowMus::Get(mus_window); 705 wm::WmWindow* window = WmWindowMus::Get(mus_window);
708 gfx::Rect bounds(10, 15, 25, 35); 706 gfx::Rect bounds(10, 15, 25, 35);
709 window->SetBounds(bounds); 707 window->SetBounds(bounds);
710 708
711 ash::wm::WindowState* window_state = window->GetWindowState(); 709 wm::WindowState* window_state = window->GetWindowState();
712 // Maximize it, which should reset restore bounds. 710 // Maximize it, which should reset restore bounds.
713 window_state->Maximize(); 711 window_state->Maximize();
714 EXPECT_EQ(bounds.ToString(), 712 EXPECT_EQ(bounds.ToString(),
715 window_state->GetRestoreBoundsInParent().ToString()); 713 window_state->GetRestoreBoundsInParent().ToString());
716 // Minimize the window. The restore bounds should not change. 714 // Minimize the window. The restore bounds should not change.
717 window_state->Minimize(); 715 window_state->Minimize();
718 EXPECT_EQ(bounds.ToString(), 716 EXPECT_EQ(bounds.ToString(),
719 window_state->GetRestoreBoundsInParent().ToString()); 717 window_state->GetRestoreBoundsInParent().ToString());
720 718
721 // Show the window again. The window should be maximized, and the restore 719 // Show the window again. The window should be maximized, and the restore
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 EXPECT_EQ(gfx::Rect(50, 1094 EXPECT_EQ(gfx::Rect(50,
1097 keyboard_bounds.y() - keyboard_bounds.height()/2, 1095 keyboard_bounds.y() - keyboard_bounds.height()/2,
1098 occluded_window_bounds.width(), 1096 occluded_window_bounds.width(),
1099 occluded_window_bounds.height()).ToString(), 1097 occluded_window_bounds.height()).ToString(),
1100 window->bounds().ToString()); 1098 window->bounds().ToString());
1101 HideKeyboard(); 1099 HideKeyboard();
1102 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString()); 1100 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString());
1103 } 1101 }
1104 */ 1102 */
1105 1103
1106 } // namespace wm 1104 } // namespace mus
1107 } // namespace mash 1105 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/window_manager_unittest.cc ('k') | chrome/app/mash/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698