Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5628)

Unified Diff: chrome/test/ui_test_utils.cc

Issue 3117030: Adds ui_test_utils::SendAndWaitForKeyPress and converts callers (where (Closed)
Patch Set: Addressed review comments Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/test/ui_test_utils.h ('K') | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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),
« chrome/test/ui_test_utils.h ('K') | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698