Chromium Code Reviews| 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 int windex = 0, tab_index = 0; | 212 int windex = 0, tab_index = 0; |
| 213 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | 213 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { |
| 214 *success = false; | 214 *success = false; |
| 215 return; | 215 return; |
| 216 } | 216 } |
| 217 | 217 |
| 218 *success = SendMouseDragJSONRequest( | 218 *success = SendMouseDragJSONRequest( |
| 219 automation(), windex, tab_index, start.x(), start.y(), end.x(), end.y()); | 219 automation(), windex, tab_index, start.x(), start.y(), end.x(), end.y()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void Automation::SendNativeKeyEvent(int tab_id, | |
|
kkania
2011/03/24 23:20:32
put this func after SendWebKeyEvent to match heade
timothe
2011/03/25 11:07:59
Done.
| |
| 223 ui::KeyboardCode key_code, | |
| 224 int modifiers, | |
| 225 bool* success) { | |
| 226 int windex = 0, tab_index = 0; | |
| 227 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | |
| 228 *success = false; | |
| 229 return; | |
| 230 } | |
| 231 *success = SendNativeKeyEventJSONRequest( | |
| 232 automation(), windex, tab_index, key_code, modifiers); | |
| 233 } | |
| 234 | |
| 235 | |
| 222 void Automation::SendWebKeyEvent(int tab_id, | 236 void Automation::SendWebKeyEvent(int tab_id, |
| 223 const WebKeyEvent& key_event, | 237 const WebKeyEvent& key_event, |
| 224 bool* success) { | 238 bool* success) { |
| 225 int windex = 0, tab_index = 0; | 239 int windex = 0, tab_index = 0; |
| 226 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { | 240 if (!GetIndicesForTab(tab_id, &windex, &tab_index)) { |
| 227 *success = false; | 241 *success = false; |
| 228 return; | 242 return; |
| 229 } | 243 } |
| 230 | |
| 231 *success = SendWebKeyEventJSONRequest( | 244 *success = SendWebKeyEventJSONRequest( |
| 232 automation(), windex, tab_index, key_event); | 245 automation(), windex, tab_index, key_event); |
| 233 } | 246 } |
| 234 | 247 |
| 235 void Automation::NavigateToURL(int tab_id, | 248 void Automation::NavigateToURL(int tab_id, |
| 236 const std::string& url, | 249 const std::string& url, |
| 237 bool* success) { | 250 bool* success) { |
| 238 int browser_index = 0, tab_index = 0; | 251 int browser_index = 0, tab_index = 0; |
| 239 if (!GetIndicesForTab(tab_id, &browser_index, &tab_index)) { | 252 if (!GetIndicesForTab(tab_id, &browser_index, &tab_index)) { |
| 240 *success = false; | 253 *success = false; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 int tab_id, int* browser_index, int* tab_index) { | 410 int tab_id, int* browser_index, int* tab_index) { |
| 398 if (!SendGetIndicesFromTabIdJSONRequest(automation(), tab_id, | 411 if (!SendGetIndicesFromTabIdJSONRequest(automation(), tab_id, |
| 399 browser_index, tab_index)) { | 412 browser_index, tab_index)) { |
| 400 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; | 413 LOG(ERROR) << "Could not get browser and tab indices for WebDriver tab id"; |
| 401 return false; | 414 return false; |
| 402 } | 415 } |
| 403 return true; | 416 return true; |
| 404 } | 417 } |
| 405 | 418 |
| 406 } // namespace webdriver | 419 } // namespace webdriver |
| OLD | NEW |