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

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: Addressing CR feedback 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
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 0.
Wez 2013/09/05 00:16:33 This should be "... will be set to InvalidNativeKe
weitao 2013/09/05 07:49:17 Done.
82 void SimulateKeyPress(WebContents* web_contents, 83 void SimulateKeyPress(WebContents* web_contents,
83 ui::KeyboardCode key, 84 ui::KeyboardCode key,
84 bool control, 85 bool control,
85 bool shift, 86 bool shift,
86 bool alt, 87 bool alt,
87 bool command); 88 bool command);
88 89
90 // Sends a key press asynchronously.
91 // The native code of the key event will be set based on |code|.
Wez 2013/09/05 00:16:33 This should refer to the DOM4 UI Events spec, e.g.
weitao 2013/09/05 07:49:17 Done.
92 // TODO: should we have an overload that takes only KeyboardCode or
93 // |code| and generates the other one based on US keyboard layout?
Wez 2013/09/05 00:16:33 nit: This isn't really a TODO, so I don't think th
weitao 2013/09/05 07:49:17 Done.
94 void SimulateKeyPress(WebContents* web_contents,
Wez 2013/09/05 00:16:33 As per style guide, this shouldn't be an override,
weitao 2013/09/05 07:49:17 Done.
95 ui::KeyboardCode key,
96 const char* code,
97 bool control,
98 bool shift,
99 bool alt,
100 bool command);
101
89 // Allow ExecuteScript* methods to target either a WebContents or a 102 // Allow ExecuteScript* methods to target either a WebContents or a
90 // RenderViewHost. Targetting a WebContents means executing script in the 103 // RenderViewHost. Targetting a WebContents means executing script in the
91 // RenderViewHost returned by WebContents::GetRenderViewHost(), which is the 104 // RenderViewHost returned by WebContents::GetRenderViewHost(), which is the
92 // "current" RenderViewHost. Pass a specific RenderViewHost to target, for 105 // "current" RenderViewHost. Pass a specific RenderViewHost to target, for
93 // example, a "swapped-out" RenderViewHost. 106 // example, a "swapped-out" RenderViewHost.
94 namespace internal { 107 namespace internal {
95 class ToRenderViewHost { 108 class ToRenderViewHost {
96 public: 109 public:
97 ToRenderViewHost(WebContents* web_contents); 110 ToRenderViewHost(WebContents* web_contents);
98 ToRenderViewHost(RenderViewHost* render_view_host); 111 ToRenderViewHost(RenderViewHost* render_view_host);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 std::queue<std::string> message_queue_; 240 std::queue<std::string> message_queue_;
228 bool waiting_for_message_; 241 bool waiting_for_message_;
229 scoped_refptr<MessageLoopRunner> message_loop_runner_; 242 scoped_refptr<MessageLoopRunner> message_loop_runner_;
230 243
231 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); 244 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue);
232 }; 245 };
233 246
234 } // namespace content 247 } // namespace content
235 248
236 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ 249 #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') | content/public/test/browser_test_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698