Commit b31338ef authored by Katie D's avatar Katie D Committed by Commit Bot

Fix crash when dragging Select to Speak box and mousewheel event.

Bug: 1047957
Change-Id: Ied78b3132b920698f7e5178c72e1583627f10b49
AX-Relnotes: Fixes crash when dragging STS box and doing a mousewheel.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2216376Reviewed-by: default avatarAnastasia Helfinstein <anastasi@google.com>
Commit-Queue: Katie Dektar <katie@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772067}
parent 191587c8
......@@ -306,6 +306,27 @@ IN_PROC_BROWSER_TEST_F(SelectToSpeakTestWithLanguageDetection,
sm_.Replay();
}
IN_PROC_BROWSER_TEST_F(SelectToSpeakTest, DoesNotCrashWithMousewheelEvent) {
ui_test_utils::NavigateToURL(
browser(), GURL("data:text/html;charset=utf-8,<p>This is some text</p>"));
gfx::Rect bounds = GetWebContentsBounds();
// Hold down Search and drag over the web contents to select everything.
generator_->PressKey(ui::VKEY_LWIN, 0 /* flags */);
generator_->MoveMouseTo(bounds.x(), bounds.y());
generator_->PressLeftButton();
// Ensure this does not crash. It should have no effect.
generator_->MoveMouseWheel(10, 10);
generator_->MoveMouseTo(bounds.x() + bounds.width(),
bounds.y() + bounds.height());
generator_->MoveMouseWheel(100, 5);
generator_->ReleaseLeftButton();
generator_->ReleaseKey(ui::VKEY_LWIN, 0 /* flags */);
sm_.ExpectSpeechPattern("This is some text*");
sm_.Replay();
}
// Flaky test: crbug.com/950049.
IN_PROC_BROWSER_TEST_F(SelectToSpeakTest, DISABLED_FocusRingMovesWithMouse) {
// Create a callback for the focus ring observer.
......
......@@ -54,6 +54,10 @@ void SelectToSpeakEventHandlerDelegate::DispatchMouseEvent(
// don't ever try to run this code on some other thread.
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
// MouseWheel not handled by ui::MakeWebMouseEvent.
if (event.type() == ui::EventType::ET_MOUSEWHEEL)
return;
extensions::ExtensionHost* host = chromeos::GetAccessibilityExtensionHost(
extension_misc::kSelectToSpeakExtensionId);
if (!host)
......
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