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

Side by Side Diff: sync/protocol/proto_enum_conversions.cc

Issue 9663023: Log the sync communication that happens between client and server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Keep this file in sync with the .proto files in this directory. 5 // Keep this file in sync with the .proto files in this directory.
6 6
7 #include "sync/protocol/proto_enum_conversions.h" 7 #include "sync/protocol/proto_enum_conversions.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, NEWLY_SUPPORTED_DATATYPE); 83 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, NEWLY_SUPPORTED_DATATYPE);
84 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, MIGRATION); 84 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, MIGRATION);
85 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, NEW_CLIENT); 85 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, NEW_CLIENT);
86 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, RECONFIGURATION); 86 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, RECONFIGURATION);
87 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, DATATYPE_REFRESH); 87 ENUM_CASE(sync_pb::GetUpdatesCallerInfo, DATATYPE_REFRESH);
88 } 88 }
89 NOTREACHED(); 89 NOTREACHED();
90 return ""; 90 return "";
91 } 91 }
92 92
93 const char* GetResponseTypeString(
akalin 2012/03/16 21:28:27 i forgot: add unit tests for these new functions (
lipalani1 2012/03/17 01:29:50 Done.
94 sync_pb::CommitResponse::ResponseType response_type) {
95 ASSERT_ENUM_BOUNDS(sync_pb::CommitResponse, ResponseType, SUCCESS,
96 TRANSIENT_ERROR);
97 switch (response_type) {
98 ENUM_CASE(sync_pb::CommitResponse, SUCCESS);
99 ENUM_CASE(sync_pb::CommitResponse, CONFLICT);
100 ENUM_CASE(sync_pb::CommitResponse, RETRY);
101 ENUM_CASE(sync_pb::CommitResponse, INVALID_MESSAGE);
102 ENUM_CASE(sync_pb::CommitResponse, OVER_QUOTA);
103 ENUM_CASE(sync_pb::CommitResponse, TRANSIENT_ERROR);
104 }
105 NOTREACHED();
106 return "";
107 }
108
109 const char* GetErrorTypeString(sync_pb::SyncEnums::ErrorType error_type) {
110 ASSERT_ENUM_BOUNDS(sync_pb::SyncEnums, ErrorType, SUCCESS, UNKNOWN);
111 switch (error_type) {
112 ENUM_CASE(sync_pb::SyncEnums, SUCCESS);
113 ENUM_CASE(sync_pb::SyncEnums, ACCESS_DENIED);
114 ENUM_CASE(sync_pb::SyncEnums, NOT_MY_BIRTHDAY);
115 ENUM_CASE(sync_pb::SyncEnums, THROTTLED);
116 ENUM_CASE(sync_pb::SyncEnums, AUTH_EXPIRED);
117 ENUM_CASE(sync_pb::SyncEnums, USER_NOT_ACTIVATED);
118 ENUM_CASE(sync_pb::SyncEnums, AUTH_INVALID);
119 ENUM_CASE(sync_pb::SyncEnums, CLEAR_PENDING);
120 ENUM_CASE(sync_pb::SyncEnums, TRANSIENT_ERROR);
121 ENUM_CASE(sync_pb::SyncEnums, MIGRATION_DONE);
122 ENUM_CASE(sync_pb::SyncEnums, UNKNOWN);
123 }
124 NOTREACHED();
125 return "";
126 }
127
128 const char* GetActionString(
129 sync_pb::ClientToServerResponse::Error::Action action) {
130 ASSERT_ENUM_BOUNDS(sync_pb::ClientToServerResponse::Error, Action,
131 UPGRADE_CLIENT, UNKNOWN_ACTION);
132 switch (action) {
133 ENUM_CASE(sync_pb::ClientToServerResponse::Error, UPGRADE_CLIENT);
134 ENUM_CASE(sync_pb::ClientToServerResponse::Error,
135 CLEAR_USER_DATA_AND_RESYNC);
136 ENUM_CASE(sync_pb::ClientToServerResponse::Error, ENABLE_SYNC_ON_ACCOUNT);
137 ENUM_CASE(sync_pb::ClientToServerResponse::Error, STOP_AND_RESTART_SYNC);
138 ENUM_CASE(sync_pb::ClientToServerResponse::Error, DISABLE_SYNC_ON_CLIENT);
139 ENUM_CASE(sync_pb::ClientToServerResponse::Error, UNKNOWN_ACTION);
140 }
141 NOTREACHED();
142 return "";
143
144 }
145
93 const char* GetDeviceTypeString( 146 const char* GetDeviceTypeString(
94 sync_pb::SessionHeader::DeviceType device_type) { 147 sync_pb::SessionHeader::DeviceType device_type) {
95 ASSERT_ENUM_BOUNDS(sync_pb::SessionHeader, DeviceType, TYPE_WIN, TYPE_TABLET); 148 ASSERT_ENUM_BOUNDS(sync_pb::SessionHeader, DeviceType, TYPE_WIN, TYPE_TABLET);
96 switch (device_type) { 149 switch (device_type) {
97 ENUM_CASE(sync_pb::SessionHeader, TYPE_WIN); 150 ENUM_CASE(sync_pb::SessionHeader, TYPE_WIN);
98 ENUM_CASE(sync_pb::SessionHeader, TYPE_MAC); 151 ENUM_CASE(sync_pb::SessionHeader, TYPE_MAC);
99 ENUM_CASE(sync_pb::SessionHeader, TYPE_LINUX); 152 ENUM_CASE(sync_pb::SessionHeader, TYPE_LINUX);
100 ENUM_CASE(sync_pb::SessionHeader, TYPE_CROS); 153 ENUM_CASE(sync_pb::SessionHeader, TYPE_CROS);
101 ENUM_CASE(sync_pb::SessionHeader, TYPE_OTHER); 154 ENUM_CASE(sync_pb::SessionHeader, TYPE_OTHER);
102 ENUM_CASE(sync_pb::SessionHeader, TYPE_PHONE); 155 ENUM_CASE(sync_pb::SessionHeader, TYPE_PHONE);
103 ENUM_CASE(sync_pb::SessionHeader, TYPE_TABLET); 156 ENUM_CASE(sync_pb::SessionHeader, TYPE_TABLET);
104 } 157 }
105 NOTREACHED(); 158 NOTREACHED();
106 return ""; 159 return "";
107 } 160 }
108 161
109 #undef ASSERT_ENUM_BOUNDS 162 #undef ASSERT_ENUM_BOUNDS
110 #undef ENUM_CASE 163 #undef ENUM_CASE
111 164
112 } // namespace 165 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698