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

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 2012343002: Converts overview to use common ash types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback 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/wm/overview/window_selector_item.cc ('k') | mash/wm/bridge/wm_globals_mus.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/drag_drop/drag_drop_controller.h" 10 #include "ash/drag_drop/drag_drop_controller.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) { 208 const std::vector<WindowSelectorItem*>& GetWindowItemsForRoot(int index) {
209 return ash::Shell::GetInstance()->window_selector_controller()-> 209 return ash::Shell::GetInstance()->window_selector_controller()->
210 window_selector_->grid_list_[index]->window_list_.get(); 210 window_selector_->grid_list_[index]->window_list_.get();
211 } 211 }
212 212
213 WindowSelectorItem* GetWindowItemForWindow(int grid_index, 213 WindowSelectorItem* GetWindowItemForWindow(int grid_index,
214 aura::Window* window) { 214 aura::Window* window) {
215 const std::vector<WindowSelectorItem*>& windows = 215 const std::vector<WindowSelectorItem*>& windows =
216 GetWindowItemsForRoot(grid_index); 216 GetWindowItemsForRoot(grid_index);
217 auto iter = std::find_if(windows.cbegin(), windows.cend(), 217 auto iter =
218 [window](const WindowSelectorItem* item) { 218 std::find_if(windows.cbegin(), windows.cend(),
219 return item->Contains(window); 219 [window](const WindowSelectorItem* item) {
220 }); 220 return item->Contains(wm::WmWindowAura::Get(window));
221 });
221 if (iter == windows.end()) 222 if (iter == windows.end())
222 return nullptr; 223 return nullptr;
223 return *iter; 224 return *iter;
224 } 225 }
225 226
226 // Selects |window| in the active overview session by cycling through all 227 // Selects |window| in the active overview session by cycling through all
227 // windows in overview until it is found. Returns true if |window| was found, 228 // windows in overview until it is found. Returns true if |window| was found,
228 // false otherwise. 229 // false otherwise.
229 bool SelectWindow(const aura::Window* window) { 230 bool SelectWindow(const aura::Window* window) {
230 if (GetSelectedWindow() == nullptr) 231 if (GetSelectedWindow() == nullptr)
231 SendKey(ui::VKEY_TAB); 232 SendKey(ui::VKEY_TAB);
232 const aura::Window* start_window = GetSelectedWindow(); 233 const aura::Window* start_window = GetSelectedWindow();
233 if (start_window == window) 234 if (start_window == window)
234 return true; 235 return true;
235 do { 236 do {
236 SendKey(ui::VKEY_TAB); 237 SendKey(ui::VKEY_TAB);
237 } while (GetSelectedWindow() != window && 238 } while (GetSelectedWindow() != window &&
238 GetSelectedWindow() != start_window); 239 GetSelectedWindow() != start_window);
239 return GetSelectedWindow() == window; 240 return GetSelectedWindow() == window;
240 } 241 }
241 242
242 const aura::Window* GetSelectedWindow() { 243 const aura::Window* GetSelectedWindow() {
243 WindowSelector* ws = ash::Shell::GetInstance()-> 244 WindowSelector* ws = ash::Shell::GetInstance()->
244 window_selector_controller()->window_selector_.get(); 245 window_selector_controller()->window_selector_.get();
245 WindowSelectorItem* item = 246 WindowSelectorItem* item =
246 ws->grid_list_[ws->selected_grid_index_]->SelectedWindow(); 247 ws->grid_list_[ws->selected_grid_index_]->SelectedWindow();
247 if (!item) 248 if (!item)
248 return nullptr; 249 return nullptr;
249 return item->GetWindow(); 250 return wm::WmWindowAura::GetAuraWindow(item->GetWindow());
250 } 251 }
251 252
252 bool selection_widget_active() { 253 bool selection_widget_active() {
253 WindowSelector* ws = ash::Shell::GetInstance()-> 254 WindowSelector* ws = ash::Shell::GetInstance()->
254 window_selector_controller()->window_selector_.get(); 255 window_selector_controller()->window_selector_.get();
255 return ws->grid_list_[ws->selected_grid_index_]->is_selecting(); 256 return ws->grid_list_[ws->selected_grid_index_]->is_selecting();
256 } 257 }
257 258
258 bool showing_filter_widget() { 259 bool showing_filter_widget() {
259 WindowSelector* ws = ash::Shell::GetInstance()-> 260 WindowSelector* ws = ash::Shell::GetInstance()->
260 window_selector_controller()->window_selector_.get(); 261 window_selector_controller()->window_selector_.get();
261 return ws->text_filter_widget_->GetNativeWindow()->layer()-> 262 return ws->text_filter_widget_->GetNativeWindow()->layer()->
262 GetTargetTransform().IsIdentity(); 263 GetTargetTransform().IsIdentity();
263 } 264 }
264 265
265 views::Widget* GetCloseButton(ash::WindowSelectorItem* window) { 266 views::Widget* GetCloseButton(ash::WindowSelectorItem* window) {
266 return &(window->close_button_widget_); 267 return &(window->close_button_widget_);
267 } 268 }
268 269
269 views::LabelButton* GetLabelButtonView(ash::WindowSelectorItem* window) { 270 views::LabelButton* GetLabelButtonView(ash::WindowSelectorItem* window) {
270 return window->window_label_button_view_; 271 return window->window_label_button_view_;
271 } 272 }
272 273
273 // Tests that a window is contained within a given WindowSelectorItem, and 274 // Tests that a window is contained within a given WindowSelectorItem, and
274 // that both the window and its matching close button are within the same 275 // that both the window and its matching close button are within the same
275 // screen. 276 // screen.
276 void IsWindowAndCloseButtonInScreen(aura::Window* window, 277 void IsWindowAndCloseButtonInScreen(aura::Window* window,
277 WindowSelectorItem* window_item) { 278 WindowSelectorItem* window_item) {
278 aura::Window* root_window = window_item->root_window(); 279 aura::Window* root_window =
279 EXPECT_TRUE(window_item->Contains(window)); 280 wm::WmWindowAura::GetAuraWindow(window_item->root_window());
281 EXPECT_TRUE(window_item->Contains(wm::WmWindowAura::Get(window)));
280 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( 282 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains(
281 ToEnclosingRect(GetTransformedTargetBounds(window)))); 283 ToEnclosingRect(GetTransformedTargetBounds(window))));
282 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains( 284 EXPECT_TRUE(root_window->GetBoundsInScreen().Contains(
283 ToEnclosingRect(GetTransformedTargetBounds( 285 ToEnclosingRect(GetTransformedTargetBounds(
284 GetCloseButton(window_item)->GetNativeView())))); 286 GetCloseButton(window_item)->GetNativeView()))));
285 } 287 }
286 288
287 void FilterItems(const base::StringPiece& pattern) { 289 void FilterItems(const base::StringPiece& pattern) {
288 ash::Shell::GetInstance()-> 290 ash::Shell::GetInstance()->
289 window_selector_controller()->window_selector_.get()-> 291 window_selector_controller()->window_selector_.get()->
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 411
410 // Tests that the ordering of windows is near the windows' original positions. 412 // Tests that the ordering of windows is near the windows' original positions.
411 TEST_F(WindowSelectorTest, MinimizeMovement) { 413 TEST_F(WindowSelectorTest, MinimizeMovement) {
412 aura::Window* root_window = Shell::GetPrimaryRootWindow(); 414 aura::Window* root_window = Shell::GetPrimaryRootWindow();
413 gfx::Rect left_bounds(0, 0, root_window->bounds().width() / 2, 415 gfx::Rect left_bounds(0, 0, root_window->bounds().width() / 2,
414 root_window->bounds().height()); 416 root_window->bounds().height());
415 gfx::Rect right_bounds(root_window->bounds().width() / 2, 0, 417 gfx::Rect right_bounds(root_window->bounds().width() / 2, 0,
416 root_window->bounds().width() / 2, 418 root_window->bounds().width() / 2,
417 root_window->bounds().height()); 419 root_window->bounds().height());
418 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds)); 420 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds));
421 wm::WmWindow* left_window_wm = wm::WmWindowAura::Get(left_window.get());
419 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds)); 422 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds));
423 wm::WmWindow* right_window_wm = wm::WmWindowAura::Get(right_window.get());
420 424
421 // The window should stay on the same side of the screen regardless of which 425 // The window should stay on the same side of the screen regardless of which
422 // one was active on entering overview mode. 426 // one was active on entering overview mode.
423 wm::GetWindowState(left_window.get())->Activate(); 427 wm::GetWindowState(left_window.get())->Activate();
424 ToggleOverview(); 428 ToggleOverview();
425 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0)); 429 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0));
426 EXPECT_EQ(overview1[0]->GetWindow(), left_window.get()); 430 EXPECT_EQ(overview1[0]->GetWindow(), left_window_wm);
427 EXPECT_EQ(overview1[1]->GetWindow(), right_window.get()); 431 EXPECT_EQ(overview1[1]->GetWindow(), right_window_wm);
428 ToggleOverview(); 432 ToggleOverview();
429 433
430 // Active the right window, the order should be the same. 434 // Active the right window, the order should be the same.
431 wm::GetWindowState(right_window.get())->Activate(); 435 wm::GetWindowState(right_window.get())->Activate();
432 ToggleOverview(); 436 ToggleOverview();
433 const std::vector<WindowSelectorItem*>& overview2(GetWindowItemsForRoot(0)); 437 const std::vector<WindowSelectorItem*>& overview2(GetWindowItemsForRoot(0));
434 EXPECT_EQ(overview2[0]->GetWindow(), left_window.get()); 438 EXPECT_EQ(overview2[0]->GetWindow(), left_window_wm);
435 EXPECT_EQ(overview2[1]->GetWindow(), right_window.get()); 439 EXPECT_EQ(overview2[1]->GetWindow(), right_window_wm);
436 ToggleOverview(); 440 ToggleOverview();
437 441
438 // Switch the window positions, and the order should be switched. 442 // Switch the window positions, and the order should be switched.
439 left_window->SetBounds(right_bounds); 443 left_window->SetBounds(right_bounds);
440 right_window->SetBounds(left_bounds); 444 right_window->SetBounds(left_bounds);
441 ToggleOverview(); 445 ToggleOverview();
442 const std::vector<WindowSelectorItem*>& overview3(GetWindowItemsForRoot(0)); 446 const std::vector<WindowSelectorItem*>& overview3(GetWindowItemsForRoot(0));
443 EXPECT_EQ(overview3[0]->GetWindow(), right_window.get()); 447 EXPECT_EQ(overview3[0]->GetWindow(), right_window_wm);
444 EXPECT_EQ(overview3[1]->GetWindow(), left_window.get()); 448 EXPECT_EQ(overview3[1]->GetWindow(), left_window_wm);
445 ToggleOverview(); 449 ToggleOverview();
446 } 450 }
447 451
448 // Tests that the ordering of windows is near the windows' original positions 452 // Tests that the ordering of windows is near the windows' original positions
449 // on a second display. 453 // on a second display.
450 TEST_F(WindowSelectorTest, MinimizeMovementSecondDisplay) { 454 TEST_F(WindowSelectorTest, MinimizeMovementSecondDisplay) {
451 if (!SupportsMultipleDisplays()) 455 if (!SupportsMultipleDisplays())
452 return; 456 return;
453 457
454 // Verify the same works on the second display 458 // Verify the same works on the second display
455 UpdateDisplay("400x400,400x400"); 459 UpdateDisplay("400x400,400x400");
456 gfx::Rect left_bounds(400, 0, 200, 400); 460 gfx::Rect left_bounds(400, 0, 200, 400);
457 gfx::Rect right_bounds(600, 0, 200, 400); 461 gfx::Rect right_bounds(600, 0, 200, 400);
458 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds)); 462 std::unique_ptr<aura::Window> left_window(CreateWindow(left_bounds));
463 wm::WmWindow* left_window_wm = wm::WmWindowAura::Get(left_window.get());
459 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds)); 464 std::unique_ptr<aura::Window> right_window(CreateWindow(right_bounds));
465 wm::WmWindow* right_window_wm = wm::WmWindowAura::Get(right_window.get());
460 466
461 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 467 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
462 EXPECT_EQ(root_windows[1], left_window->GetRootWindow()); 468 EXPECT_EQ(root_windows[1], left_window->GetRootWindow());
463 EXPECT_EQ(root_windows[1], right_window->GetRootWindow()); 469 EXPECT_EQ(root_windows[1], right_window->GetRootWindow());
464 470
465 wm::GetWindowState(left_window.get())->Activate(); 471 wm::GetWindowState(left_window.get())->Activate();
466 ToggleOverview(); 472 ToggleOverview();
467 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0)); 473 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0));
468 EXPECT_EQ(overview1[0]->GetWindow(), left_window.get()); 474 EXPECT_EQ(overview1[0]->GetWindow(), left_window_wm);
469 EXPECT_EQ(overview1[1]->GetWindow(), right_window.get()); 475 EXPECT_EQ(overview1[1]->GetWindow(), right_window_wm);
470 ToggleOverview(); 476 ToggleOverview();
471 477
472 // Active the right window, the order should be the same. 478 // Active the right window, the order should be the same.
473 wm::GetWindowState(right_window.get())->Activate(); 479 wm::GetWindowState(right_window.get())->Activate();
474 ToggleOverview(); 480 ToggleOverview();
475 const std::vector<WindowSelectorItem*>& overview2(GetWindowItemsForRoot(0)); 481 const std::vector<WindowSelectorItem*>& overview2(GetWindowItemsForRoot(0));
476 EXPECT_EQ(overview2[0]->GetWindow(), left_window.get()); 482 EXPECT_EQ(overview2[0]->GetWindow(), left_window_wm);
477 EXPECT_EQ(overview2[1]->GetWindow(), right_window.get()); 483 EXPECT_EQ(overview2[1]->GetWindow(), right_window_wm);
478 ToggleOverview(); 484 ToggleOverview();
479 } 485 }
480 486
481 // Tests that the ordering of windows is stable across different overview 487 // Tests that the ordering of windows is stable across different overview
482 // sessions even when the windows have the same bounds. 488 // sessions even when the windows have the same bounds.
483 TEST_F(WindowSelectorTest, StableOrder) { 489 TEST_F(WindowSelectorTest, StableOrder) {
484 gfx::Rect bounds(0, 0, 400, 400); 490 gfx::Rect bounds(0, 0, 400, 400);
485 std::unique_ptr<aura::Window> window1(CreateWindowWithId(bounds, 1)); 491 std::unique_ptr<aura::Window> window1(CreateWindowWithId(bounds, 1));
486 std::unique_ptr<aura::Window> window2(CreateWindowWithId(bounds, 2)); 492 std::unique_ptr<aura::Window> window2(CreateWindowWithId(bounds, 2));
487 493
488 // The initial ordering is not defined, but should remain consistent the next 494 // The initial ordering is not defined, but should remain consistent the next
489 // time overview is started. 495 // time overview is started.
490 wm::GetWindowState(window1.get())->Activate(); 496 wm::GetWindowState(window1.get())->Activate();
491 ToggleOverview(); 497 ToggleOverview();
492 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0)); 498 const std::vector<WindowSelectorItem*>& overview1(GetWindowItemsForRoot(0));
493 int initial_order[2] = {overview1[0]->GetWindow()->id(), 499 int initial_order[2] = {overview1[0]->GetWindow()->GetShellWindowId(),
494 overview1[1]->GetWindow()->id()}; 500 overview1[1]->GetWindow()->GetShellWindowId()};
495 ToggleOverview(); 501 ToggleOverview();
496 502
497 // Activate the other window, the order should be the same. 503 // Activate the other window, the order should be the same.
498 wm::GetWindowState(window2.get())->Activate(); 504 wm::GetWindowState(window2.get())->Activate();
499 ToggleOverview(); 505 ToggleOverview();
500 const std::vector<WindowSelectorItem*>& overview2(GetWindowItemsForRoot(0)); 506 const std::vector<WindowSelectorItem*>& overview2(GetWindowItemsForRoot(0));
501 EXPECT_EQ(initial_order[0], overview2[0]->GetWindow()->id()); 507 EXPECT_EQ(initial_order[0], overview2[0]->GetWindow()->GetShellWindowId());
502 EXPECT_EQ(initial_order[1], overview2[1]->GetWindow()->id()); 508 EXPECT_EQ(initial_order[1], overview2[1]->GetWindow()->GetShellWindowId());
503 ToggleOverview(); 509 ToggleOverview();
504 } 510 }
505 511
506 // Tests entering overview mode with docked windows 512 // Tests entering overview mode with docked windows
507 TEST_F(WindowSelectorTest, BasicWithDocked) { 513 TEST_F(WindowSelectorTest, BasicWithDocked) {
508 // aura::Window* root_window = Shell::GetPrimaryRootWindow(); 514 // aura::Window* root_window = Shell::GetPrimaryRootWindow();
509 gfx::Rect bounds(300, 0, 200, 200); 515 gfx::Rect bounds(300, 0, 200, 200);
510 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); 516 std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
511 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); 517 std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
512 std::unique_ptr<aura::Window> docked1(CreateWindow(bounds)); 518 std::unique_ptr<aura::Window> docked1(CreateWindow(bounds));
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 // Tests traversing some windows in overview mode with the tab key. 1290 // Tests traversing some windows in overview mode with the tab key.
1285 TEST_F(WindowSelectorTest, BasicTabKeyNavigation) { 1291 TEST_F(WindowSelectorTest, BasicTabKeyNavigation) {
1286 gfx::Rect bounds(0, 0, 100, 100); 1292 gfx::Rect bounds(0, 0, 100, 100);
1287 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); 1293 std::unique_ptr<aura::Window> window2(CreateWindow(bounds));
1288 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); 1294 std::unique_ptr<aura::Window> window1(CreateWindow(bounds));
1289 ToggleOverview(); 1295 ToggleOverview();
1290 1296
1291 const std::vector<WindowSelectorItem*>& overview_windows = 1297 const std::vector<WindowSelectorItem*>& overview_windows =
1292 GetWindowItemsForRoot(0); 1298 GetWindowItemsForRoot(0);
1293 SendKey(ui::VKEY_TAB); 1299 SendKey(ui::VKEY_TAB);
1294 EXPECT_EQ(GetSelectedWindow(), overview_windows[0]->GetWindow()); 1300 EXPECT_EQ(GetSelectedWindow(),
1301 wm::WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow()));
1295 SendKey(ui::VKEY_TAB); 1302 SendKey(ui::VKEY_TAB);
1296 EXPECT_EQ(GetSelectedWindow(), overview_windows[1]->GetWindow()); 1303 EXPECT_EQ(GetSelectedWindow(),
1304 wm::WmWindowAura::GetAuraWindow(overview_windows[1]->GetWindow()));
1297 SendKey(ui::VKEY_TAB); 1305 SendKey(ui::VKEY_TAB);
1298 EXPECT_EQ(GetSelectedWindow(), overview_windows[0]->GetWindow()); 1306 EXPECT_EQ(GetSelectedWindow(),
1307 wm::WmWindowAura::GetAuraWindow(overview_windows[0]->GetWindow()));
1299 } 1308 }
1300 1309
1301 // Tests traversing some windows in overview mode with the arrow keys in every 1310 // Tests traversing some windows in overview mode with the arrow keys in every
1302 // possible direction. 1311 // possible direction.
1303 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) { 1312 TEST_F(WindowSelectorTest, BasicArrowKeyNavigation) {
1304 if (!SupportsHostWindowResize()) 1313 if (!SupportsHostWindowResize())
1305 return; 1314 return;
1306 const size_t test_windows = 9; 1315 const size_t test_windows = 9;
1307 UpdateDisplay("800x600"); 1316 UpdateDisplay("800x600");
1308 ScopedVector<aura::Window> windows; 1317 ScopedVector<aura::Window> windows;
(...skipping 30 matching lines...) Expand all
1339 ToggleOverview(); 1348 ToggleOverview();
1340 const std::vector<WindowSelectorItem*>& overview_windows = 1349 const std::vector<WindowSelectorItem*>& overview_windows =
1341 GetWindowItemsForRoot(0); 1350 GetWindowItemsForRoot(0);
1342 for (size_t i = 0; i < test_windows + 1; i++) { 1351 for (size_t i = 0; i < test_windows + 1; i++) {
1343 SendKey(arrow_keys[key_index]); 1352 SendKey(arrow_keys[key_index]);
1344 // TODO(flackr): Add a more readable error message by constructing a 1353 // TODO(flackr): Add a more readable error message by constructing a
1345 // string from the window IDs. 1354 // string from the window IDs.
1346 EXPECT_EQ(GetSelectedWindow()->id(), 1355 EXPECT_EQ(GetSelectedWindow()->id(),
1347 overview_windows[index_path_for_direction[key_index][i] - 1] 1356 overview_windows[index_path_for_direction[key_index][i] - 1]
1348 ->GetWindow() 1357 ->GetWindow()
1349 ->id()); 1358 ->GetShellWindowId());
1350 } 1359 }
1351 ToggleOverview(); 1360 ToggleOverview();
1352 } 1361 }
1353 } 1362 }
1354 1363
1355 // Tests basic selection across multiple monitors. 1364 // Tests basic selection across multiple monitors.
1356 TEST_F(WindowSelectorTest, BasicMultiMonitorArrowKeyNavigation) { 1365 TEST_F(WindowSelectorTest, BasicMultiMonitorArrowKeyNavigation) {
1357 if (!SupportsMultipleDisplays()) 1366 if (!SupportsMultipleDisplays())
1358 return; 1367 return;
1359 1368
1360 UpdateDisplay("400x400,400x400"); 1369 UpdateDisplay("400x400,400x400");
1361 gfx::Rect bounds1(0, 0, 100, 100); 1370 gfx::Rect bounds1(0, 0, 100, 100);
1362 gfx::Rect bounds2(450, 0, 100, 100); 1371 gfx::Rect bounds2(450, 0, 100, 100);
1363 std::unique_ptr<aura::Window> window4(CreateWindow(bounds2)); 1372 std::unique_ptr<aura::Window> window4(CreateWindow(bounds2));
1364 std::unique_ptr<aura::Window> window3(CreateWindow(bounds2)); 1373 std::unique_ptr<aura::Window> window3(CreateWindow(bounds2));
1365 std::unique_ptr<aura::Window> window2(CreateWindow(bounds1)); 1374 std::unique_ptr<aura::Window> window2(CreateWindow(bounds1));
1366 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1)); 1375 std::unique_ptr<aura::Window> window1(CreateWindow(bounds1));
1367 1376
1368 ToggleOverview(); 1377 ToggleOverview();
1369 1378
1370 const std::vector<WindowSelectorItem*>& overview_root1 = 1379 const std::vector<WindowSelectorItem*>& overview_root1 =
1371 GetWindowItemsForRoot(0); 1380 GetWindowItemsForRoot(0);
1372 const std::vector<WindowSelectorItem*>& overview_root2 = 1381 const std::vector<WindowSelectorItem*>& overview_root2 =
1373 GetWindowItemsForRoot(1); 1382 GetWindowItemsForRoot(1);
1374 SendKey(ui::VKEY_RIGHT); 1383 SendKey(ui::VKEY_RIGHT);
1375 EXPECT_EQ(GetSelectedWindow(), overview_root1[0]->GetWindow()); 1384 EXPECT_EQ(GetSelectedWindow(),
1385 wm::WmWindowAura::GetAuraWindow(overview_root1[0]->GetWindow()));
1376 SendKey(ui::VKEY_RIGHT); 1386 SendKey(ui::VKEY_RIGHT);
1377 EXPECT_EQ(GetSelectedWindow(), overview_root1[1]->GetWindow()); 1387 EXPECT_EQ(GetSelectedWindow(),
1388 wm::WmWindowAura::GetAuraWindow(overview_root1[1]->GetWindow()));
1378 SendKey(ui::VKEY_RIGHT); 1389 SendKey(ui::VKEY_RIGHT);
1379 EXPECT_EQ(GetSelectedWindow(), overview_root2[0]->GetWindow()); 1390 EXPECT_EQ(GetSelectedWindow(),
1391 wm::WmWindowAura::GetAuraWindow(overview_root2[0]->GetWindow()));
1380 SendKey(ui::VKEY_RIGHT); 1392 SendKey(ui::VKEY_RIGHT);
1381 EXPECT_EQ(GetSelectedWindow(), overview_root2[1]->GetWindow()); 1393 EXPECT_EQ(GetSelectedWindow(),
1394 wm::WmWindowAura::GetAuraWindow(overview_root2[1]->GetWindow()));
1382 } 1395 }
1383 1396
1384 // Tests first monitor when display order doesn't match left to right screen 1397 // Tests first monitor when display order doesn't match left to right screen
1385 // positions. 1398 // positions.
1386 TEST_F(WindowSelectorTest, MultiMonitorReversedOrder) { 1399 TEST_F(WindowSelectorTest, MultiMonitorReversedOrder) {
1387 if (!SupportsMultipleDisplays()) 1400 if (!SupportsMultipleDisplays())
1388 return; 1401 return;
1389 1402
1390 UpdateDisplay("400x400,400x400"); 1403 UpdateDisplay("400x400,400x400");
1391 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays( 1404 Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 bounds.y()); 1730 bounds.y());
1718 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); 1731 EXPECT_LE(transformed_rect.bottom(), bounds.bottom());
1719 EXPECT_NEAR(transformed_rect.x() - bounds.x(), 1732 EXPECT_NEAR(transformed_rect.x() - bounds.x(),
1720 bounds.right() - transformed_rect.right(), 1); 1733 bounds.right() - transformed_rect.right(), 1);
1721 EXPECT_NEAR( 1734 EXPECT_NEAR(
1722 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), 1735 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(),
1723 bounds.bottom() - transformed_rect.bottom(), 1); 1736 bounds.bottom() - transformed_rect.bottom(), 1);
1724 } 1737 }
1725 1738
1726 } // namespace ash 1739 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_item.cc ('k') | mash/wm/bridge/wm_globals_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698