Commit 5e8ca713 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Fix crash when exit after using Ctrl Shift U.

We should instead prevent Ctrl Shift U mode in overview somehow, but this
will stop the crash in the meantime.

Test: ash_unittests WindowSelectorTest.ExitInUnderlineMode
Bug: 807517
Change-Id: Ie7d889937c110583454a281a318b682f62cd6084
Reviewed-on: https://chromium-review.googlesource.com/932547Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540664}
parent 94936726
......@@ -757,6 +757,12 @@ void WindowSelector::OnAttemptToReactivateWindow(aura::Window* request_active,
void WindowSelector::ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) {
// If the user enters underline mode via CTRL+SHIFT+U, ContentsChanged
// will get called after shutdown has started. Prevent anything from
// happening if shutdown has started (grids have been cleared).
if (grid_list_.size() < 1)
return;
text_filter_string_length_ = new_contents.length();
if (!text_filter_string_length_)
num_times_textfield_cleared_++;
......
......@@ -2713,6 +2713,25 @@ TEST_F(WindowSelectorTest, Backdrop) {
ToggleOverview();
}
// Verify that the system does not crash when exiting overview mode after
// pressing CTRL+SHIFT+U.
TEST_F(WindowSelectorTest, ExitInUnderlineMode) {
std::unique_ptr<aura::Window> window(
CreateWindow(gfx::Rect(10, 10, 200, 200)));
ToggleOverview();
// Enter underline mode on the text selector by generating CTRL+SHIFT+U
// sequence.
GetEventGenerator().PressKey(ui::VKEY_U,
ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN);
GetEventGenerator().ReleaseKey(ui::VKEY_U,
ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN);
// Test that leaving overview mode cleans up properly.
ToggleOverview();
}
class SplitViewWindowSelectorTest : public WindowSelectorTest {
public:
SplitViewWindowSelectorTest() = default;
......
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