| 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 dict.SetString("command", "SendKeyEventToActiveTab"); |
| 250 dict.SetInteger("type", key_event.type); | 251 dict.SetInteger("type", key_event.type); |
| 251 dict.SetInteger("nativeKeyCode", key_event.key_code); | 252 dict.SetInteger("nativeKeyCode", key_event.key_code); |
| 252 dict.SetInteger("windowsKeyCode", key_event.key_code); | 253 dict.SetInteger("windowsKeyCode", key_event.key_code); |
| 253 dict.SetString("unmodifiedText", key_event.unmodified_text); | 254 dict.SetString("unmodifiedText", key_event.unmodified_text); |
| 254 dict.SetString("text", key_event.modified_text); | 255 dict.SetString("text", key_event.modified_text); |
| 255 dict.SetInteger("modifiers", key_event.modifiers); | 256 dict.SetInteger("modifiers", key_event.modifiers); |
| 256 dict.SetBoolean("isSystemKey", false); | 257 dict.SetBoolean("isSystemKey", false); |
| 258 dict.SetBoolean("useNativeEvents", use_native_events); |
| 257 | 259 |
| 258 *success = SendJSONRequest(tab_id, dict, &reply); | 260 *success = SendJSONRequest(tab_id, dict, &reply); |
| 259 if (!*success) { | 261 if (!*success) { |
| 260 LOG(ERROR) << "Could not send web key event. Reply: " << reply; | 262 LOG(ERROR) << "Could not send web key event. Reply: " << reply; |
| 261 } | 263 } |
| 262 } | 264 } |
| 263 | 265 |
| 264 void Automation::NavigateToURL(int tab_id, | 266 void Automation::NavigateToURL(int tab_id, |
| 265 const std::string& url, | 267 const std::string& url, |
| 266 bool* success) { | 268 bool* success) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 int tab_id, int* browser_index, int* tab_index) { | 501 int tab_id, int* browser_index, int* tab_index) { |
| 500 if (!SendGetIndicesFromTabJSONRequest(automation(), tab_id, | 502 if (!SendGetIndicesFromTabJSONRequest(automation(), tab_id, |
| 501 browser_index, tab_index)) { | 503 browser_index, tab_index)) { |
| 502 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; | 504 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; |
| 503 return false; | 505 return false; |
| 504 } | 506 } |
| 505 return true; | 507 return true; |
| 506 } | 508 } |
| 507 | 509 |
| 508 } // namespace webdriver | 510 } // namespace webdriver |
| OLD | NEW |