display_move_window_util_unittest.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. // Copyright 2017 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/display/display_move_window_util.h"
  5. #include "ash/accelerators/accelerator_controller_impl.h"
  6. #include "ash/accelerators/accelerator_table.h"
  7. #include "ash/accessibility/test_accessibility_controller_client.h"
  8. #include "ash/public/cpp/shelf_config.h"
  9. #include "ash/root_window_controller.h"
  10. #include "ash/screen_util.h"
  11. #include "ash/shell.h"
  12. #include "ash/test/ash_test_base.h"
  13. #include "ash/test/test_window_builder.h"
  14. #include "ash/wm/mru_window_tracker.h"
  15. #include "ash/wm/window_state.h"
  16. #include "ash/wm/window_util.h"
  17. #include "ash/wm/wm_event.h"
  18. #include "base/command_line.h"
  19. #include "ui/aura/test/test_windows.h"
  20. #include "ui/display/display.h"
  21. #include "ui/display/display_layout.h"
  22. #include "ui/display/display_layout_builder.h"
  23. #include "ui/display/manager/display_layout_store.h"
  24. #include "ui/display/manager/display_manager.h"
  25. #include "ui/display/screen.h"
  26. #include "ui/display/test/display_manager_test_api.h"
  27. #include "ui/views/widget/widget.h"
  28. #include "ui/wm/core/window_util.h"
  29. namespace ash {
  30. namespace display_move_window_util {
  31. namespace {
  32. // Get the default left snapped window bounds which has snapped width ratio 0.5.
  33. gfx::Rect GetDefaultLeftSnappedBoundsInDisplay(
  34. const display::Display& display) {
  35. auto work_area = display.work_area();
  36. work_area.set_width(work_area.width() / 2);
  37. return work_area;
  38. }
  39. views::Widget* CreateTestWidgetWithParent(views::Widget::InitParams::Type type,
  40. gfx::NativeView parent,
  41. const gfx::Rect& bounds,
  42. bool child) {
  43. views::Widget::InitParams params(type);
  44. params.delegate = nullptr;
  45. params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
  46. params.parent = parent;
  47. params.bounds = bounds;
  48. params.child = child;
  49. views::Widget* widget = new views::Widget;
  50. widget->Init(std::move(params));
  51. widget->Show();
  52. return widget;
  53. }
  54. void PerformMoveWindowAccel() {
  55. Shell::Get()->accelerator_controller()->PerformActionIfEnabled(
  56. MOVE_ACTIVE_WINDOW_BETWEEN_DISPLAYS, {});
  57. }
  58. } // namespace
  59. using DisplayMoveWindowUtilTest = AshTestBase;
  60. TEST_F(DisplayMoveWindowUtilTest, SingleDisplay) {
  61. aura::Window* window =
  62. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  63. wm::ActivateWindow(window);
  64. EXPECT_FALSE(CanHandleMoveActiveWindowBetweenDisplays());
  65. }
  66. // Tests that window bounds are not changing after moving to another display. It
  67. // is added as a child window to another root window with the same origin.
  68. TEST_F(DisplayMoveWindowUtilTest, WindowBounds) {
  69. // Layout: [p][1]
  70. UpdateDisplay("400x300,400x300");
  71. aura::Window* window =
  72. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  73. wm::ActivateWindow(window);
  74. PerformMoveWindowAccel();
  75. EXPECT_EQ(gfx::Rect(410, 20, 200, 100), window->GetBoundsInScreen());
  76. }
  77. // Tests window state (maximized/fullscreen/snapped) and its bounds.
  78. TEST_F(DisplayMoveWindowUtilTest, WindowState) {
  79. // Layout: [p][ 1 ]
  80. UpdateDisplay("400x300,800x300");
  81. aura::Window* window =
  82. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  83. wm::ActivateWindow(window);
  84. display::Screen* screen = display::Screen::GetScreen();
  85. ASSERT_EQ(display_manager()->GetDisplayAt(0).id(),
  86. screen->GetDisplayNearestWindow(window).id());
  87. WindowState* window_state = WindowState::Get(window);
  88. // Set window to maximized state.
  89. window_state->Maximize();
  90. EXPECT_TRUE(window_state->IsMaximized());
  91. EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(window),
  92. window->bounds());
  93. PerformMoveWindowAccel();
  94. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  95. screen->GetDisplayNearestWindow(window).id());
  96. // Check that window state is maximized and has updated maximized bounds.
  97. EXPECT_TRUE(window_state->IsMaximized());
  98. EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(window),
  99. window->bounds());
  100. // Set window to fullscreen state.
  101. PerformMoveWindowAccel();
  102. const WMEvent fullscreen(WM_EVENT_TOGGLE_FULLSCREEN);
  103. window_state->OnWMEvent(&fullscreen);
  104. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  105. screen->GetDisplayNearestWindow(window).id());
  106. EXPECT_TRUE(window_state->IsFullscreen());
  107. EXPECT_EQ(display_manager()->GetDisplayAt(0).bounds(),
  108. window->GetBoundsInScreen());
  109. PerformMoveWindowAccel();
  110. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  111. screen->GetDisplayNearestWindow(window).id());
  112. // Check that window state is fullscreen and has updated fullscreen bounds.
  113. EXPECT_TRUE(window_state->IsFullscreen());
  114. EXPECT_EQ(display_manager()->GetDisplayAt(1).bounds(),
  115. window->GetBoundsInScreen());
  116. // Set window to left snapped state.
  117. PerformMoveWindowAccel();
  118. const WindowSnapWMEvent snap_left(WM_EVENT_SNAP_PRIMARY);
  119. window_state->OnWMEvent(&snap_left);
  120. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  121. screen->GetDisplayNearestWindow(window).id());
  122. EXPECT_TRUE(window_state->IsSnapped());
  123. EXPECT_EQ(GetDefaultLeftSnappedBoundsInDisplay(
  124. screen->GetDisplayNearestWindow(window)),
  125. window->GetBoundsInScreen());
  126. EXPECT_EQ(0.5f, *window_state->snap_ratio());
  127. PerformMoveWindowAccel();
  128. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  129. screen->GetDisplayNearestWindow(window).id());
  130. // Check that window state is snapped and has updated snapped bounds.
  131. EXPECT_TRUE(window_state->IsSnapped());
  132. EXPECT_EQ(GetDefaultLeftSnappedBoundsInDisplay(
  133. screen->GetDisplayNearestWindow(window)),
  134. window->GetBoundsInScreen());
  135. EXPECT_EQ(0.5f, *window_state->snap_ratio());
  136. }
  137. // Tests that movement follows cycling through sorted display id list.
  138. TEST_F(DisplayMoveWindowUtilTest, FourDisplays) {
  139. display::Screen* screen = display::Screen::GetScreen();
  140. int64_t primary_id = screen->GetPrimaryDisplay().id();
  141. // Layout:
  142. // [3][2]
  143. // [1][p]
  144. display::DisplayIdList list =
  145. display::test::CreateDisplayIdListN(primary_id, 4);
  146. display::DisplayLayoutBuilder builder(primary_id);
  147. builder.AddDisplayPlacement(list[1], primary_id,
  148. display::DisplayPlacement::LEFT, 0);
  149. builder.AddDisplayPlacement(list[2], primary_id,
  150. display::DisplayPlacement::TOP, 0);
  151. builder.AddDisplayPlacement(list[3], list[2], display::DisplayPlacement::LEFT,
  152. 0);
  153. display_manager()->layout_store()->RegisterLayoutForDisplayIdList(
  154. list, builder.Build());
  155. UpdateDisplay("400x300,400x300,400x300,400x300");
  156. EXPECT_EQ(4U, display_manager()->GetNumDisplays());
  157. EXPECT_EQ(gfx::Rect(0, 0, 400, 300),
  158. display_manager()->GetDisplayAt(0).bounds());
  159. EXPECT_EQ(gfx::Rect(-400, 0, 400, 300),
  160. display_manager()->GetDisplayAt(1).bounds());
  161. EXPECT_EQ(gfx::Rect(0, -300, 400, 300),
  162. display_manager()->GetDisplayAt(2).bounds());
  163. EXPECT_EQ(gfx::Rect(-400, -300, 400, 300),
  164. display_manager()->GetDisplayAt(3).bounds());
  165. aura::Window* window =
  166. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  167. wm::ActivateWindow(window);
  168. ASSERT_EQ(list[0], screen->GetDisplayNearestWindow(window).id());
  169. PerformMoveWindowAccel();
  170. EXPECT_EQ(list[1], screen->GetDisplayNearestWindow(window).id());
  171. PerformMoveWindowAccel();
  172. EXPECT_EQ(list[2], screen->GetDisplayNearestWindow(window).id());
  173. PerformMoveWindowAccel();
  174. EXPECT_EQ(list[3], screen->GetDisplayNearestWindow(window).id());
  175. PerformMoveWindowAccel();
  176. EXPECT_EQ(list[0], screen->GetDisplayNearestWindow(window).id());
  177. }
  178. // Tests that a11y alert is sent on handling move window to display.
  179. TEST_F(DisplayMoveWindowUtilTest, A11yAlert) {
  180. // Layout: [p][1]
  181. UpdateDisplay("400x300,400x300");
  182. TestAccessibilityControllerClient client;
  183. aura::Window* window =
  184. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  185. wm::ActivateWindow(window);
  186. PerformMoveWindowAccel();
  187. EXPECT_EQ(AccessibilityAlert::WINDOW_MOVED_TO_ANOTHER_DISPLAY,
  188. client.last_a11y_alert());
  189. }
  190. // Tests that moving window between displays is no-op if active window is not in
  191. // window cycle list.
  192. TEST_F(DisplayMoveWindowUtilTest, NoMovementIfNotInCycleWindowList) {
  193. // Layout: [p][1]
  194. UpdateDisplay("400x300,400x300");
  195. // Create a window in app list container, which would be excluded in cycle
  196. // window list.
  197. std::unique_ptr<aura::Window> window =
  198. ChildTestWindowBuilder(Shell::GetPrimaryRootWindow(),
  199. gfx::Rect(10, 20, 200, 100),
  200. kShellWindowId_AppListContainer)
  201. .Build();
  202. wm::ActivateWindow(window.get());
  203. display::Screen* screen = display::Screen::GetScreen();
  204. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  205. screen->GetDisplayNearestWindow(window.get()).id());
  206. MruWindowTracker::WindowList cycle_window_list =
  207. Shell::Get()->mru_window_tracker()->BuildWindowForCycleList(kActiveDesk);
  208. EXPECT_TRUE(cycle_window_list.empty());
  209. PerformMoveWindowAccel();
  210. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  211. screen->GetDisplayNearestWindow(window.get()).id());
  212. }
  213. // Tests that window bounds should be kept if it is not changed by user, i.e.
  214. // if it is changed by display area difference, it should restore to the
  215. // original bounds when it is moved between displays and there is enough work
  216. // area to show this window.
  217. TEST_F(DisplayMoveWindowUtilTest, KeepWindowBoundsIfNotChangedByUser) {
  218. // Layout:
  219. // +---+---+
  220. // | p | |
  221. // +---+ 1 |
  222. // | |
  223. // +---+
  224. UpdateDisplay("400x300,400x600");
  225. const int shelf_inset = 300 - ShelfConfig::Get()->shelf_size();
  226. // Create and activate window on display [1].
  227. aura::Window* window =
  228. CreateTestWindowInShellWithBounds(gfx::Rect(410, 20, 200, 400));
  229. wm::ActivateWindow(window);
  230. display::Screen* screen = display::Screen::GetScreen();
  231. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  232. screen->GetDisplayNearestWindow(window).id());
  233. // Move window to display [p]. Its window bounds is adjusted by available work
  234. // area.
  235. PerformMoveWindowAccel();
  236. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  237. screen->GetDisplayNearestWindow(window).id());
  238. EXPECT_EQ(gfx::Rect(10, 20, 200, shelf_inset), window->GetBoundsInScreen());
  239. // Move window back to display [1]. Its window bounds should be restored.
  240. PerformMoveWindowAccel();
  241. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  242. screen->GetDisplayNearestWindow(window).id());
  243. EXPECT_EQ(gfx::Rect(410, 20, 200, 400), window->GetBoundsInScreen());
  244. // Move window to display [p] and set that its bounds is changed by user.
  245. WindowState* window_state = WindowState::Get(window);
  246. PerformMoveWindowAccel();
  247. window_state->set_bounds_changed_by_user(true);
  248. // Move window back to display [1], but its bounds has been changed by user.
  249. // Then window bounds should be kept the same as that in display [p].
  250. PerformMoveWindowAccel();
  251. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  252. screen->GetDisplayNearestWindow(window).id());
  253. EXPECT_EQ(gfx::Rect(410, 20, 200, shelf_inset), window->GetBoundsInScreen());
  254. }
  255. // Tests auto window management on moving window between displays.
  256. TEST_F(DisplayMoveWindowUtilTest, AutoManaged) {
  257. // Layout: [p][1]
  258. UpdateDisplay("400x300,400x300");
  259. // Create and show window on display [p]. Enable auto window position managed,
  260. // which will center the window on display [p].
  261. aura::Window* window1 =
  262. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  263. WindowState* window1_state = WindowState::Get(window1);
  264. window1_state->SetWindowPositionManaged(true);
  265. window1->Hide();
  266. window1->Show();
  267. EXPECT_EQ(gfx::Rect(100, 20, 200, 100), window1->GetBoundsInScreen());
  268. display::Screen* screen = display::Screen::GetScreen();
  269. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  270. screen->GetDisplayNearestWindow(window1).id());
  271. // Create and show window on display [p]. Enable auto window position managed,
  272. // which will do auto window management (pushing the other window to side).
  273. aura::Window* window2 =
  274. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  275. WindowState* window2_state = WindowState::Get(window2);
  276. window2_state->SetWindowPositionManaged(true);
  277. window2->Hide();
  278. window2->Show();
  279. EXPECT_EQ(gfx::Rect(0, 20, 200, 100), window1->GetBoundsInScreen());
  280. EXPECT_EQ(gfx::Rect(200, 20, 200, 100), window2->GetBoundsInScreen());
  281. // Activate window2.
  282. wm::ActivateWindow(window2);
  283. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  284. screen->GetDisplayNearestWindow(window2).id());
  285. EXPECT_TRUE(window2_state->pre_auto_manage_window_bounds());
  286. EXPECT_EQ(gfx::Rect(10, 20, 200, 100),
  287. *window2_state->pre_auto_manage_window_bounds());
  288. // Move window2 to display [1] and check auto window management.
  289. PerformMoveWindowAccel();
  290. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  291. screen->GetDisplayNearestWindow(window2).id());
  292. // Check |pre_added_to_workspace_window_bounds()|, which should be equal to
  293. // |pre_auto_manage_window_bounds()| in this case.
  294. EXPECT_EQ(*window2_state->pre_auto_manage_window_bounds(),
  295. *window2_state->pre_added_to_workspace_window_bounds());
  296. // Window 1 centers on display [p] again.
  297. EXPECT_EQ(gfx::Rect(100, 20, 200, 100), window1->GetBoundsInScreen());
  298. // Window 2 is positioned by |pre_added_to_workspace_window_bounds()|.
  299. EXPECT_EQ(gfx::Rect(410, 20, 200, 100), window2->GetBoundsInScreen());
  300. }
  301. TEST_F(DisplayMoveWindowUtilTest, WindowWithTransientChild) {
  302. UpdateDisplay("400x300,400x300");
  303. aura::Window* window =
  304. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  305. wm::ActivateWindow(window);
  306. // Create a |child| window and make it a transient child of |window|.
  307. std::unique_ptr<aura::Window> child =
  308. ChildTestWindowBuilder(window, gfx::Rect(20, 30, 40, 50)).Build();
  309. ::wm::AddTransientChild(window, child.get());
  310. display::Screen* screen = display::Screen::GetScreen();
  311. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  312. screen->GetDisplayNearestWindow(window).id());
  313. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  314. screen->GetDisplayNearestWindow(child.get()).id());
  315. // Operate moving window to right display. Check display and bounds.
  316. PerformMoveWindowAccel();
  317. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  318. screen->GetDisplayNearestWindow(window).id());
  319. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  320. screen->GetDisplayNearestWindow(child.get()).id());
  321. EXPECT_EQ(gfx::Rect(410, 20, 200, 100), window->GetBoundsInScreen());
  322. EXPECT_EQ(gfx::Rect(430, 50, 40, 50), child->GetBoundsInScreen());
  323. }
  324. // Test that when operating move window between displays on activated transient
  325. // child window, its first non-transient transient-parent window should be the
  326. // target instead.
  327. TEST_F(DisplayMoveWindowUtilTest, ActiveTransientChildWindow) {
  328. UpdateDisplay("400x300,400x300");
  329. std::unique_ptr<views::Widget> window = CreateTestWidget();
  330. window->SetBounds(gfx::Rect(10, 20, 200, 100));
  331. // Create a |child| transient widget of |window|. When |child| is shown, it is
  332. // activated.
  333. std::unique_ptr<views::Widget> child(CreateTestWidgetWithParent(
  334. views::Widget::InitParams::TYPE_WINDOW, window->GetNativeView(),
  335. gfx::Rect(20, 30, 40, 50), false));
  336. display::Screen* screen = display::Screen::GetScreen();
  337. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  338. screen->GetDisplayNearestWindow(window->GetNativeWindow()).id());
  339. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  340. screen->GetDisplayNearestWindow(child->GetNativeWindow()).id());
  341. // Ensure |child| window is activated.
  342. EXPECT_FALSE(wm::IsActiveWindow(window->GetNativeWindow()));
  343. EXPECT_TRUE(wm::IsActiveWindow(child->GetNativeWindow()));
  344. // Operate moving window to right display. Check display and bounds.
  345. PerformMoveWindowAccel();
  346. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  347. screen->GetDisplayNearestWindow(window->GetNativeWindow()).id());
  348. EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
  349. screen->GetDisplayNearestWindow(child->GetNativeWindow()).id());
  350. EXPECT_EQ(gfx::Rect(410, 20, 200, 100),
  351. window->GetNativeWindow()->GetBoundsInScreen());
  352. EXPECT_EQ(gfx::Rect(420, 30, 40, 50),
  353. child->GetNativeWindow()->GetBoundsInScreen());
  354. }
  355. // Test that when active window is transient child window, no movement if its
  356. // first non-transient transient-parent window is not in window cycle list.
  357. TEST_F(DisplayMoveWindowUtilTest, TransientParentNotInCycleWindowList) {
  358. UpdateDisplay("400x300,400x300");
  359. aura::Window* w1 =
  360. CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 50, 50));
  361. wm::ActivateWindow(w1);
  362. // Create a window |w2| in non-switchable window container.
  363. aura::Window* setting_bubble_container =
  364. Shell::GetPrimaryRootWindowController()->GetContainer(
  365. kShellWindowId_SettingBubbleContainer);
  366. std::unique_ptr<aura::Window> w2 =
  367. ChildTestWindowBuilder(setting_bubble_container,
  368. gfx::Rect(10, 20, 200, 100))
  369. .Build();
  370. wm::ActivateWindow(w2.get());
  371. // Create a |child| transient widget of |w2|. When |child| is shown, it is
  372. // activated.
  373. std::unique_ptr<views::Widget> child(
  374. CreateTestWidgetWithParent(views::Widget::InitParams::TYPE_WINDOW,
  375. w2.get(), gfx::Rect(20, 30, 40, 50), false));
  376. display::Screen* screen = display::Screen::GetScreen();
  377. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  378. screen->GetDisplayNearestWindow(w1).id());
  379. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  380. screen->GetDisplayNearestWindow(w2.get()).id());
  381. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  382. screen->GetDisplayNearestWindow(child->GetNativeWindow()).id());
  383. // Ensure |child| window is activated.
  384. EXPECT_FALSE(wm::IsActiveWindow(w1));
  385. EXPECT_FALSE(wm::IsActiveWindow(w2.get()));
  386. EXPECT_TRUE(wm::IsActiveWindow(child->GetNativeWindow()));
  387. PerformMoveWindowAccel();
  388. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  389. screen->GetDisplayNearestWindow(w1).id());
  390. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  391. screen->GetDisplayNearestWindow(w2.get()).id());
  392. EXPECT_EQ(display_manager()->GetDisplayAt(0).id(),
  393. screen->GetDisplayNearestWindow(child->GetNativeWindow()).id());
  394. }
  395. // Tests that restore bounds is updated with window movement to another display.
  396. TEST_F(DisplayMoveWindowUtilTest, RestoreMaximizedWindowAfterMovement) {
  397. UpdateDisplay("400x300,400x300");
  398. aura::Window* w =
  399. CreateTestWindowInShellWithBounds(gfx::Rect(10, 20, 200, 100));
  400. wm::ActivateWindow(w);
  401. WindowState* window_state = WindowState::Get(w);
  402. window_state->Maximize();
  403. EXPECT_EQ(gfx::Rect(0, 0, 400, 300 - ShelfConfig::Get()->shelf_size()),
  404. w->GetBoundsInScreen());
  405. PerformMoveWindowAccel();
  406. EXPECT_EQ(gfx::Rect(400, 0, 400, 300 - ShelfConfig::Get()->shelf_size()),
  407. w->GetBoundsInScreen());
  408. window_state->Restore();
  409. EXPECT_EQ(gfx::Rect(410, 20, 200, 100), w->GetBoundsInScreen());
  410. }
  411. } // namespace display_move_window_util
  412. } // namespace ash