| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::SendWebKeyEvent(int tab_id, | 220 void Automation::SendWebKeyEvent(int tab_id, |
| 221 const WebKeyEvent& key_event, | 221 const WebKeyEvent& key_event, |
| 222 bool use_native_events, |
| 222 bool* success) { | 223 bool* success) { |
| 223 int windex = 0, tab_index = 0; | 224 int windex = 0, tab_index = 0; |
| 224 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | 225 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { |
| 225 *success = false; | 226 *success = false; |
| 226 return; | 227 return; |
| 227 } | 228 } |
| 228 | 229 |
| 229 *success = SendWebKeyEventJSONRequest( | 230 if (use_native_events) { |
| 230 automation(), windex, tab_index, key_event); | 231 *success = SendNativeWebKeyEventJSONRequest( |
| 232 automation(), windex, tab_index, key_event); |
| 233 } else { |
| 234 *success = SendWebKeyEventJSONRequest( |
| 235 automation(), windex, tab_index, key_event); |
| 236 } |
| 231 } | 237 } |
| 232 | 238 |
| 233 void Automation::NavigateToURL(int tab_id, | 239 void Automation::NavigateToURL(int tab_id, |
| 234 const std::string& url, | 240 const std::string& url, |
| 235 bool* success) { | 241 bool* success) { |
| 236 int browser_index = 0, tab_index = 0; | 242 int browser_index = 0, tab_index = 0; |
| 237 if (!GetIndicesForTab(tab_id, &browser_index, &tab_index)) { | 243 if (!GetIndicesForTab(tab_id, &browser_index, &tab_index)) { |
| 238 *success = false; | 244 *success = false; |
| 239 return; | 245 return; |
| 240 } | 246 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 int tab_id, int* browser_index, int* tab_index) { | 401 int tab_id, int* browser_index, int* tab_index) { |
| 396 if (!SendGetIndicesFromTabIdJSONRequest(automation(), tab_id, | 402 if (!SendGetIndicesFromTabIdJSONRequest(automation(), tab_id, |
| 397 browser_index, tab_index)) { | 403 browser_index, tab_index)) { |
| 398 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; | 404 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; |
| 399 return false; | 405 return false; |
| 400 } | 406 } |
| 401 return true; | 407 return true; |
| 402 } | 408 } |
| 403 | 409 |
| 404 } // namespace webdriver | 410 } // namespace webdriver |
| OLD | NEW |