summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/ui_controls_internal.h
diff options
context:
space:
mode:
authorsuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-27 21:17:57 +0000
committersuzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-27 21:17:57 +0000
commit853300a85cf5390d7e7e25fcf5acf391306c94f8 (patch)
tree00d89c84c2855562fed93e64f04a3180eb70d99b /chrome/browser/automation/ui_controls_internal.h
parent7fdad3a542e60dd9426e103b813421f3d1b37b40 (diff)
downloadchromium_src-853300a85cf5390d7e7e25fcf5acf391306c94f8.zip
chromium_src-853300a85cf5390d7e7e25fcf5acf391306c94f8.tar.gz
chromium_src-853300a85cf5390d7e7e25fcf5acf391306c94f8.tar.bz2
[Mac]Port browser_keyevents_browsertest.cc and browser_focus_uitest.cc to Mac.
This CL includes: 1. Implementation of ui_test_utils_mac.mm 2. Fix for ui_controls_mac.mm 3. Port browser_keyevents_browsertest.cc to Mac and add some new tests for Mac. 4. Partially port browser_focus_uitest.cc to Mac, now can be compiled and run on Mac but some tests fail. 5. Add two functions into ui_test_utils.h: HideNativeWindow() and ShowAndFocusNativeWindow(). The latter one shows a window and grabs the input focus, which is useful for tests depending on fake keyboard/mouse events. Because browser_keyevents_browsertests.cc and browser_focus_uitest.cc belong to interactive_ui_tests, which is not available on Mac (see http://crbug.com/21276), in order to test them on Mac, you may want to move them into browser_tests locally. But it won't work on build and try bots, because these tests must be run with screen unlocked. This CL depends on CL: http://codereview.chromium.org/2973004 and http://codereview.chromium.org/2805075 BUG=22515 Keyboard handling needs unit tests BUG=48671 interactive_ui_test: BrowserKeyEventsTest.NormalKeyEvents is flaky BUG=48936 Browser window is opened inactivated when running an InProcessBrowserTest. TEST=none Review URL: http://codereview.chromium.org/2986004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53840 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/ui_controls_internal.h')
-rw-r--r--chrome/browser/automation/ui_controls_internal.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/chrome/browser/automation/ui_controls_internal.h b/chrome/browser/automation/ui_controls_internal.h
new file mode 100644
index 0000000..88631c9
--- /dev/null
+++ b/chrome/browser/automation/ui_controls_internal.h
@@ -0,0 +1,40 @@
+// 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.
+
+#ifndef CHROME_BROWSER_AUTOMATION_UI_CONTROLS_INTERNAL_H_
+#define CHROME_BROWSER_AUTOMATION_UI_CONTROLS_INTERNAL_H_
+
+#include "base/message_loop.h"
+#include "chrome/browser/automation/ui_controls.h"
+
+namespace ui_controls {
+
+// A utility class to send a mouse click event in a task.
+// It's shared by ui_controls_linux.cc and ui_controls_mac.cc
+class ClickTask : public Task {
+ public:
+ // A |followup| Task can be specified to notify the caller when the mouse
+ // click event is sent. If can be NULL if the caller does not care about it.
+ ClickTask(MouseButton button, int state, Task* followup)
+ : button_(button), state_(state), followup_(followup) {
+ }
+
+ virtual ~ClickTask() {}
+
+ virtual void Run() {
+ if (followup_)
+ SendMouseEventsNotifyWhenDone(button_, state_, followup_);
+ else
+ SendMouseEvents(button_, state_);
+ }
+
+ private:
+ MouseButton button_;
+ int state_;
+ Task* followup_;
+};
+
+} // ui_controls
+
+#endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_INTERNAL_H_