Commit 10f04d6a authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Back and esc should not exit single splitview.

Test: added test
Bug: 950100
Change-Id: Ia05e481a15ac3c42bdfef075b5f1b930f37f3605
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559253Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649265}
parent c3314088
...@@ -758,7 +758,10 @@ void OverviewSession::OnKeyEvent(ui::KeyEvent* event) { ...@@ -758,7 +758,10 @@ void OverviewSession::OnKeyEvent(ui::KeyEvent* event) {
case ui::VKEY_BROWSER_BACK: case ui::VKEY_BROWSER_BACK:
FALLTHROUGH; FALLTHROUGH;
case ui::VKEY_ESCAPE: case ui::VKEY_ESCAPE:
CancelSelection(); // Cancel overview unless we're in single split mode with no overview
// windows.
if (!(IsEmpty() && Shell::Get()->IsSplitViewModeActive()))
CancelSelection();
break; break;
case ui::VKEY_UP: case ui::VKEY_UP:
num_key_presses_++; num_key_presses_++;
......
...@@ -1421,10 +1421,10 @@ TEST_F(OverviewSessionTest, BasicArrowKeyNavigation) { ...@@ -1421,10 +1421,10 @@ TEST_F(OverviewSessionTest, BasicArrowKeyNavigation) {
} }
} }
// Tests hitting the escape and back keys exit overview mode. // Tests hitting the escape and back keys exit overview mode, unless we're in
// single splitview mode with no windows in overview.
TEST_F(OverviewSessionTest, ExitOverviewWithKey) { TEST_F(OverviewSessionTest, ExitOverviewWithKey) {
std::unique_ptr<aura::Window> window1(CreateTestWindow()); std::unique_ptr<aura::Window> window(CreateTestWindow());
std::unique_ptr<aura::Window> window2(CreateTestWindow());
ToggleOverview(); ToggleOverview();
ASSERT_TRUE(overview_controller()->IsSelecting()); ASSERT_TRUE(overview_controller()->IsSelecting());
...@@ -1435,6 +1435,18 @@ TEST_F(OverviewSessionTest, ExitOverviewWithKey) { ...@@ -1435,6 +1435,18 @@ TEST_F(OverviewSessionTest, ExitOverviewWithKey) {
ASSERT_TRUE(overview_controller()->IsSelecting()); ASSERT_TRUE(overview_controller()->IsSelecting());
SendKey(ui::VKEY_BROWSER_BACK); SendKey(ui::VKEY_BROWSER_BACK);
EXPECT_FALSE(overview_controller()->IsSelecting()); EXPECT_FALSE(overview_controller()->IsSelecting());
// Tests that if we snap the only overview window, we cannot exit overview
// mode.
ToggleOverview();
ASSERT_TRUE(overview_controller()->IsSelecting());
Shell::Get()->split_view_controller()->SnapWindow(window.get(),
SplitViewController::LEFT);
ASSERT_TRUE(overview_controller()->IsSelecting());
SendKey(ui::VKEY_ESCAPE);
EXPECT_TRUE(overview_controller()->IsSelecting());
SendKey(ui::VKEY_BROWSER_BACK);
EXPECT_TRUE(overview_controller()->IsSelecting());
} }
// Regression test for clusterfuzz crash. https://crbug.com/920568 // Regression test for clusterfuzz crash. https://crbug.com/920568
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment