diff options
-rw-r--r-- | chrome/browser/sync/test/integration/sync_test.cc | 21 | ||||
-rw-r--r-- | sync/engine/syncer_proto_util.cc | 8 | ||||
-rw-r--r-- | sync/internal_api/public/util/syncer_error.cc | 1 | ||||
-rw-r--r-- | sync/internal_api/public/util/syncer_error.h | 1 | ||||
-rw-r--r-- | sync/protocol/proto_enum_conversions.cc | 1 | ||||
-rw-r--r-- | sync/protocol/sync_enums.proto | 1 | ||||
-rw-r--r-- | sync/protocol/sync_protocol_error.cc | 2 | ||||
-rw-r--r-- | sync/protocol/sync_protocol_error.h | 6 |
8 files changed, 35 insertions, 6 deletions
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 68bdae5..3123760 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -915,10 +915,18 @@ sync_pb::SyncEnums::ErrorType return sync_pb::SyncEnums::MIGRATION_DONE; case syncer::UNKNOWN_ERROR: return sync_pb::SyncEnums::UNKNOWN; - default: - NOTREACHED(); + case syncer::INVALID_CREDENTIAL: + NOTREACHED(); // NOTREACHED() because auth error is not set through + // error code in sync response. + return sync_pb::SyncEnums::UNKNOWN; + case syncer::DISABLED_BY_ADMIN: + return sync_pb::SyncEnums::DISABLED_BY_ADMIN; + case syncer::USER_ROLLBACK: + return sync_pb::SyncEnums::USER_ROLLBACK; + case syncer::NON_RETRIABLE_ERROR: return sync_pb::SyncEnums::UNKNOWN; } + return sync_pb::SyncEnums::UNKNOWN; } sync_pb::SyncEnums::Action GetClientToServerResponseAction( @@ -934,12 +942,15 @@ sync_pb::SyncEnums::Action GetClientToServerResponseAction( return sync_pb::SyncEnums::STOP_AND_RESTART_SYNC; case syncer::DISABLE_SYNC_ON_CLIENT: return sync_pb::SyncEnums::DISABLE_SYNC_ON_CLIENT; - case syncer::UNKNOWN_ACTION: + case syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT: + case syncer::DISABLE_SYNC_AND_ROLLBACK: + NOTREACHED(); // No corresponding proto action for these. Shouldn't + // test. return sync_pb::SyncEnums::UNKNOWN_ACTION; - default: - NOTREACHED(); + case syncer::UNKNOWN_ACTION: return sync_pb::SyncEnums::UNKNOWN_ACTION; } + return sync_pb::SyncEnums::UNKNOWN_ACTION; } } // namespace diff --git a/sync/engine/syncer_proto_util.cc b/sync/engine/syncer_proto_util.cc index dab228f..fe2a875 100644 --- a/sync/engine/syncer_proto_util.cc +++ b/sync/engine/syncer_proto_util.cc @@ -122,6 +122,8 @@ SyncProtocolErrorType ConvertSyncProtocolErrorTypePBToLocalType( return MIGRATION_DONE; case sync_pb::SyncEnums::DISABLED_BY_ADMIN: return DISABLED_BY_ADMIN; + case sync_pb::SyncEnums::USER_ROLLBACK: + return USER_ROLLBACK; case sync_pb::SyncEnums::UNKNOWN: return UNKNOWN_ERROR; case sync_pb::SyncEnums::USER_NOT_ACTIVATED: @@ -331,7 +333,9 @@ SyncProtocolError ConvertLegacyErrorCodeToNewError( error.action = DISABLE_SYNC_ON_CLIENT; } else if (error_type == sync_pb::SyncEnums::DISABLED_BY_ADMIN) { error.action = STOP_SYNC_FOR_DISABLED_ACCOUNT; - } // There is no other action we can compute for legacy server. + } else if (error_type == sync_pb::SyncEnums::USER_ROLLBACK) { + error.action = DISABLE_SYNC_AND_ROLLBACK; + } // There is no other action we can compute for legacy server. return error; } @@ -467,6 +471,8 @@ SyncerError SyncerProtoUtil::PostClientToServerMessage( return SERVER_RETURN_NOT_MY_BIRTHDAY; case DISABLED_BY_ADMIN: return SERVER_RETURN_DISABLED_BY_ADMIN; + case USER_ROLLBACK: + return SERVER_RETURN_USER_ROLLBACK; default: NOTREACHED(); return UNSET; diff --git a/sync/internal_api/public/util/syncer_error.cc b/sync/internal_api/public/util/syncer_error.cc index 81805d2..8130b1e 100644 --- a/sync/internal_api/public/util/syncer_error.cc +++ b/sync/internal_api/public/util/syncer_error.cc @@ -27,6 +27,7 @@ const char* GetSyncerErrorString(SyncerError value) { ENUM_CASE(SERVER_RETURN_CONFLICT); ENUM_CASE(SERVER_RESPONSE_VALIDATION_FAILED); ENUM_CASE(SERVER_RETURN_DISABLED_BY_ADMIN); + ENUM_CASE(SERVER_RETURN_USER_ROLLBACK); ENUM_CASE(SERVER_MORE_TO_DOWNLOAD); ENUM_CASE(DATATYPE_TRIGGERED_RETRY); ENUM_CASE(SYNCER_OK); diff --git a/sync/internal_api/public/util/syncer_error.h b/sync/internal_api/public/util/syncer_error.h index 1a5ec79..05ad963 100644 --- a/sync/internal_api/public/util/syncer_error.h +++ b/sync/internal_api/public/util/syncer_error.h @@ -30,6 +30,7 @@ enum SYNC_EXPORT_PRIVATE SyncerError { SERVER_RETURN_CONFLICT, SERVER_RESPONSE_VALIDATION_FAILED, SERVER_RETURN_DISABLED_BY_ADMIN, + SERVER_RETURN_USER_ROLLBACK, // A datatype decided the sync cycle needed to be performed again. DATATYPE_TRIGGERED_RETRY, diff --git a/sync/protocol/proto_enum_conversions.cc b/sync/protocol/proto_enum_conversions.cc index edbe591..213a096 100644 --- a/sync/protocol/proto_enum_conversions.cc +++ b/sync/protocol/proto_enum_conversions.cc @@ -150,6 +150,7 @@ const char* GetErrorTypeString(sync_pb::SyncEnums::ErrorType error_type) { ENUM_CASE(sync_pb::SyncEnums, TRANSIENT_ERROR); ENUM_CASE(sync_pb::SyncEnums, MIGRATION_DONE); ENUM_CASE(sync_pb::SyncEnums, DISABLED_BY_ADMIN); + ENUM_CASE(sync_pb::SyncEnums, USER_ROLLBACK); ENUM_CASE(sync_pb::SyncEnums, UNKNOWN); } NOTREACHED(); diff --git a/sync/protocol/sync_enums.proto b/sync/protocol/sync_enums.proto index 9305c67..6e1405b 100644 --- a/sync/protocol/sync_enums.proto +++ b/sync/protocol/sync_enums.proto @@ -98,6 +98,7 @@ message SyncEnums { // these data types only and then re-sync with // a server. DISABLED_BY_ADMIN = 10; // An administrator disabled sync for this domain. + USER_ROLLBACK = 11; // Client told to stop syncing and roll back. UNKNOWN = 100; // Unknown value. This should never be explicitly // used; it is the default value when an // out-of-date client parses a value it doesn't diff --git a/sync/protocol/sync_protocol_error.cc b/sync/protocol/sync_protocol_error.cc index cd22e9a..ac9e2fd 100644 --- a/sync/protocol/sync_protocol_error.cc +++ b/sync/protocol/sync_protocol_error.cc @@ -23,6 +23,7 @@ const char* GetSyncErrorTypeString(SyncProtocolErrorType type) { ENUM_CASE(MIGRATION_DONE); ENUM_CASE(INVALID_CREDENTIAL); ENUM_CASE(DISABLED_BY_ADMIN); + ENUM_CASE(USER_ROLLBACK); ENUM_CASE(UNKNOWN_ERROR); } NOTREACHED(); @@ -37,6 +38,7 @@ const char* GetClientActionString(ClientAction action) { ENUM_CASE(STOP_AND_RESTART_SYNC); ENUM_CASE(DISABLE_SYNC_ON_CLIENT); ENUM_CASE(STOP_SYNC_FOR_DISABLED_ACCOUNT); + ENUM_CASE(DISABLE_SYNC_AND_ROLLBACK); ENUM_CASE(UNKNOWN_ACTION); } NOTREACHED(); diff --git a/sync/protocol/sync_protocol_error.h b/sync/protocol/sync_protocol_error.h index be9232d..aef7650 100644 --- a/sync/protocol/sync_protocol_error.h +++ b/sync/protocol/sync_protocol_error.h @@ -42,6 +42,9 @@ enum SyncProtocolErrorType { // An administrator disabled sync for this domain. DISABLED_BY_ADMIN, + // Client told to stop syncing this device and roll back local data. + USER_ROLLBACK, + // The default value. UNKNOWN_ERROR }; @@ -66,6 +69,9 @@ enum ClientAction { // settings page that account is disabled. STOP_SYNC_FOR_DISABLED_ACCOUNT, + // Disable sync and roll back local model to pre-sync state. + DISABLE_SYNC_AND_ROLLBACK, + // The default. No action. UNKNOWN_ACTION }; |