Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: chrome/test/webdriver/commands/response.h

Issue 5572001: Send screenshots back to the client for debugging (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fixed nit Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()) { \
kkania 2011/03/07 18:15:17 why not screenshot_on_error
Joe 2011/03/11 22:12:48 Not every error is a screen shot and since they ar
+ 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_;
kkania 2011/03/07 18:15:17 i don't really care that much, but I think the nor
Joe 2011/03/11 22:12:48 Done.
-
DISALLOW_COPY_AND_ASSIGN(Response);
};

Powered by Google App Engine
This is Rietveld 408576698