diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 18:23:19 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 18:23:19 +0000 |
commit | 85bbc6e2f370be457537ea552a8fe694f609960a (patch) | |
tree | c793fad86daf8c4fa3546f00b97cb74df6bf50fb | |
parent | c499d08ff59eae8bfae79ed3ea2d21178790a5c7 (diff) | |
download | chromium_src-85bbc6e2f370be457537ea552a8fe694f609960a.zip chromium_src-85bbc6e2f370be457537ea552a8fe694f609960a.tar.gz chromium_src-85bbc6e2f370be457537ea552a8fe694f609960a.tar.bz2 |
Fixes bug in WindowSimulateDrag that was leading to test flake. The
problem is sending escape isn't synchornous, so we have to wait for it
to be processed.
BUG=21092
TEST=none
Review URL: http://codereview.chromium.org/3411003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59403 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/automation/automation_provider_win.cc | 29 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_dragging_test.cc | 3 |
2 files changed, 20 insertions, 12 deletions
diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc index 3495991..86dfec1 100644 --- a/chrome/browser/automation/automation_provider_win.cc +++ b/chrome/browser/automation/automation_provider_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,6 +24,7 @@ #include "chrome/browser/views/bookmark_bar_view.h" #include "chrome/common/page_zoom.h" #include "chrome/test/automation/automation_messages.h" +#include "views/focus/accelerator_handler.h" #include "views/widget/root_view.h" #include "views/widget/widget_win.h" #include "views/window/window.h" @@ -199,15 +200,23 @@ void AutomationProvider::WindowSimulateDrag(int handle, MoveMouse(end); if (press_escape_en_route) { - // Press Escape. - ui_controls::SendKeyPress(window, app::VKEY_ESCAPE, - ((flags & views::Event::EF_CONTROL_DOWN) - == views::Event::EF_CONTROL_DOWN), - ((flags & views::Event::EF_SHIFT_DOWN) == - views::Event::EF_SHIFT_DOWN), - ((flags & views::Event::EF_ALT_DOWN) == - views::Event::EF_ALT_DOWN), - false); + // Press Escape, making sure we wait until chrome processes the escape. + // TODO(phajdan.jr): make this use ui_test_utils::SendKeyPressSync. + ui_controls::SendKeyPressNotifyWhenDone( + window, app::VKEY_ESCAPE, + ((flags & views::Event::EF_CONTROL_DOWN) == + views::Event::EF_CONTROL_DOWN), + ((flags & views::Event::EF_SHIFT_DOWN) == + views::Event::EF_SHIFT_DOWN), + ((flags & views::Event::EF_ALT_DOWN) == views::Event::EF_ALT_DOWN), + false, + new MessageLoop::QuitTask()); + MessageLoopForUI* loop = MessageLoopForUI::current(); + bool did_allow_task_nesting = loop->NestableTasksAllowed(); + loop->SetNestableTasksAllowed(true); + views::AcceleratorHandler handler; + loop->Run(&handler); + loop->SetNestableTasksAllowed(did_allow_task_nesting); } SendMessage(top_level_hwnd, up_message, wparam_flags, MAKELPARAM(end.x, end.y)); diff --git a/chrome/browser/views/tabs/tab_dragging_test.cc b/chrome/browser/views/tabs/tab_dragging_test.cc index a9238d6..6e4c369 100644 --- a/chrome/browser/views/tabs/tab_dragging_test.cc +++ b/chrome/browser/views/tabs/tab_dragging_test.cc @@ -30,8 +30,7 @@ // Disabled on Toolkit views bot. See http://crbug.com/42614 #define MAYBE_Tab1Tab3Escape DISABLED_Tab1Tab3Escape #else -// Flaky, see http://crbug.com/21092. -#define MAYBE_Tab1Tab3Escape FLAKY_Tab1Tab3Escape +#define MAYBE_Tab1Tab3Escape Tab1Tab3Escape #endif // These tests fail on Linux because we haven't implemented all of tab dragging |