Index: chrome/test/ui_test_utils.cc |
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc |
index 3d36b6e5ad69df72b19c087f5389e31ce8ff8f24..68a8eef0be295dbadd8cb1483646d66a6d42b72c 100644 |
--- a/chrome/test/ui_test_utils.cc |
+++ b/chrome/test/ui_test_utils.cc |
@@ -14,6 +14,7 @@ |
#include "base/process_util.h" |
#include "base/utf_string_conversions.h" |
#include "base/values.h" |
+#include "chrome/browser/automation/ui_controls.h" |
#include "chrome/browser/browser.h" |
#include "chrome/browser/browser_list.h" |
#include "chrome/browser/dom_operation_notification_details.h" |
@@ -549,6 +550,24 @@ void WaitForBookmarkModelToLoad(BookmarkModel* model) { |
ASSERT_TRUE(model->IsLoaded()); |
} |
+bool SendKeyPressSync(gfx::NativeWindow window, |
+ base::KeyboardCode key, |
+ bool control, |
+ bool shift, |
+ bool alt, |
+ bool command) { |
+ if (!ui_controls::SendKeyPressNotifyWhenDone( |
+ window, key, control, shift, alt, command, |
+ new MessageLoop::QuitTask())) { |
+ DLOG(ERROR) << "ui_controls::SendKeyPressNotifyWhenDone failed"; |
Paweł Hajdan Jr.
2010/08/21 02:44:28
nit: You can consider using LOG instead of DLOG he
|
+ return false; |
+ } |
+ // Run the message loop, it'll quit because either the key was received or the |
Paweł Hajdan Jr.
2010/08/21 02:44:28
nit: I think this comment is confusing. I'd rather
|
+ // test timed out. |
+ RunMessageLoop(); |
+ return !testing::Test::HasFatalFailure(); |
+} |
+ |
TimedMessageLoopRunner::TimedMessageLoopRunner() |
: loop_(new MessageLoopForUI()), |
owned_(true), |