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

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: Review fixes. 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
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 6ffa495466bc9e13b6a8ce18790db7e354ed8ac6..92c97c0e418ffdaed514dbafe2ecca98313e512e 100644
--- a/chrome/browser/sync/api/sync_error.cc
+++ b/chrome/browser/sync/api/sync_error.cc
@@ -4,8 +4,12 @@
#include "chrome/browser/sync/api/sync_error.h"
+#include <iostream>
akalin 2011/09/22 01:24:56 iostream -> ostream (former introduces a static in
James Hawkins 2011/09/22 02:50:29 Done.
+#include <sstream>
+
#include "base/logging.h"
#include "base/tracked.h"
+#include "chrome/browser/sync/syncable/model_type.h"
SyncError::SyncError() {
Clear();
@@ -83,6 +87,18 @@ syncable::ModelType SyncError::type() const {
return type_;
}
+std::string SyncError::ToString() const {
+ std::string out;
+ std::stringstream ss(out, std::stringstream::in);
akalin 2011/09/22 01:24:56 You don't really need a stringstream, do you? Jus
James Hawkins 2011/09/22 02:50:29 I don't print IsSet() anymore, so I changed it bac
+ ss <<
+ "{" << location_->ToString() <<
akalin 2011/09/22 01:24:56 type() and message() CHECK IsSet(). Suggest: if
James Hawkins 2011/09/22 02:50:29 Done.
+ ", " << IsSet() <<
+ ", " << syncable::ModelTypeToString(type()) <<
+ ", " << message() <<
+ "}";
+ return out;
+}
+
void SyncError::PrintLogError() const {
LAZY_STREAM(logging::LogMessage(location_->file_name(),
location_->line_number(),
@@ -90,3 +106,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();
+}
« chrome/browser/sync/api/sync_data.cc ('K') | « 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