| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/test/webdriver/commands/screenshot_command.h" |
| 6 |
| 7 #include <string> |
| 8 #include <vector> |
| 9 |
| 10 #include "base/values.h" |
| 11 #include "chrome/test/webdriver/commands/response.h" |
| 12 #include "chrome/test/webdriver/error_codes.h" |
| 13 #include "chrome/test/webdriver/session.h" |
| 14 |
| 15 namespace webdriver { |
| 16 |
| 17 ScreenshotCommand::ScreenshotCommand(const std::vector<std::string>& ps, |
| 18 const DictionaryValue* const parameters) |
| 19 : WebDriverCommand(ps, parameters) {} |
| 20 |
| 21 ScreenshotCommand::~ScreenshotCommand() {} |
| 22 |
| 23 bool ScreenshotCommand::DoesGet() { |
| 24 return true; |
| 25 } |
| 26 |
| 27 void ScreenshotCommand::ExecuteGet(Response* const response) { |
| 28 std::string screenshot; |
| 29 if (!session_->ScreenshotAsBase64(&screenshot)) { |
| 30 SET_WEBDRIVER_ERROR(response, "Screenshot of current page failed", |
| 31 kInternalServerError); |
| 32 return; |
| 33 } |
| 34 |
| 35 response->SetValue(new StringValue(screenshot)); |
| 36 response->SetStatus(kSuccess); |
| 37 } |
| 38 |
| 39 } // namespace webdriver |
| 40 |
| OLD | NEW |