| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 dict.SetString("text", key_event.modified_text); | 252 dict.SetString("text", key_event.modified_text); |
| 253 dict.SetInteger("modifiers", key_event.modifiers); | 253 dict.SetInteger("modifiers", key_event.modifiers); |
| 254 dict.SetBoolean("isSystemKey", false); | 254 dict.SetBoolean("isSystemKey", false); |
| 255 | 255 |
| 256 *success = SendJSONRequest(tab_id, dict, &reply); | 256 *success = SendJSONRequest(tab_id, dict, &reply); |
| 257 if (!*success) { | 257 if (!*success) { |
| 258 LOG(ERROR) << "Could not send web key event. Reply: " << reply; | 258 LOG(ERROR) << "Could not send web key event. Reply: " << reply; |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 | 261 |
| 262 void Automation::CaptureEntirePageAsPNG(int tab_id, |
| 263 const FilePath& path, |
| 264 bool* success) { |
| 265 TabProxy* tab = GetTabById(tab_id); |
| 266 if (!tab) { |
| 267 *success = false; |
| 268 return; |
| 269 } |
| 270 |
| 271 *success = tab->CaptureEntirePageAsPNG(path); |
| 272 } |
| 273 |
| 262 void Automation::NavigateToURL(int tab_id, | 274 void Automation::NavigateToURL(int tab_id, |
| 263 const std::string& url, | 275 const std::string& url, |
| 264 bool* success) { | 276 bool* success) { |
| 265 TabProxy* tab = GetTabById(tab_id); | 277 TabProxy* tab = GetTabById(tab_id); |
| 266 if (!tab) { | 278 if (!tab) { |
| 267 *success = false; | 279 *success = false; |
| 268 return; | 280 return; |
| 269 } | 281 } |
| 270 *success = tab->NavigateToURL(GURL(url)); | 282 *success = tab->NavigateToURL(GURL(url)); |
| 271 } | 283 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 | 488 |
| 477 if (!browser->ActivateTab(tab_index)) { | 489 if (!browser->ActivateTab(tab_index)) { |
| 478 LOG(ERROR) << "Could not activate tab"; | 490 LOG(ERROR) << "Could not activate tab"; |
| 479 return false; | 491 return false; |
| 480 } | 492 } |
| 481 | 493 |
| 482 return browser->SendJSONRequest(request, reply); | 494 return browser->SendJSONRequest(request, reply); |
| 483 } | 495 } |
| 484 | 496 |
| 485 } // namespace webdriver | 497 } // namespace webdriver |
| OLD | NEW |