Commit 2b7908a7 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Cleanup: Remove SyncError::UNRECOVERABLE_ERROR and PERSISTENCE_ERROR

...plus all the code for handling them.
These were unused (outside of some tests), so this was all dead code.

Bug: 1145589
Change-Id: Ic54a7fa293dc8cf5e785acb6cb137118f91f51d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518981Reviewed-by: default avatarJan Krcal <jkrcal@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824403}
parent c2919fdc
......@@ -257,11 +257,6 @@ DataTypeManagerImpl::BuildDataTypeConfigStateMap(
ModelTypeSet crypto_types = data_type_status_table_.GetCryptoErrorTypes();
ModelTypeSet unready_types = data_type_status_table_.GetUnreadyErrorTypes();
// Types with persistence errors are only purged/resynced when they're
// actively being configured.
ModelTypeSet clean_types = data_type_status_table_.GetPersistenceErrorTypes();
clean_types.RetainAll(types_being_configured);
// Types with unready errors do not count as unready if they've been disabled.
unready_types.RetainAll(last_requested_types_);
......@@ -278,7 +273,6 @@ DataTypeManagerImpl::BuildDataTypeConfigStateMap(
DataTypeConfigStateMap config_state_map;
SetDataTypesState(CONFIGURE_INACTIVE, enabled_types, &config_state_map);
SetDataTypesState(CONFIGURE_ACTIVE, to_configure, &config_state_map);
SetDataTypesState(CONFIGURE_CLEAN, clean_types, &config_state_map);
SetDataTypesState(DISABLED, disabled_types, &config_state_map);
SetDataTypesState(FATAL, fatal_types, &config_state_map);
SetDataTypesState(CRYPTO, crypto_types, &config_state_map);
......@@ -471,10 +465,6 @@ void DataTypeManagerImpl::DownloadCompleted(
ModelTypeSet failed_configuration_types) {
DCHECK_EQ(CONFIGURING, state_);
// Persistence errors are reset after each backend configuration attempt
// during which they would have been purged.
data_type_status_table_.ResetPersistenceErrorsFrom(downloaded_types);
if (!failed_configuration_types.Empty()) {
DataTypeStatusTable::TypeErrorMap errors;
for (ModelType type : failed_configuration_types) {
......@@ -566,12 +556,10 @@ ModelTypeSet DataTypeManagerImpl::PrepareConfigureParams(
GetDataTypesInState(UNREADY, config_state_map);
const ModelTypeSet active_types =
GetDataTypesInState(CONFIGURE_ACTIVE, config_state_map);
const ModelTypeSet clean_types =
GetDataTypesInState(CONFIGURE_CLEAN, config_state_map);
const ModelTypeSet inactive_types =
GetDataTypesInState(CONFIGURE_INACTIVE, config_state_map);
ModelTypeSet enabled_types = Union(active_types, clean_types);
ModelTypeSet enabled_types = active_types;
ModelTypeSet disabled_types = GetDataTypesInState(DISABLED, config_state_map);
disabled_types.PutAll(fatal_types);
disabled_types.PutAll(crypto_types);
......@@ -589,7 +577,6 @@ ModelTypeSet DataTypeManagerImpl::PrepareConfigureParams(
downloaded_types_.PutAll(enabled_types);
downloaded_types_.RemoveAll(disabled_types);
types_to_download.PutAll(clean_types);
types_to_download.RemoveAll(ProxyTypes());
types_to_download.RemoveAll(CommitOnlyTypes());
if (!types_to_download.Empty())
......@@ -626,10 +613,6 @@ ModelTypeSet DataTypeManagerImpl::PrepareConfigureParams(
// mode.
if (last_requested_context_.sync_mode == SyncMode::kFull) {
types_to_purge = Difference(ModelTypeSet::All(), downloaded_types_);
// Include clean_types in types_to_purge, they are part of
// |downloaded_types_|, but still need to be cleared.
DCHECK(downloaded_types_.HasAll(clean_types));
types_to_purge.PutAll(clean_types);
types_to_purge.RemoveAll(inactive_types);
types_to_purge.RemoveAll(unready_types);
}
......@@ -722,20 +705,15 @@ void DataTypeManagerImpl::OnSingleDataTypeWillStop(ModelType type,
if (error.IsSet()) {
data_type_status_table_.UpdateFailedDataType(type, error);
// Unrecoverable errors will shut down the entire backend, so no need to
// reconfigure.
if (error.error_type() != SyncError::UNRECOVERABLE_ERROR) {
needs_reconfigure_ = true;
last_requested_context_.reason =
GetReasonForProgrammaticReconfigure(last_requested_context_.reason);
// Do this asynchronously so the ModelLoadManager has a chance to
// finish stopping this type, otherwise DeactivateDataType() and Stop()
// end up getting called twice on the controller.
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&DataTypeManagerImpl::ProcessReconfigure,
weak_ptr_factory_.GetWeakPtr()));
}
needs_reconfigure_ = true;
last_requested_context_.reason =
GetReasonForProgrammaticReconfigure(last_requested_context_.reason);
// Do this asynchronously so the ModelLoadManager has a chance to
// finish stopping this type, otherwise DeactivateDataType() and Stop()
// end up getting called twice on the controller.
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&DataTypeManagerImpl::ProcessReconfigure,
weak_ptr_factory_.GetWeakPtr()));
}
}
......
......@@ -75,8 +75,6 @@ class DataTypeManagerImpl : public DataTypeManager,
CONFIGURE_INACTIVE, // Already configured or to be configured in future.
// Data of such types is left as it is, no
// downloading or purging.
CONFIGURE_CLEAN, // Actively being configured but requiring unapply
// and GetUpdates first (e.g. for persistence errors).
DISABLED, // Not syncing. Disabled by user.
FATAL, // Not syncing due to unrecoverable error.
CRYPTO, // Not syncing due to a cryptographer error.
......
......@@ -40,15 +40,14 @@ ConfigureContext BuildConfigureContext(ConfigureReason reason,
}
DataTypeStatusTable BuildStatusTable(ModelTypeSet crypto_errors,
ModelTypeSet association_errors,
ModelTypeSet unready_errors,
ModelTypeSet unrecoverable_errors) {
ModelTypeSet datatype_errors,
ModelTypeSet unready_errors) {
DataTypeStatusTable::TypeErrorMap error_map;
for (ModelType type : crypto_errors) {
error_map[type] = SyncError(FROM_HERE, SyncError::CRYPTO_ERROR,
"crypto error expected", type);
}
for (ModelType type : association_errors) {
for (ModelType type : datatype_errors) {
error_map[type] = SyncError(FROM_HERE, SyncError::DATATYPE_ERROR,
"association error expected", type);
}
......@@ -56,10 +55,6 @@ DataTypeStatusTable BuildStatusTable(ModelTypeSet crypto_errors,
error_map[type] = SyncError(FROM_HERE, SyncError::UNREADY_ERROR,
"unready error expected", type);
}
for (ModelType type : unrecoverable_errors) {
error_map[type] = SyncError(FROM_HERE, SyncError::UNRECOVERABLE_ERROR,
"unrecoverable error expected", type);
}
DataTypeStatusTable status_table;
status_table.UpdateFailedDataTypes(error_map);
return status_table;
......@@ -423,7 +418,7 @@ TEST_F(SyncDataTypeManagerImplTest, OneWaitingForCrypto) {
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(/*crypto_errors=*/ModelTypeSet(PASSWORDS),
ModelTypeSet(), ModelTypeSet(), ModelTypeSet()));
ModelTypeSet(), ModelTypeSet()));
Configure(ModelTypeSet(PASSWORDS));
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(ModelTypeSet(), ModelTypeSet()); // priority types
......@@ -588,8 +583,9 @@ TEST_F(SyncDataTypeManagerImplTest, OneFailingController) {
SetConfigureStartExpectation();
SetConfigureDoneExpectation(
DataTypeManager::UNKNOWN,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(), ModelTypeSet(),
/*unrecoverable_errors=*/ModelTypeSet(BOOKMARKS)));
BuildStatusTable(ModelTypeSet(),
/*datatype_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet()));
Configure(ModelTypeSet(BOOKMARKS));
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
......@@ -896,8 +892,8 @@ TEST_F(SyncDataTypeManagerImplTest, PrioritizedConfigurationDownloadError) {
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(),
/*association_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet(), ModelTypeSet()));
/*datatype_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet()));
// Initially only PREFERENCES is configured.
Configure(ModelTypeSet(BOOKMARKS, PREFERENCES));
......@@ -958,8 +954,7 @@ TEST_F(SyncDataTypeManagerImplTest, FailingPreconditionKeepData) {
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet()));
/*unready_errors=*/ModelTypeSet(BOOKMARKS)));
Configure(ModelTypeSet(BOOKMARKS));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state());
......@@ -1000,8 +995,7 @@ TEST_F(SyncDataTypeManagerImplTest, UnreadyTypeResetReconfigure) {
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet()));
/*unready_errors=*/ModelTypeSet(BOOKMARKS)));
Configure(ModelTypeSet(BOOKMARKS));
// Second Configure sets a flag to perform reconfiguration after the first one
// is done.
......@@ -1028,8 +1022,7 @@ TEST_F(SyncDataTypeManagerImplTest, UnreadyTypeLaterReady) {
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet()));
/*unready_errors=*/ModelTypeSet(BOOKMARKS)));
Configure(ModelTypeSet(BOOKMARKS));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
ASSERT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state());
......@@ -1067,9 +1060,9 @@ TEST_F(SyncDataTypeManagerImplTest,
SetConfigureStartExpectation();
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS, PREFERENCES),
ModelTypeSet()));
BuildStatusTable(
ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS, PREFERENCES)));
Configure(ModelTypeSet(BOOKMARKS, PREFERENCES));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
ASSERT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state());
......@@ -1116,9 +1109,9 @@ TEST_F(SyncDataTypeManagerImplTest, MultipleUnreadyTypesLaterOneOfThemReady) {
SetConfigureStartExpectation();
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS, PREFERENCES),
ModelTypeSet()));
BuildStatusTable(
ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS, PREFERENCES)));
Configure(ModelTypeSet(BOOKMARKS, PREFERENCES));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
ASSERT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state());
......@@ -1140,8 +1133,7 @@ TEST_F(SyncDataTypeManagerImplTest, MultipleUnreadyTypesLaterOneOfThemReady) {
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(PREFERENCES),
ModelTypeSet()));
/*unready_errors=*/ModelTypeSet(PREFERENCES)));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
FinishDownload(ModelTypeSet(BOOKMARKS), ModelTypeSet());
......@@ -1161,8 +1153,7 @@ TEST_F(SyncDataTypeManagerImplTest,
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(), ModelTypeSet(),
/*unready_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet()));
/*unready_errors=*/ModelTypeSet(BOOKMARKS)));
Configure(ModelTypeSet(BOOKMARKS));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
ASSERT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state());
......@@ -1206,8 +1197,8 @@ TEST_F(SyncDataTypeManagerImplTest, ModelLoadError) {
SetConfigureDoneExpectation(
DataTypeManager::OK,
BuildStatusTable(ModelTypeSet(),
/*association_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet(), ModelTypeSet()));
/*datatype_errors=*/ModelTypeSet(BOOKMARKS),
ModelTypeSet()));
Configure(ModelTypeSet(BOOKMARKS));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
FinishDownload(ModelTypeSet(BOOKMARKS), ModelTypeSet());
......@@ -1240,11 +1231,10 @@ TEST_F(SyncDataTypeManagerImplTest, ErrorBeforeStartup) {
SetConfigureStartExpectation();
Configure({BOOKMARKS, PREFERENCES});
SetConfigureDoneExpectation(
DataTypeManager::OK, BuildStatusTable(/*crypto_errors=*/{},
/*association_errors=*/{BOOKMARKS},
/*unready_errore=*/{},
/*unrecoverable_errors=*/{}));
SetConfigureDoneExpectation(DataTypeManager::OK,
BuildStatusTable(/*crypto_errors=*/{},
/*datatype_errors=*/{BOOKMARKS},
/*unready_errore=*/{}));
FinishDownload(ModelTypeSet(), ModelTypeSet()); // control types
FinishDownload(ModelTypeSet(PREFERENCES), ModelTypeSet());
......
......@@ -43,16 +43,12 @@ bool DataTypeStatusTable::UpdateFailedDataType(ModelType type,
case SyncError::UNSET:
NOTREACHED();
break;
case SyncError::UNRECOVERABLE_ERROR:
return unrecoverable_errors_.emplace(type, error).second;
case SyncError::DATATYPE_ERROR:
return data_type_errors_.emplace(type, error).second;
case SyncError::DATATYPE_POLICY_ERROR:
return data_type_policy_errors_.emplace(type, error).second;
case SyncError::CRYPTO_ERROR:
return crypto_errors_.emplace(type, error).second;
case SyncError::PERSISTENCE_ERROR:
return persistence_errors_.emplace(type, error).second;
case SyncError::UNREADY_ERROR:
return unready_errors_.emplace(type, error).second;
}
......@@ -62,11 +58,9 @@ bool DataTypeStatusTable::UpdateFailedDataType(ModelType type,
void DataTypeStatusTable::Reset() {
DVLOG(1) << "Resetting data type errors.";
unrecoverable_errors_.clear();
data_type_errors_.clear();
data_type_policy_errors_.clear();
crypto_errors_.clear();
persistence_errors_.clear();
unready_errors_.clear();
}
......@@ -74,13 +68,6 @@ void DataTypeStatusTable::ResetCryptoErrors() {
crypto_errors_.clear();
}
void DataTypeStatusTable::ResetPersistenceErrorsFrom(
ModelTypeSet purged_types) {
for (ModelType type : purged_types) {
persistence_errors_.erase(type);
}
}
bool DataTypeStatusTable::ResetDataTypePolicyErrorFor(ModelType type) {
return data_type_policy_errors_.erase(type) > 0;
}
......@@ -95,9 +82,7 @@ DataTypeStatusTable::TypeErrorMap DataTypeStatusTable::GetAllErrors() const {
result.insert(data_type_policy_errors_.begin(),
data_type_policy_errors_.end());
result.insert(crypto_errors_.begin(), crypto_errors_.end());
result.insert(persistence_errors_.begin(), persistence_errors_.end());
result.insert(unready_errors_.begin(), unready_errors_.end());
result.insert(unrecoverable_errors_.begin(), unrecoverable_errors_.end());
return result;
}
......@@ -112,7 +97,6 @@ ModelTypeSet DataTypeStatusTable::GetFatalErrorTypes() const {
ModelTypeSet result;
result.PutAll(GetTypesFromErrorMap(data_type_errors_));
result.PutAll(GetTypesFromErrorMap(data_type_policy_errors_));
result.PutAll(GetTypesFromErrorMap(unrecoverable_errors_));
return result;
}
......@@ -121,28 +105,9 @@ ModelTypeSet DataTypeStatusTable::GetCryptoErrorTypes() const {
return result;
}
ModelTypeSet DataTypeStatusTable::GetPersistenceErrorTypes() const {
ModelTypeSet result = GetTypesFromErrorMap(persistence_errors_);
return result;
}
ModelTypeSet DataTypeStatusTable::GetUnreadyErrorTypes() const {
ModelTypeSet result = GetTypesFromErrorMap(unready_errors_);
return result;
}
ModelTypeSet DataTypeStatusTable::GetUnrecoverableErrorTypes() const {
ModelTypeSet result = GetTypesFromErrorMap(unrecoverable_errors_);
return result;
}
SyncError DataTypeStatusTable::GetUnrecoverableError() const {
// Just return the first one. It is assumed all the unrecoverable errors
// have the same cause. The others are just tracked to know which types
// were involved.
return (unrecoverable_errors_.empty()
? SyncError()
: unrecoverable_errors_.begin()->second);
}
} // namespace syncer
......@@ -39,9 +39,6 @@ class DataTypeStatusTable {
// Resets the set of types with cryptographer errors.
void ResetCryptoErrors();
// Resets those persistence errors that intersect with |purged_types|.
void ResetPersistenceErrorsFrom(ModelTypeSet purged_types);
// Removes |type| from the data_type_errors_ set. Returns true if the type
// was removed from the error set, false if the type did not have a data type
// error to begin with.
......@@ -56,45 +53,27 @@ class DataTypeStatusTable {
TypeErrorMap GetAllErrors() const;
// Returns all types with failure errors. This includes, fatal, crypto, and
// unready types.`
// unready types.
ModelTypeSet GetFailedTypes() const;
// Returns the types that are failing due to unrecoverable or datatype errors.
// Returns the types that are failing due to datatype errors.
ModelTypeSet GetFatalErrorTypes() const;
// Returns the types that are failing due to cryptographer errors.
ModelTypeSet GetCryptoErrorTypes() const;
// Returns the types that are failing due to persistence errors.
ModelTypeSet GetPersistenceErrorTypes() const;
// Returns the types that cannot be configured due to not being ready.
ModelTypeSet GetUnreadyErrorTypes() const;
// Returns the types that triggered the unrecoverable error.
ModelTypeSet GetUnrecoverableErrorTypes() const;
// Returns the current unrecoverable error, if there is one.
SyncError GetUnrecoverableError() const;
private:
// The current unrecoverable errors. Only one unrecoverable error can be
// active at a time, but it may apply to more than one type.
TypeErrorMap unrecoverable_errors_;
// List of data types that failed due to runtime errors and should be
// disabled. These are different from unrecoverable_errors_ in that
// ResetDataTypeError can remove them from this list.
// disabled. ResetDataTypeError can remove them from this list.
TypeErrorMap data_type_errors_;
TypeErrorMap data_type_policy_errors_;
// List of data types that failed due to the cryptographer not being ready.
TypeErrorMap crypto_errors_;
// List of data types that failed because sync did not persist the newest
// version of their data.
TypeErrorMap persistence_errors_;
// List of data types that could not start due to not being ready. These can
// be marked as ready by calling ResetUnreadyErrorFor(..).
TypeErrorMap unready_errors_;
......
......@@ -1044,35 +1044,15 @@ void ProfileSyncService::OnConfigureDone(
// ABORT - Configuration was aborted. This is not an error, if
// initiated by user.
// OK - Some or all types succeeded.
// Everything else is an UnrecoverableError. So treat it as such.
// First handle the abort case.
if (result.status == DataTypeManager::ABORTED &&
expect_sync_configuration_aborted_) {
if (result.status == DataTypeManager::ABORTED) {
DCHECK(expect_sync_configuration_aborted_);
DVLOG(0) << "ProfileSyncService::Observe Sync Configure aborted";
expect_sync_configuration_aborted_ = false;
return;
}
// Handle unrecoverable error.
if (result.status != DataTypeManager::OK) {
// Something catastrophic had happened. We should only have one
// error representing it.
SyncError error = result.data_type_status_table.GetUnrecoverableError();
DCHECK(error.IsSet());
std::string message =
"Sync configuration failed with status " +
DataTypeManager::ConfigureStatusToString(result.status) +
" caused by " +
ModelTypeSetToString(
result.data_type_status_table.GetUnrecoverableErrorTypes()) +
": " + error.message();
LOG(ERROR) << "ProfileSyncService error: " << message;
OnUnrecoverableErrorImpl(error.location(), message,
ERROR_REASON_CONFIGURATION_FAILURE);
return;
}
DCHECK_EQ(DataTypeManager::OK, result.status);
// We should never get in a state where we have no encrypted datatypes
......
......@@ -261,7 +261,6 @@ class ProfileSyncService : public SyncService,
ERROR_REASON_SYNCER,
ERROR_REASON_ENGINE_INIT_FAILURE,
ERROR_REASON_CONFIGURATION_RETRY,
ERROR_REASON_CONFIGURATION_FAILURE,
ERROR_REASON_ACTIONABLE_ERROR,
ERROR_REASON_LIMIT
};
......
......@@ -34,13 +34,6 @@ namespace {
const char kEmail[] = "test_user@gmail.com";
void SetError(DataTypeManager::ConfigureResult* result) {
DataTypeStatusTable::TypeErrorMap errors;
errors[BOOKMARKS] =
SyncError(FROM_HERE, SyncError::UNRECOVERABLE_ERROR, "Error", BOOKMARKS);
result->data_type_status_table.UpdateFailedDataTypes(errors);
}
} // namespace
ACTION_P(InvokeOnConfigureStart, sync_service) {
......@@ -545,29 +538,6 @@ TEST_F(ProfileSyncServiceStartupTest, SwitchManaged) {
EXPECT_FALSE(sync_service()->IsSyncFeatureActive());
}
TEST_F(ProfileSyncServiceStartupTest, StartFailure) {
sync_prefs()->SetSyncRequested(true);
sync_prefs()->SetFirstSetupComplete();
CreateSyncService(ProfileSyncService::MANUAL_START);
SimulateTestUserSignin();
SetUpFakeSyncEngine();
DataTypeManagerMock* data_type_manager = SetUpDataTypeManagerMock();
DataTypeManager::ConfigureStatus status = DataTypeManager::ABORTED;
DataTypeManager::ConfigureResult result(status, ModelTypeSet());
EXPECT_CALL(*data_type_manager, Configure(_, _))
.WillRepeatedly(
DoAll(InvokeOnConfigureStart(sync_service()),
InvokeOnConfigureDone(sync_service(),
base::BindRepeating(&SetError), result)));
EXPECT_CALL(*data_type_manager, state())
.WillOnce(Return(DataTypeManager::STOPPED));
sync_service()->Initialize();
EXPECT_TRUE(sync_service()->HasUnrecoverableError());
EXPECT_EQ(SyncService::DisableReasonSet(
SyncService::DISABLE_REASON_UNRECOVERABLE_ERROR),
sync_service()->GetDisableReasons());
}
TEST_F(ProfileSyncServiceStartupTest, StartDownloadFailed) {
sync_prefs()->SetSyncRequested(true);
CreateSyncService(ProfileSyncService::MANUAL_START);
......
......@@ -109,15 +109,9 @@ SyncError::Severity SyncError::GetSeverity() const {
std::string SyncError::GetMessagePrefix() const {
std::string type_message;
switch (error_type_) {
case UNRECOVERABLE_ERROR:
type_message = "unrecoverable error was encountered: ";
break;
case DATATYPE_ERROR:
type_message = "datatype error was encountered: ";
break;
case PERSISTENCE_ERROR:
type_message = "persistence error was encountered: ";
break;
case CRYPTO_ERROR:
type_message = "cryptographer error was encountered: ";
break;
......
......@@ -5,7 +5,6 @@
#ifndef COMPONENTS_SYNC_MODEL_SYNC_ERROR_H_
#define COMPONENTS_SYNC_MODEL_SYNC_ERROR_H_
#include <iosfwd>
#include <memory>
#include <string>
......@@ -27,15 +26,10 @@ class SyncError {
// have more complicated results).
enum ErrorType {
UNSET, // No error.
UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered,
// and sync should be disabled and purged completely.
DATATYPE_ERROR, // A datatype error was encountered, and the datatype
// should be disabled and purged completely. Note
// that datatype errors may be reset, triggering a
// re-enable.
PERSISTENCE_ERROR, // A persistence error was detected, and the
// datataype should be associated after a sync
// update.
CRYPTO_ERROR, // A cryptographer error was detected, and the
// datatype should be associated after it is
// resolved.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment