| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 int modifiers, | 72 int modifiers, |
| 73 WebKit::WebMouseEvent::Button button, | 73 WebKit::WebMouseEvent::Button button, |
| 74 const gfx::Point& point); | 74 const gfx::Point& point); |
| 75 | 75 |
| 76 // Simulates asynchronously a mouse enter/move/leave event. | 76 // Simulates asynchronously a mouse enter/move/leave event. |
| 77 void SimulateMouseEvent(WebContents* web_contents, | 77 void SimulateMouseEvent(WebContents* web_contents, |
| 78 WebKit::WebInputEvent::Type type, | 78 WebKit::WebInputEvent::Type type, |
| 79 const gfx::Point& point); | 79 const gfx::Point& point); |
| 80 | 80 |
| 81 // Sends a key press asynchronously. | 81 // Sends a key press asynchronously. |
| 82 // The native code of the key event will be set to InvalidNativeKeycode(). | |
| 83 // |key_code| alone is good enough for scenarios that only need the char | |
| 84 // value represented by a key event and not the physical key on the keyboard | |
| 85 // or the keyboard layout. | |
| 86 // For scenarios such as chromoting that need the native code, | |
| 87 // SimulateKeyPressWithCode should be used. | |
| 88 void SimulateKeyPress(WebContents* web_contents, | 82 void SimulateKeyPress(WebContents* web_contents, |
| 89 ui::KeyboardCode key_code, | 83 ui::KeyboardCode key, |
| 90 bool control, | 84 bool control, |
| 91 bool shift, | 85 bool shift, |
| 92 bool alt, | 86 bool alt, |
| 93 bool command); | 87 bool command); |
| 94 | 88 |
| 95 // Sends a key press asynchronously. | |
| 96 // |code| specifies the UIEvents (aka: DOM4Events) value of the key: | |
| 97 // https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm | |
| 98 // The native code of the key event will be set based on |code|. | |
| 99 // See ui/base/keycodes/vi usb_keycode_map.h for mappings between |code| | |
| 100 // and the native code. | |
| 101 // Examples of the various codes: | |
| 102 // key_code: VKEY_A | |
| 103 // code: "KeyA" | |
| 104 // native key code: 0x001e (for Windows). | |
| 105 // native key code: 0x0026 (for Linux). | |
| 106 void SimulateKeyPressWithCode(WebContents* web_contents, | |
| 107 ui::KeyboardCode key_code, | |
| 108 const char* code, | |
| 109 bool control, | |
| 110 bool shift, | |
| 111 bool alt, | |
| 112 bool command); | |
| 113 | |
| 114 // Allow ExecuteScript* methods to target either a WebContents or a | 89 // Allow ExecuteScript* methods to target either a WebContents or a |
| 115 // RenderViewHost. Targetting a WebContents means executing script in the | 90 // RenderViewHost. Targetting a WebContents means executing script in the |
| 116 // RenderViewHost returned by WebContents::GetRenderViewHost(), which is the | 91 // RenderViewHost returned by WebContents::GetRenderViewHost(), which is the |
| 117 // "current" RenderViewHost. Pass a specific RenderViewHost to target, for | 92 // "current" RenderViewHost. Pass a specific RenderViewHost to target, for |
| 118 // example, a "swapped-out" RenderViewHost. | 93 // example, a "swapped-out" RenderViewHost. |
| 119 namespace internal { | 94 namespace internal { |
| 120 class ToRenderViewHost { | 95 class ToRenderViewHost { |
| 121 public: | 96 public: |
| 122 ToRenderViewHost(WebContents* web_contents); | 97 ToRenderViewHost(WebContents* web_contents); |
| 123 ToRenderViewHost(RenderViewHost* render_view_host); | 98 ToRenderViewHost(RenderViewHost* render_view_host); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 std::queue<std::string> message_queue_; | 227 std::queue<std::string> message_queue_; |
| 253 bool waiting_for_message_; | 228 bool waiting_for_message_; |
| 254 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 229 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
| 255 | 230 |
| 256 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); | 231 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); |
| 257 }; | 232 }; |
| 258 | 233 |
| 259 } // namespace content | 234 } // namespace content |
| 260 | 235 |
| 261 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 236 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |