| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 dict.SetString("text", key_event.modified_text); | 238 dict.SetString("text", key_event.modified_text); |
| 239 dict.SetInteger("modifiers", key_event.modifiers); | 239 dict.SetInteger("modifiers", key_event.modifiers); |
| 240 dict.SetBoolean("isSystemKey", false); | 240 dict.SetBoolean("isSystemKey", false); |
| 241 | 241 |
| 242 *success = SendJSONRequest(tab_id, dict, &reply); | 242 *success = SendJSONRequest(tab_id, dict, &reply); |
| 243 if (!*success) { | 243 if (!*success) { |
| 244 LOG(ERROR) << "Could not send web key event. Reply: " << reply; | 244 LOG(ERROR) << "Could not send web key event. Reply: " << reply; |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void Automation::CaptureEntirePageAsPNG(int tab_id, |
| 249 const FilePath& path, |
| 250 bool* success) { |
| 251 TabProxy* tab = GetTabById(tab_id); |
| 252 if (!tab) { |
| 253 *success = false; |
| 254 return; |
| 255 } |
| 256 |
| 257 *success = tab->CaptureEntirePageAsPNG(path); |
| 258 } |
| 259 |
| 248 void Automation::NavigateToURL(int tab_id, | 260 void Automation::NavigateToURL(int tab_id, |
| 249 const std::string& url, | 261 const std::string& url, |
| 250 bool* success) { | 262 bool* success) { |
| 251 TabProxy* tab = GetTabById(tab_id); | 263 TabProxy* tab = GetTabById(tab_id); |
| 252 if (!tab) { | 264 if (!tab) { |
| 253 *success = false; | 265 *success = false; |
| 254 return; | 266 return; |
| 255 } | 267 } |
| 256 *success = tab->NavigateToURL(GURL(url)); | 268 *success = tab->NavigateToURL(GURL(url)); |
| 257 } | 269 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 | 466 |
| 455 if (!browser->ActivateTab(tab_index)) { | 467 if (!browser->ActivateTab(tab_index)) { |
| 456 LOG(ERROR) << "Could not activate tab"; | 468 LOG(ERROR) << "Could not activate tab"; |
| 457 return false; | 469 return false; |
| 458 } | 470 } |
| 459 | 471 |
| 460 return browser->SendJSONRequest(request, reply); | 472 return browser->SendJSONRequest(request, reply); |
| 461 } | 473 } |
| 462 | 474 |
| 463 } // namespace webdriver | 475 } // namespace webdriver |
| OLD | NEW |