OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 5 #ifndef CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
6 #define CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 6 #define CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include <wtypes.h> | 12 #include <wtypes.h> |
13 #endif | 13 #endif |
14 | 14 |
| 15 #include "base/keyboard_codes.h" |
15 #include "gfx/native_widget_types.h" | 16 #include "gfx/native_widget_types.h" |
16 #include "gfx/point.h" | 17 #include "gfx/point.h" |
17 #include "base/keyboard_codes.h" | |
18 | 18 |
19 #if defined(TOOLKIT_VIEWS) | 19 #if defined(TOOLKIT_VIEWS) |
20 namespace views { | 20 namespace views { |
21 class View; | 21 class View; |
22 } | 22 } |
23 #endif | 23 #endif |
24 | 24 |
25 class Task; | 25 class Task; |
26 | 26 |
27 namespace ui_controls { | 27 namespace ui_controls { |
28 | 28 |
29 // Many of the functions in this class include a variant that takes a Task. | 29 // Many of the functions in this class include a variant that takes a Task. |
30 // The version that takes a Task waits until the generated event is processed. | 30 // The version that takes a Task waits until the generated event is processed. |
31 // Once the generated event is processed the Task is Run (and deleted). Note | 31 // Once the generated event is processed the Task is Run (and deleted). Note |
32 // that this is a somewhat fragile process in that any event of the correct | 32 // that this is a somewhat fragile process in that any event of the correct |
33 // type (key down, mouse click, etc.) will trigger the Task to be run. Hence | 33 // type (key down, mouse click, etc.) will trigger the Task to be run. Hence |
34 // a usage such as | 34 // a usage such as |
35 // | 35 // |
36 // SendKeyPress(...); | 36 // SendKeyPress(...); |
37 // SendKeyPressNotifyWhenDone(..., task); | 37 // SendKeyPressNotifyWhenDone(..., task); |
38 // | 38 // |
39 // might trigger |task| early. | 39 // might trigger |task| early. |
40 // | 40 // |
41 // Note: Windows does not currently do anything with the |window| argument for | 41 // Note: Windows does not currently do anything with the |window| argument for |
42 // these functions, so passing NULL is ok. | 42 // these functions, so passing NULL is ok. |
43 | 43 |
44 // Send a key press with/without modifier keys. | 44 // Send a key press with/without modifier keys. |
| 45 // |
| 46 // If you're writing a test chances are you want the variant in ui_test_utils. |
| 47 // See it for details. |
45 bool SendKeyPress(gfx::NativeWindow window, | 48 bool SendKeyPress(gfx::NativeWindow window, |
46 base::KeyboardCode key, | 49 base::KeyboardCode key, |
47 bool control, | 50 bool control, |
48 bool shift, | 51 bool shift, |
49 bool alt, | 52 bool alt, |
50 bool command); | 53 bool command); |
51 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, | 54 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, |
52 base::KeyboardCode key, | 55 base::KeyboardCode key, |
53 bool control, | 56 bool control, |
54 bool shift, | 57 bool shift, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #elif defined(OS_MACOSX) | 93 #elif defined(OS_MACOSX) |
91 NSView* view, | 94 NSView* view, |
92 #endif | 95 #endif |
93 MouseButton button, | 96 MouseButton button, |
94 int state, | 97 int state, |
95 Task* task); | 98 Task* task); |
96 | 99 |
97 } // ui_controls | 100 } // ui_controls |
98 | 101 |
99 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ | 102 #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ |
OLD | NEW |