| 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> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "cc/output/compositor_frame.h" | 20 #include "cc/output/compositor_frame.h" |
| 21 #include "content/public/browser/browser_message_filter.h" | 21 #include "content/public/browser/browser_message_filter.h" |
| 22 #include "content/public/browser/notification_observer.h" | 22 #include "content/public/browser/notification_observer.h" |
| 23 #include "content/public/browser/notification_registrar.h" | 23 #include "content/public/browser/notification_registrar.h" |
| 24 #include "content/public/browser/render_process_host_observer.h" | 24 #include "content/public/browser/render_process_host_observer.h" |
| 25 #include "content/public/browser/web_contents_observer.h" | 25 #include "content/public/browser/web_contents_observer.h" |
| 26 #include "content/public/common/page_type.h" | 26 #include "content/public/common/page_type.h" |
| 27 #include "ipc/message_filter.h" | 27 #include "ipc/message_filter.h" |
| 28 #include "third_party/WebKit/public/web/WebInputEvent.h" | 28 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 29 #include "ui/accessibility/ax_node_data.h" | 29 #include "ui/accessibility/ax_node_data.h" |
| 30 #include "ui/events/keycodes/dom/dom_code.h" |
| 31 #include "ui/events/keycodes/dom/dom_key.h" |
| 30 #include "ui/events/keycodes/keyboard_codes.h" | 32 #include "ui/events/keycodes/keyboard_codes.h" |
| 31 #include "url/gurl.h" | 33 #include "url/gurl.h" |
| 32 | 34 |
| 33 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
| 34 #include "base/win/scoped_handle.h" | 36 #include "base/win/scoped_handle.h" |
| 35 #endif | 37 #endif |
| 36 | 38 |
| 37 namespace gfx { | 39 namespace gfx { |
| 38 class Point; | 40 class Point; |
| 39 } | 41 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Generates a TouchStart at |point|. | 143 // Generates a TouchStart at |point|. |
| 142 void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point); | 144 void SimulateTouchPressAt(WebContents* web_contents, const gfx::Point& point); |
| 143 #endif | 145 #endif |
| 144 | 146 |
| 145 // Taps the screen with modifires at |point|. | 147 // Taps the screen with modifires at |point|. |
| 146 void SimulateTapWithModifiersAt(WebContents* web_contents, | 148 void SimulateTapWithModifiersAt(WebContents* web_contents, |
| 147 unsigned Modifiers, | 149 unsigned Modifiers, |
| 148 const gfx::Point& point); | 150 const gfx::Point& point); |
| 149 | 151 |
| 150 // Sends a key press asynchronously. | 152 // Sends a key press asynchronously. |
| 151 // The native code of the key event will be set to InvalidNativeKeycode(). | 153 // |key| specifies the UIEvents (aka: DOM4Events) value of the key. |
| 154 // |code| specifies the UIEvents (aka: DOM4Events) value of the physical key. |
| 152 // |key_code| alone is good enough for scenarios that only need the char | 155 // |key_code| alone is good enough for scenarios that only need the char |
| 153 // value represented by a key event and not the physical key on the keyboard | 156 // value represented by a key event and not the physical key on the keyboard |
| 154 // or the keyboard layout. | 157 // or the keyboard layout. |
| 155 // For scenarios such as chromoting that need the native code, | |
| 156 // SimulateKeyPressWithCode should be used. | |
| 157 void SimulateKeyPress(WebContents* web_contents, | 158 void SimulateKeyPress(WebContents* web_contents, |
| 159 ui::DomKey key, |
| 160 ui::DomCode code, |
| 158 ui::KeyboardCode key_code, | 161 ui::KeyboardCode key_code, |
| 159 bool control, | 162 bool control, |
| 160 bool shift, | 163 bool shift, |
| 161 bool alt, | 164 bool alt, |
| 162 bool command); | 165 bool command); |
| 163 | 166 |
| 164 // Sends a key press asynchronously. | |
| 165 // |code| specifies the UIEvents (aka: DOM4Events) value of the key: | |
| 166 // https://dvcs.w3.org/hg/d4e/raw-file/tip/source_respec.htm | |
| 167 // The native code of the key event will be set based on |code|. | |
| 168 // See ui/base/keycodes/vi usb_keycode_map.h for mappings between |code| | |
| 169 // and the native code. | |
| 170 // Examples of the various codes: | |
| 171 // key_code: VKEY_A | |
| 172 // code: "KeyA" | |
| 173 // native key code: 0x001e (for Windows). | |
| 174 // native key code: 0x0026 (for Linux). | |
| 175 void SimulateKeyPressWithCode(WebContents* web_contents, | |
| 176 ui::KeyboardCode key_code, | |
| 177 const std::string& code, | |
| 178 bool control, | |
| 179 bool shift, | |
| 180 bool alt, | |
| 181 bool command); | |
| 182 | |
| 183 // Allow ExecuteScript* methods to target either a WebContents or a | 167 // Allow ExecuteScript* methods to target either a WebContents or a |
| 184 // RenderFrameHost. Targetting a WebContents means executing the script in the | 168 // RenderFrameHost. Targetting a WebContents means executing the script in the |
| 185 // RenderFrameHost returned by WebContents::GetMainFrame(), which is the | 169 // RenderFrameHost returned by WebContents::GetMainFrame(), which is the |
| 186 // main frame. Pass a specific RenderFrameHost to target it. | 170 // main frame. Pass a specific RenderFrameHost to target it. |
| 187 class ToRenderFrameHost { | 171 class ToRenderFrameHost { |
| 188 public: | 172 public: |
| 189 ToRenderFrameHost(WebContents* web_contents); | 173 ToRenderFrameHost(WebContents* web_contents); |
| 190 ToRenderFrameHost(RenderViewHost* render_view_host); | 174 ToRenderFrameHost(RenderViewHost* render_view_host); |
| 191 ToRenderFrameHost(RenderFrameHost* render_frame_host); | 175 ToRenderFrameHost(RenderFrameHost* render_frame_host); |
| 192 | 176 |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 blink::WebInputEvent::Type wait_for_type_; | 500 blink::WebInputEvent::Type wait_for_type_; |
| 517 uint32_t ack_result_; | 501 uint32_t ack_result_; |
| 518 base::Closure quit_; | 502 base::Closure quit_; |
| 519 | 503 |
| 520 DISALLOW_COPY_AND_ASSIGN(InputMsgWatcher); | 504 DISALLOW_COPY_AND_ASSIGN(InputMsgWatcher); |
| 521 }; | 505 }; |
| 522 | 506 |
| 523 } // namespace content | 507 } // namespace content |
| 524 | 508 |
| 525 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 509 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |