| 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..a590a8c948eb2c26f3ae8f831628889d5b928ee6 100644
|
| --- a/chrome/test/webdriver/commands/response.h
|
| +++ b/chrome/test/webdriver/commands/response.h
|
| @@ -10,13 +10,29 @@
|
|
|
| #include "base/values.h"
|
| #include "chrome/test/webdriver/error_codes.h"
|
| +#include "chrome/test/webdriver/session_manager.h"
|
|
|
| namespace webdriver {
|
|
|
| // All errors in webdriver must use this macro in order to send back
|
| // a proper stack trace to the client
|
| #define SET_WEBDRIVER_ERROR(response, msg, err) \
|
| - response->SetError(err, msg, __FILE__, __LINE__); \
|
| + response->SetError(err, msg, __FILE__, __LINE__,""); \
|
| + LOG(ERROR) << msg
|
| +
|
| +
|
| +// All errors in webdriver must use this macro in order to send back
|
| +// a proper stack trace to the client
|
| +#define SET_WEBDRIVER_ERROR2(response, session, msg, err) \
|
| + { \
|
| + std::string __screenshot__ = ""; \
|
| + webdriver::SessionManager* sm = webdriver::SessionManager::GetInstance(); \
|
| + if (sm->ScreenshotOnError()) { \
|
| + session->ScreenshotAsBase64(&__screenshot__); \
|
| + response->SetScreenshotAsBase64(__screenshot__); \
|
| + } \
|
| + response->SetError(err, msg, __FILE__, __LINE__, __screenshot__); \
|
| + } \
|
| LOG(ERROR) << msg
|
|
|
| // A simple class that encapsulates the information describing the response to
|
| @@ -43,8 +59,11 @@ class Response {
|
| // Configures this response to report an error. The |file| and |line|
|
| // parameters, which identify where in the source the error occurred, can be
|
| // set using the |SET_WEBDRIVER_ERROR| macro above.
|
| - void SetError(ErrorCode error, const std::string& message,
|
| - const std::string& file, int line);
|
| + void SetError(ErrorCode error,
|
| + const std::string& message,
|
| + const std::string& file,
|
| + int line,
|
| + const std::string& screenshot);
|
|
|
| // Sets a JSON field in this response. The |key| may be a "." delimitted
|
| // string to indicate the value should be set in a nested object. Any
|
| @@ -57,7 +76,6 @@ class Response {
|
|
|
| private:
|
| DictionaryValue data_;
|
| -
|
| DISALLOW_COPY_AND_ASSIGN(Response);
|
| };
|
|
|
|
|