 Chromium Code Reviews
 Chromium Code Reviews Issue 6630001:
  Allow webdriver users to choose between sending the key events when...  (Closed) 
  Base URL: http://src.chromium.org/svn/trunk/src/
    
  
    Issue 6630001:
  Allow webdriver users to choose between sending the key events when...  (Closed) 
  Base URL: http://src.chromium.org/svn/trunk/src/| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 int windex = 0, tab_index = 0; | 210 int windex = 0, tab_index = 0; | 
| 211 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | 211 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | 
| 212 *success = false; | 212 *success = false; | 
| 213 return; | 213 return; | 
| 214 } | 214 } | 
| 215 | 215 | 
| 216 *success = SendMouseDragJSONRequest( | 216 *success = SendMouseDragJSONRequest( | 
| 217 automation(), windex, tab_index, start.x(), start.y(), end.x(), end.y()); | 217 automation(), windex, tab_index, start.x(), start.y(), end.x(), end.y()); | 
| 218 } | 218 } | 
| 219 | 219 | 
| 220 void Automation::SendNativeKeyEvent(int tab_id, | |
| 221 ui::KeyboardCode keycode, | |
| 222 int modifiers, | |
| 223 bool* success) { | |
| 224 int windex = 0, tab_index = 0; | |
| 225 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | |
| 226 *success = false; | |
| 227 return; | |
| 228 } | |
| 229 *success = SendNativeKeyEventJSONRequest( | |
| 230 automation(), windex, tab_index, keycode, modifiers); | |
| 
kkania
2011/03/11 16:32:13
key_code
 
timothe
2011/03/21 18:02:05
Done.
 | |
| 231 } | |
| 232 | |
| 233 | |
| 220 void Automation::SendWebKeyEvent(int tab_id, | 234 void Automation::SendWebKeyEvent(int tab_id, | 
| 221 const WebKeyEvent& key_event, | 235 const WebKeyEvent& key_event, | 
| 222 bool* success) { | 236 bool* success) { | 
| 223 int windex = 0, tab_index = 0; | 237 int windex = 0, tab_index = 0; | 
| 224 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | 238 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | 
| 225 *success = false; | 239 *success = false; | 
| 226 return; | 240 return; | 
| 227 } | 241 } | 
| 228 | |
| 229 *success = SendWebKeyEventJSONRequest( | 242 *success = SendWebKeyEventJSONRequest( | 
| 230 automation(), windex, tab_index, key_event); | 243 automation(), windex, tab_index, key_event); | 
| 231 } | 244 } | 
| 232 | 245 | 
| 233 void Automation::NavigateToURL(int tab_id, | 246 void Automation::NavigateToURL(int tab_id, | 
| 234 const std::string& url, | 247 const std::string& url, | 
| 235 bool* success) { | 248 bool* success) { | 
| 236 int browser_index = 0, tab_index = 0; | 249 int browser_index = 0, tab_index = 0; | 
| 237 if (!GetIndicesForTab(tab_id, &browser_index, &tab_index)) { | 250 if (!GetIndicesForTab(tab_id, &browser_index, &tab_index)) { | 
| 238 *success = false; | 251 *success = false; | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 int tab_id, int* browser_index, int* tab_index) { | 408 int tab_id, int* browser_index, int* tab_index) { | 
| 396 if (!SendGetIndicesFromTabIdJSONRequest(automation(), tab_id, | 409 if (!SendGetIndicesFromTabIdJSONRequest(automation(), tab_id, | 
| 397 browser_index, tab_index)) { | 410 browser_index, tab_index)) { | 
| 398 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; | 411 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; | 
| 399 return false; | 412 return false; | 
| 400 } | 413 } | 
| 401 return true; | 414 return true; | 
| 402 } | 415 } | 
| 403 | 416 | 
| 404 } // namespace webdriver | 417 } // namespace webdriver | 
| OLD | NEW |