| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/test/webdriver/automation.h" | 5 #include "chrome/test/webdriver/automation.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 dict.SetInteger("end_y", end.y()); | 235 dict.SetInteger("end_y", end.y()); |
| 236 | 236 |
| 237 *success = SendJSONRequest(tab_id, dict, &reply); | 237 *success = SendJSONRequest(tab_id, dict, &reply); |
| 238 if (!*success) { | 238 if (!*success) { |
| 239 LOG(ERROR) << "Could not send mouse event. Reply: " << reply; | 239 LOG(ERROR) << "Could not send mouse event. Reply: " << reply; |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 void Automation::SendWebKeyEvent(int tab_id, | 243 void Automation::SendWebKeyEvent(int tab_id, |
| 244 const WebKeyEvent& key_event, | 244 const WebKeyEvent& key_event, |
| 245 bool use_native_events, |
| 245 bool* success) { | 246 bool* success) { |
| 246 std::string reply; | 247 std::string reply; |
| 247 DictionaryValue dict; | 248 DictionaryValue dict; |
| 248 | 249 |
| 249 dict.SetString("command", "SendKeyEventToActiveTab"); | 250 if (use_native_events){ |
| 251 dict.SetString("command", "SendKeyEventToActiveBrowserWindow"); |
| 252 } else { |
| 253 dict.SetString("command", "SendKeyEventToActiveTab"); |
| 254 } |
| 250 dict.SetInteger("type", key_event.type); | 255 dict.SetInteger("type", key_event.type); |
| 251 dict.SetInteger("nativeKeyCode", key_event.key_code); | 256 dict.SetInteger("nativeKeyCode", key_event.key_code); |
| 252 dict.SetInteger("windowsKeyCode", key_event.key_code); | 257 dict.SetInteger("windowsKeyCode", key_event.key_code); |
| 253 dict.SetString("unmodifiedText", key_event.unmodified_text); | 258 dict.SetString("unmodifiedText", key_event.unmodified_text); |
| 254 dict.SetString("text", key_event.modified_text); | 259 dict.SetString("text", key_event.modified_text); |
| 255 dict.SetInteger("modifiers", key_event.modifiers); | 260 dict.SetInteger("modifiers", key_event.modifiers); |
| 256 dict.SetBoolean("isSystemKey", false); | 261 dict.SetBoolean("isSystemKey", false); |
| 257 | 262 |
| 258 *success = SendJSONRequest(tab_id, dict, &reply); | 263 *success = SendJSONRequest(tab_id, dict, &reply); |
| 259 if (!*success) { | 264 if (!*success) { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 int tab_id, int* browser_index, int* tab_index) { | 504 int tab_id, int* browser_index, int* tab_index) { |
| 500 if (!SendGetIndicesFromTabJSONRequest(automation(), tab_id, | 505 if (!SendGetIndicesFromTabJSONRequest(automation(), tab_id, |
| 501 browser_index, tab_index)) { | 506 browser_index, tab_index)) { |
| 502 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; | 507 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; |
| 503 return false; | 508 return false; |
| 504 } | 509 } |
| 505 return true; | 510 return true; |
| 506 } | 511 } |
| 507 | 512 |
| 508 } // namespace webdriver | 513 } // namespace webdriver |
| OLD | NEW |