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

Side by Side Diff: chrome/browser/sync/api/sync_data.cc

Issue 7978044: Sync/Valgrind: Add gmock printers for SyncChange, SyncData, SyncError. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync/api/sync_data.h" 5 #include "chrome/browser/sync/api/sync_data.h"
6 6
7 #include <iostream>
8
7 #include "chrome/browser/sync/internal_api/base_node.h" 9 #include "chrome/browser/sync/internal_api/base_node.h"
8 #include "chrome/browser/sync/protocol/sync.pb.h" 10 #include "chrome/browser/sync/protocol/sync.pb.h"
9 11
10 void SyncData::ImmutableSyncEntityTraits::InitializeWrapper( 12 void SyncData::ImmutableSyncEntityTraits::InitializeWrapper(
11 Wrapper* wrapper) { 13 Wrapper* wrapper) {
12 *wrapper = new sync_pb::SyncEntity(); 14 *wrapper = new sync_pb::SyncEntity();
13 } 15 }
14 16
15 void SyncData::ImmutableSyncEntityTraits::DestroyWrapper( 17 void SyncData::ImmutableSyncEntityTraits::DestroyWrapper(
16 Wrapper* wrapper) { 18 Wrapper* wrapper) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 97 }
96 98
97 int64 SyncData::GetRemoteId() const { 99 int64 SyncData::GetRemoteId() const {
98 DCHECK(!IsLocal()); 100 DCHECK(!IsLocal());
99 return id_; 101 return id_;
100 } 102 }
101 103
102 bool SyncData::IsLocal() const { 104 bool SyncData::IsLocal() const {
103 return id_ == sync_api::kInvalidId; 105 return id_ == sync_api::kInvalidId;
104 } 106 }
107
108 std::ostream& operator<<(::std::ostream& os,
109 const SyncData& sync_data) {
110 int64 id = (sync_data.IsLocal()) ? 0L : sync_data.GetRemoteId();
111 return os <<
112 "{" << id <<
113 ", " << sync_data.IsValid() <<
114 ", " << sync_data.GetDataType() <<
115 ", " << sync_data.GetTag() <<
akalin 2011/09/21 23:12:58 print out specifics also: use EntitySpecificsToVal
James Hawkins 2011/09/22 01:15:26 Done.
116 ", " << sync_data.GetTitle() <<
akalin 2011/09/21 23:12:58 print out IsLocal(), too. Also note that GetTag()
James Hawkins 2011/09/22 01:15:26 Done.
117 "}";
118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698