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

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: added tests which compare against a reference md5 hash Created 9 years, 9 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..bc9f8c65722e079de40460acdd3393d2a1bbe205 100644
--- a/chrome/test/webdriver/commands/response.h
+++ b/chrome/test/webdriver/commands/response.h
@@ -14,11 +14,18 @@
namespace webdriver {
// All errors in webdriver must use this macro in order to send back
-// a proper stack trace to the client
+// a proper stack trace to the client.
#define SET_WEBDRIVER_ERROR(response, msg, err) \
response->SetError(err, msg, __FILE__, __LINE__); \
LOG(ERROR) << msg
+// Error which need to send back a screenshot should use this macro.
+// |png| needs to be a string which contains the raw binary data of
+// the PNG file.
+#define SET_WEBDRIVER_ERROR_WITH_SCREENSHOT(response, msg, err , png) \
+ response->SetError(err, msg, __FILE__, __LINE__, png); \
+ LOG(ERROR) << msg
+
// 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:
@@ -46,6 +53,16 @@ class Response {
void SetError(ErrorCode error, const std::string& message,
const std::string& file, int line);
+ // 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_WITH_SCREENSHOT| macro above. Includes
+ // a screen shot of the tab which caused the error.
+ void SetError(ErrorCode error,
+ const std::string& message,
+ const std::string& file,
+ int line,
+ const std::string& png);
+
// 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
// previously set value for the |key| will be deleted.

Powered by Google App Engine
This is Rietveld 408576698