Commit 4cafcc36 authored by Maksim Sisov's avatar Maksim Sisov Committed by Commit Bot

Fix flakiness in DesktopWindowTreeHostX11Test.InputMethodFocus

ActivationWaiter should be created as early as possible so that
PropertyNotify has time to be set before the widget is activated.

Otherwise, the waiter can miss that event, and the test times out.

Bug: 955316
Change-Id: I0e993e2aacdf8a2a97bfdeeeab75c7312c9259b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2169886Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Maksim Sisov <msisov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#763430}
parent 893f002d
......@@ -234,6 +234,12 @@ TEST_F(DesktopWindowTreeHostX11Test, CaptureEventForwarding) {
TEST_F(DesktopWindowTreeHostX11Test, InputMethodFocus) {
std::unique_ptr<Widget> widget(CreateWidget(gfx::Rect(100, 100, 100, 100)));
// Waiter should be created as early as possible so that PropertyNotify has
// time to be set before widget is activated.
ActivationWaiter waiter(
widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
std::unique_ptr<Textfield> textfield(new Textfield);
textfield->SetBounds(0, 0, 200, 20);
widget->GetRootView()->AddChildView(textfield.get());
......@@ -246,11 +252,6 @@ TEST_F(DesktopWindowTreeHostX11Test, InputMethodFocus) {
// EXPECT_EQ(ui::TEXT_INPUT_TYPE_NONE,
// widget->GetInputMethod()->GetTextInputType());
// Waiter should be created before widget->Activate is called. Otherwise,
// there is a race, and waiter might not be able to set property changes mask
// on time and miss the events.
ActivationWaiter waiter(
widget->GetNativeWindow()->GetHost()->GetAcceleratedWidget());
widget->Activate();
waiter.Wait();
......
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