| Index: chrome/test/webdriver/commands/response.h
|
| diff --git a/chrome/test/webdriver/commands/response.h b/chrome/test/webdriver/commands/response.h
|
| index b77404d2260d67f3cec7f43550806640770b6e7e..8486b1f82727a807cba511cea2dd6ce900bbb4e2 100644
|
| --- a/chrome/test/webdriver/commands/response.h
|
| +++ b/chrome/test/webdriver/commands/response.h
|
| @@ -19,6 +19,16 @@ namespace webdriver {
|
| response->SetError(err, msg, __FILE__, __LINE__); \
|
| LOG(ERROR) << msg
|
|
|
| +// Use this macro for errors in which a screenshot can be taken and
|
| +// sent back to the client. A proper stack trace will also be included.
|
| +#define SET_WEBDRIVER_SCREENSHOT_ERROR(response, session, msg, err) { \
|
| + LOG(ERROR) << msg; \
|
| + std::string __screenshot__; \
|
| + session->ScreenshotAsBase64(&__screenshot__); \
|
| + response->SetError(err, msg, __FILE__, __LINE__); \
|
| + response->SetScreenshot(__screenshot__); \
|
| +}
|
| +
|
| // A simple class that encapsulates the information describing the response to
|
| // a |Command|. In Webdriver all responses must be sent back as a JSON value,
|
| // conforming to the spec found at:
|
| @@ -52,11 +62,16 @@ class Response {
|
| // This object assumes ownership of |value|.
|
| void SetField(const std::string& key, Value* value);
|
|
|
| + // Sets the screenshot to return to the client for debugging. The file must
|
| + // be a base64 encoded PNG file.
|
| + void SetScreenshot(const std::string& screenshot);
|
| +
|
| // Returns this response as a JSON string.
|
| std::string ToJSON() const;
|
|
|
| private:
|
| DictionaryValue data_;
|
| + std::string screenshot_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(Response);
|
| };
|
|
|