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

Unified Diff: chrome/browser/sync/api/sync_error.cc

Issue 7978044: Sync/Valgrind: Add gmock printers for SyncChange, SyncData, SyncError. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More. Created 9 years, 3 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/browser/sync/api/sync_error.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/api/sync_error.cc
diff --git a/chrome/browser/sync/api/sync_error.cc b/chrome/browser/sync/api/sync_error.cc
index 453a920d70afcd9fef531775a3594b504b56b5c4..0023a05362e893089cb4f1498579680d551b843e 100644
--- a/chrome/browser/sync/api/sync_error.cc
+++ b/chrome/browser/sync/api/sync_error.cc
@@ -4,8 +4,11 @@
#include "chrome/browser/sync/api/sync_error.h"
+#include <ostream>
+
#include "base/location.h"
#include "base/logging.h"
+#include "chrome/browser/sync/syncable/model_type.h"
SyncError::SyncError() {
Clear();
@@ -83,6 +86,15 @@ syncable::ModelType SyncError::type() const {
return type_;
}
+std::string SyncError::ToString() const {
+ if (IsSet()) {
+ return "{ location: " + location_->ToString() + ", type: " +
+ syncable::ModelTypeToString(type()) + ", message: " + message() + "}";
+ }
+
+ return "<Unset SyncError>";
+}
+
void SyncError::PrintLogError() const {
LAZY_STREAM(logging::LogMessage(location_->file_name(),
location_->line_number(),
@@ -90,3 +102,7 @@ void SyncError::PrintLogError() const {
LOG_IS_ON(ERROR))
<< syncable::ModelTypeToString(type_) << " Sync Error: " << message_;
}
+
+void PrintTo(const SyncError& sync_error, std::ostream* os) {
+ *os << sync_error.ToString();
+}
« no previous file with comments | « chrome/browser/sync/api/sync_error.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698