| OLD | NEW |
| 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/accessibility_types.h" | 9 #include "ash/accessibility_types.h" |
| 10 #include "ash/drag_drop/drag_drop_controller.h" | 10 #include "ash/drag_drop/drag_drop_controller.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 gfx::Rect bounds(0, 0, 400, 400); | 509 gfx::Rect bounds(0, 0, 400, 400); |
| 510 std::unique_ptr<aura::Window> window1(CreateWindowWithId(bounds, 1)); | 510 std::unique_ptr<aura::Window> window1(CreateWindowWithId(bounds, 1)); |
| 511 std::unique_ptr<aura::Window> window2(CreateWindowWithId(bounds, 2)); | 511 std::unique_ptr<aura::Window> window2(CreateWindowWithId(bounds, 2)); |
| 512 std::unique_ptr<aura::Window> window3(CreateWindowWithId(bounds, 3)); | 512 std::unique_ptr<aura::Window> window3(CreateWindowWithId(bounds, 3)); |
| 513 | 513 |
| 514 // The order of windows in overview mode is MRU. | 514 // The order of windows in overview mode is MRU. |
| 515 wm::GetWindowState(window1.get())->Activate(); | 515 wm::GetWindowState(window1.get())->Activate(); |
| 516 ToggleOverview(); | 516 ToggleOverview(); |
| 517 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview1 = | 517 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview1 = |
| 518 GetWindowItemsForRoot(0); | 518 GetWindowItemsForRoot(0); |
| 519 EXPECT_EQ(1, overview1[0]->GetWindow()->GetShellWindowId()); | 519 EXPECT_EQ(1, overview1[0]->GetWindow()->aura_window()->id()); |
| 520 EXPECT_EQ(3, overview1[1]->GetWindow()->GetShellWindowId()); | 520 EXPECT_EQ(3, overview1[1]->GetWindow()->aura_window()->id()); |
| 521 EXPECT_EQ(2, overview1[2]->GetWindow()->GetShellWindowId()); | 521 EXPECT_EQ(2, overview1[2]->GetWindow()->aura_window()->id()); |
| 522 ToggleOverview(); | 522 ToggleOverview(); |
| 523 | 523 |
| 524 // Activate the second window. | 524 // Activate the second window. |
| 525 wm::GetWindowState(window2.get())->Activate(); | 525 wm::GetWindowState(window2.get())->Activate(); |
| 526 ToggleOverview(); | 526 ToggleOverview(); |
| 527 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview2 = | 527 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview2 = |
| 528 GetWindowItemsForRoot(0); | 528 GetWindowItemsForRoot(0); |
| 529 | 529 |
| 530 // The order should be MRU. | 530 // The order should be MRU. |
| 531 EXPECT_EQ(2, overview2[0]->GetWindow()->GetShellWindowId()); | 531 EXPECT_EQ(2, overview2[0]->GetWindow()->aura_window()->id()); |
| 532 EXPECT_EQ(1, overview2[1]->GetWindow()->GetShellWindowId()); | 532 EXPECT_EQ(1, overview2[1]->GetWindow()->aura_window()->id()); |
| 533 EXPECT_EQ(3, overview2[2]->GetWindow()->GetShellWindowId()); | 533 EXPECT_EQ(3, overview2[2]->GetWindow()->aura_window()->id()); |
| 534 ToggleOverview(); | 534 ToggleOverview(); |
| 535 } | 535 } |
| 536 | 536 |
| 537 // Tests selecting a window by tapping on it. | 537 // Tests selecting a window by tapping on it. |
| 538 TEST_F(WindowSelectorTest, BasicGesture) { | 538 TEST_F(WindowSelectorTest, BasicGesture) { |
| 539 gfx::Rect bounds(0, 0, 400, 400); | 539 gfx::Rect bounds(0, 0, 400, 400); |
| 540 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | 540 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); |
| 541 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); | 541 std::unique_ptr<aura::Window> window2(CreateWindow(bounds)); |
| 542 wm::ActivateWindow(window1.get()); | 542 wm::ActivateWindow(window1.get()); |
| 543 EXPECT_EQ(window1.get(), wm::GetFocusedWindow()); | 543 EXPECT_EQ(window1.get(), wm::GetFocusedWindow()); |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 for (size_t key_index = 0; key_index < arraysize(arrow_keys); key_index++) { | 1396 for (size_t key_index = 0; key_index < arraysize(arrow_keys); key_index++) { |
| 1397 ToggleOverview(); | 1397 ToggleOverview(); |
| 1398 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview_windows = | 1398 const std::vector<std::unique_ptr<WindowSelectorItem>>& overview_windows = |
| 1399 GetWindowItemsForRoot(0); | 1399 GetWindowItemsForRoot(0); |
| 1400 for (size_t i = 0; i < test_windows + 1; i++) { | 1400 for (size_t i = 0; i < test_windows + 1; i++) { |
| 1401 SendKey(arrow_keys[key_index]); | 1401 SendKey(arrow_keys[key_index]); |
| 1402 // TODO(flackr): Add a more readable error message by constructing a | 1402 // TODO(flackr): Add a more readable error message by constructing a |
| 1403 // string from the window IDs. | 1403 // string from the window IDs. |
| 1404 const int index = index_path_for_direction[key_index][i]; | 1404 const int index = index_path_for_direction[key_index][i]; |
| 1405 EXPECT_EQ(GetSelectedWindow()->id(), | 1405 EXPECT_EQ(GetSelectedWindow()->id(), |
| 1406 overview_windows[index - 1]->GetWindow()->GetShellWindowId()); | 1406 overview_windows[index - 1]->GetWindow()->aura_window()->id()); |
| 1407 } | 1407 } |
| 1408 ToggleOverview(); | 1408 ToggleOverview(); |
| 1409 } | 1409 } |
| 1410 } | 1410 } |
| 1411 | 1411 |
| 1412 // Tests basic selection across multiple monitors. | 1412 // Tests basic selection across multiple monitors. |
| 1413 TEST_F(WindowSelectorTest, BasicMultiMonitorArrowKeyNavigation) { | 1413 TEST_F(WindowSelectorTest, BasicMultiMonitorArrowKeyNavigation) { |
| 1414 UpdateDisplay("400x400,400x400"); | 1414 UpdateDisplay("400x400,400x400"); |
| 1415 gfx::Rect bounds1(0, 0, 100, 100); | 1415 gfx::Rect bounds1(0, 0, 100, 100); |
| 1416 gfx::Rect bounds2(450, 0, 100, 100); | 1416 gfx::Rect bounds2(450, 0, 100, 100); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1854 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); | 1854 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); |
| 1855 ASSERT_TRUE(resizer.get()); | 1855 ASSERT_TRUE(resizer.get()); |
| 1856 gfx::Point location = resizer->GetInitialLocation(); | 1856 gfx::Point location = resizer->GetInitialLocation(); |
| 1857 location.Offset(20, 20); | 1857 location.Offset(20, 20); |
| 1858 resizer->Drag(location, 0); | 1858 resizer->Drag(location, 0); |
| 1859 ToggleOverview(); | 1859 ToggleOverview(); |
| 1860 resizer->RevertDrag(); | 1860 resizer->RevertDrag(); |
| 1861 } | 1861 } |
| 1862 | 1862 |
| 1863 } // namespace ash | 1863 } // namespace ash |
| OLD | NEW |