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

Side by Side Diff: chrome/test/webdriver/automation.cc

Issue 6630001: Allow webdriver users to choose between sending the key events when... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 dict.SetInteger("start_y", start.y()); 233 dict.SetInteger("start_y", start.y());
234 dict.SetInteger("end_x", end.x()); 234 dict.SetInteger("end_x", end.x());
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,
kkania 2011/03/10 00:28:58 I would prefer creating a separate method here for
timothe faudot 2011/03/10 05:34:32 Done. I created a SendNativeWebKeyEvent uses diffe
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");
kkania 2011/03/10 00:28:58 Modify the command name to say something about the
timothe faudot 2011/03/10 05:34:32 Changed to SendOSLevelKeyEvent
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698