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

Side by Side Diff: content/public/test/browser_test_utils.h

Issue 23542008: Add a CodeToNativeKeycode helper that converts UIEvent code to native code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing unittests Created 7 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
82 void SimulateKeyPress(WebContents* web_contents, 88 void SimulateKeyPress(WebContents* web_contents,
83 ui::KeyboardCode key, 89 ui::KeyboardCode key_code,
84 bool control, 90 bool control,
85 bool shift, 91 bool shift,
86 bool alt, 92 bool alt,
87 bool command); 93 bool command);
88 94
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
89 // Allow ExecuteScript* methods to target either a WebContents or a 114 // Allow ExecuteScript* methods to target either a WebContents or a
90 // RenderViewHost. Targetting a WebContents means executing script in the 115 // RenderViewHost. Targetting a WebContents means executing script in the
91 // RenderViewHost returned by WebContents::GetRenderViewHost(), which is the 116 // RenderViewHost returned by WebContents::GetRenderViewHost(), which is the
92 // "current" RenderViewHost. Pass a specific RenderViewHost to target, for 117 // "current" RenderViewHost. Pass a specific RenderViewHost to target, for
93 // example, a "swapped-out" RenderViewHost. 118 // example, a "swapped-out" RenderViewHost.
94 namespace internal { 119 namespace internal {
95 class ToRenderViewHost { 120 class ToRenderViewHost {
96 public: 121 public:
97 ToRenderViewHost(WebContents* web_contents); 122 ToRenderViewHost(WebContents* web_contents);
98 ToRenderViewHost(RenderViewHost* render_view_host); 123 ToRenderViewHost(RenderViewHost* render_view_host);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 std::queue<std::string> message_queue_; 252 std::queue<std::string> message_queue_;
228 bool waiting_for_message_; 253 bool waiting_for_message_;
229 scoped_refptr<MessageLoopRunner> message_loop_runner_; 254 scoped_refptr<MessageLoopRunner> message_loop_runner_;
230 255
231 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); 256 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue);
232 }; 257 };
233 258
234 } // namespace content 259 } // namespace content
235 260
236 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 261 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | content/public/test/browser_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698