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

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: need to push again to make sure rietveld didn't screw up 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
« no previous file with comments | « chrome/test/webdriver/commands/create_session.cc ('k') | chrome/test/webdriver/commands/response.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..678851fe889d8d915a6abc3fbfd48179bafff964 100644
--- a/chrome/test/webdriver/commands/response.h
+++ b/chrome/test/webdriver/commands/response.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -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.
« no previous file with comments | « chrome/test/webdriver/commands/create_session.cc ('k') | chrome/test/webdriver/commands/response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698