Chromium Code Reviews| 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/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
| 10 #include "ash/common/accessibility_types.h" | 10 #include "ash/common/accessibility_types.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 // Clicking window 1 should activate it. | 446 // Clicking window 1 should activate it. |
| 447 ClickWindow(window1.get()); | 447 ClickWindow(window1.get()); |
| 448 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); | 448 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); |
| 449 EXPECT_FALSE(wm::IsActiveWindow(window2.get())); | 449 EXPECT_FALSE(wm::IsActiveWindow(window2.get())); |
| 450 EXPECT_EQ(window1.get(), GetFocusedWindow()); | 450 EXPECT_EQ(window1.get(), GetFocusedWindow()); |
| 451 | 451 |
| 452 // Cursor should have been unlocked. | 452 // Cursor should have been unlocked. |
| 453 EXPECT_FALSE(aura::client::GetCursorClient(root_window)->IsCursorLocked()); | 453 EXPECT_FALSE(aura::client::GetCursorClient(root_window)->IsCursorLocked()); |
| 454 } | 454 } |
| 455 | 455 |
| 456 // Tests that entering overview mode with an App-list active properly focuses | |
| 457 // and activates the overview text filter window. | |
| 458 TEST_P(WindowSelectorTest, TextFilterActive) { | |
| 459 gfx::Rect bounds(0, 0, 400, 400); | |
| 460 std::unique_ptr<aura::Window> window1(CreateWindow(bounds)); | |
| 461 wm::ActivateWindow(window1.get()); | |
| 462 | |
| 463 EXPECT_TRUE(wm::IsActiveWindow(window1.get())); | |
| 464 EXPECT_EQ(window1.get(), GetFocusedWindow()); | |
| 465 | |
| 466 WmShell::Get()->ToggleAppList(); | |
| 467 | |
| 468 // Activating overview cancels the App-list which normally would activate the | |
| 469 // previously active |window1|. Overview mode should properly transfer focus | |
| 470 // and activation to the text filter widget. | |
| 471 ToggleOverview(); | |
| 472 EXPECT_FALSE(wm::IsActiveWindow(window1.get())); | |
| 473 EXPECT_TRUE(wm::IsActiveWindow(GetFocusedWindow())); | |
| 474 EXPECT_EQ(text_filter_widget()->GetNativeWindow(), GetFocusedWindow()); | |
| 475 } | |
|
James Cook
2016/08/10 15:55:59
Nice test. Easy to read.
varkha
2016/08/10 16:04:54
Acknowledged.
| |
| 476 | |
| 456 // Tests that the ordering of windows is near the windows' original positions. | 477 // Tests that the ordering of windows is near the windows' original positions. |
| 457 TEST_P(WindowSelectorTest, MinimizeMovement) { | 478 TEST_P(WindowSelectorTest, MinimizeMovement) { |
| 458 // With Material Design the order of windows in overview mode is MRU. | 479 // With Material Design the order of windows in overview mode is MRU. |
| 459 if (ash::MaterialDesignController::IsOverviewMaterial()) | 480 if (ash::MaterialDesignController::IsOverviewMaterial()) |
| 460 return; | 481 return; |
| 461 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 482 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
| 462 gfx::Rect left_bounds(0, 0, root_window->bounds().width() / 2, | 483 gfx::Rect left_bounds(0, 0, root_window->bounds().width() / 2, |
| 463 root_window->bounds().height()); | 484 root_window->bounds().height()); |
| 464 gfx::Rect right_bounds(root_window->bounds().width() / 2, 0, | 485 gfx::Rect right_bounds(root_window->bounds().width() / 2, 0, |
| 465 root_window->bounds().width() / 2, | 486 root_window->bounds().width() / 2, |
| (...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2058 bounds.y()); | 2079 bounds.y()); |
| 2059 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); | 2080 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); |
| 2060 EXPECT_NEAR(transformed_rect.x() - bounds.x(), | 2081 EXPECT_NEAR(transformed_rect.x() - bounds.x(), |
| 2061 bounds.right() - transformed_rect.right(), 1); | 2082 bounds.right() - transformed_rect.right(), 1); |
| 2062 EXPECT_NEAR( | 2083 EXPECT_NEAR( |
| 2063 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), | 2084 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), |
| 2064 bounds.bottom() - transformed_rect.bottom(), 1); | 2085 bounds.bottom() - transformed_rect.bottom(), 1); |
| 2065 } | 2086 } |
| 2066 | 2087 |
| 2067 } // namespace ash | 2088 } // namespace ash |
| OLD | NEW |