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

Unified Diff: chrome/test/ui_test_utils.h

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
Index: chrome/test/ui_test_utils.h
diff --git a/chrome/test/ui_test_utils.h b/chrome/test/ui_test_utils.h
index 8173348a8289dda5cecadab64cf2cb1212946aed..bb7b2580c48a71aca95e912bfedea670cf985363 100644
--- a/chrome/test/ui_test_utils.h
+++ b/chrome/test/ui_test_utils.h
@@ -10,8 +10,8 @@
#include <string>
#include <set>
-#include "gfx/native_widget_types.h"
#include "base/basictypes.h"
+#include "base/keyboard_codes.h"
#include "base/message_loop.h"
#include "base/scoped_temp_dir.h"
#include "base/string16.h"
@@ -21,6 +21,7 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/notification_service.h"
#include "chrome/test/automation/dom_element_proxy.h"
+#include "gfx/native_widget_types.h"
class AppModalDialog;
class BookmarkModel;
@@ -188,6 +189,18 @@ void RegisterAndWait(NotificationObserver* observer,
// Blocks until |model| finishes loading.
void WaitForBookmarkModelToLoad(BookmarkModel* model);
+// Sends a key press blocking until the key press is received or the test times
+// out. This uses ui_controls::SendKeyPress, see it for details. Returns true
+// if the event was successfully sent and received.
+// The proper way to use this in a test is:
Paweł Hajdan Jr. 2010/08/21 02:44:28 nit: I suggest to remove the "The proper way to us
+// ASSERT_TRUE(ui_test_utils::Send...).
+bool SendKeyPressSync(gfx::NativeWindow window,
+ base::KeyboardCode key,
+ bool control,
+ bool shift,
+ bool alt,
+ bool command) WARN_UNUSED_RESULT;
+
// Run a message loop only for the specified amount of time.
class TimedMessageLoopRunner {
public:

Powered by Google App Engine
This is Rietveld 408576698