| Index: chrome/test/webdriver/commands/response.cc
|
| diff --git a/chrome/test/webdriver/commands/response.cc b/chrome/test/webdriver/commands/response.cc
|
| index 153e6b71a8234625197aa5353cf8bf8e1c64a479..bb711efa539fb4fa41e27b2c17c302c0fa4686bf 100644
|
| --- a/chrome/test/webdriver/commands/response.cc
|
| +++ b/chrome/test/webdriver/commands/response.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "chrome/test/webdriver/commands/response.h"
|
|
|
| +#include "base/base64.h"
|
| #include "base/json/json_writer.h"
|
| #include "base/logging.h"
|
| #include "base/values.h"
|
| @@ -74,6 +75,31 @@ void Response::SetError(ErrorCode error_code, const std::string& message,
|
| SetValue(error);
|
| }
|
|
|
| +void Response::SetError(ErrorCode error_code,
|
| + const std::string& message,
|
| + const std::string& file,
|
| + int line,
|
| + const std::string& png) {
|
| + DictionaryValue* error = new DictionaryValue;
|
| +
|
| + error->SetString(kMessageKey, message);
|
| + error->SetString(kStackTraceFileNameKey, file);
|
| + error->SetInteger(kStackTraceLineNumberKey, line);
|
| + std::string base64_png;
|
| +
|
| + // Convert the raw binary data to base 64 encoding for webdriver.
|
| + if (!base::Base64Encode(png, &base64_png)) {
|
| + LOG(ERROR) << "Failed to encode screenshot to base64 "
|
| + << "sending back an empty string instead.";
|
| + } else {
|
| + error->SetString(kScreenKey, base64_png);
|
| + }
|
| +
|
| + SetStatus(error_code);
|
| + SetValue(error);
|
| +}
|
| +
|
| +
|
| void Response::SetField(const std::string& key, Value* value) {
|
| data_.Set(key, value);
|
| }
|
|
|