Commit 71da4dd6 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Cleanup: Remove ProfileSyncService::data_type_status_table()

It was only used in a single test, and only to verify a precondition,
not an actual test expecation.

Bug: 839834
Change-Id: I1d27c55b1178f765e89a8c4223533bed8ba24933
Reviewed-on: https://chromium-review.googlesource.com/1101210Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567584}
parent 7b4ac3ab
......@@ -44,11 +44,6 @@ void VerifyExistence(UserShare* user_share,
<< ModelTypeToString(selectable) << "->" << ModelTypeToString(grouped);
}
bool IsUnready(const syncer::DataTypeStatusTable& data_type_status_table,
ModelType type) {
return data_type_status_table.GetUnreadyErrorTypes().Has(type);
}
// The current approach this test class takes is to examine the Directory and
// check for root nodes to see if a type is currently enabled. While this works
// for things in the directory, it does not work for USS types. USS does not
......@@ -114,7 +109,6 @@ class EnableDisableSingleClientTest : public SyncTest {
ASSERT_TRUE(GetClient(0)->SetupSync(ModelTypeSet()));
}
user_share_ = GetSyncService(0)->GetUserShare();
data_type_status_table_ = GetSyncService(0)->data_type_status_table();
registered_types_ = GetSyncService(0)->GetRegisteredDataTypes();
selectable_types_ = UserSelectableTypes();
......@@ -144,7 +138,6 @@ class EnableDisableSingleClientTest : public SyncTest {
std::unique_ptr<SyncPrefs> sync_prefs_;
UserShare* user_share_;
syncer::DataTypeStatusTable data_type_status_table_;
ModelTypeSet registered_types_;
ModelTypeSet selectable_types_;
ModelTypeSet multi_grouped_types_;
......@@ -181,14 +174,6 @@ IN_PROC_BROWSER_TEST_F(EnableDisableSingleClientTest, DisableOneAtATime) {
// Setup sync with no disabled types.
SetupTest(true);
// Make sure all top-level nodes exist first.
for (ModelTypeSet::Iterator rdi = registered_directory_types_.First();
rdi.Good(); rdi.Inc()) {
EXPECT_TRUE(DoesTopLevelNodeExist(user_share_, rdi.Get()) ||
IsUnready(data_type_status_table_, rdi.Get()))
<< ModelTypeToString(rdi.Get());
}
for (ModelTypeSet::Iterator si = selectable_types_.First(); si.Good();
si.Inc()) {
const ModelTypeSet grouped_types = ResolveGroup(si.Get());
......
......@@ -1091,7 +1091,7 @@ void ProfileSyncService::ClearServerDataForTest(const base::Closure& callback) {
void ProfileSyncService::OnConfigureDone(
const DataTypeManager::ConfigureResult& result) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
data_type_status_table_ = result.data_type_status_table;
data_type_error_map_ = result.data_type_status_table.GetAllErrors();
if (!sync_configure_start_time_.is_null()) {
if (result.status == DataTypeManager::OK) {
......@@ -1136,14 +1136,15 @@ void ProfileSyncService::OnConfigureDone(
}
// Something catastrophic had happened. We should only have one
// error representing it.
syncer::SyncError error = data_type_status_table_.GetUnrecoverableError();
syncer::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 " +
syncer::ModelTypeSetToString(
data_type_status_table_.GetUnrecoverableErrorTypes()) +
result.data_type_status_table.GetUnrecoverableErrorTypes()) +
": " + error.message();
LOG(ERROR) << "ProfileSyncService error: " << message;
OnInternalUnrecoverableError(error.location(), message, true,
......@@ -1609,8 +1610,6 @@ std::unique_ptr<base::Value> ProfileSyncService::GetTypeStatusMap() {
type_status_header->SetString("group_type", "Group Type");
result->Append(std::move(type_status_header));
const DataTypeStatusTable::TypeErrorMap error_map =
data_type_status_table_.GetAllErrors();
ModelSafeRoutingInfo routing_info;
engine_->GetModelSafeRoutingInfo(&routing_info);
const ModelTypeSet registered = GetRegisteredDataTypes();
......@@ -1622,8 +1621,8 @@ std::unique_ptr<base::Value> ProfileSyncService::GetTypeStatusMap() {
type_status->SetString("group_type",
ModelSafeGroupToString(routing_info[type]));
if (error_map.find(type) != error_map.end()) {
const syncer::SyncError& error = error_map.find(type)->second;
if (data_type_error_map_.find(type) != data_type_error_map_.end()) {
const syncer::SyncError& error = data_type_error_map_.find(type)->second;
DCHECK(error.IsSet());
switch (error.GetSeverity()) {
case syncer::SyncError::SYNC_ERROR_SEVERITY_ERROR:
......@@ -2011,11 +2010,6 @@ syncer::ModelTypeSet ProfileSyncService::GetDataTypesFromPreferenceProviders()
return types;
}
const DataTypeStatusTable& ProfileSyncService::data_type_status_table() const {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return data_type_status_table_;
}
void ProfileSyncService::OnInternalUnrecoverableError(
const base::Location& from_here,
const std::string& message,
......
......@@ -470,9 +470,6 @@ class ProfileSyncService : public syncer::SyncService,
return sync_error_controller_.get();
}
// TODO(sync): This is only used in tests. Can we remove it?
const syncer::DataTypeStatusTable& data_type_status_table() const;
// KeyedService implementation. This must be called exactly
// once (before this object is destroyed).
void Shutdown() override;
......@@ -782,7 +779,7 @@ class ProfileSyncService : public syncer::SyncService,
// Tracks the set of failed data types (those that encounter an error
// or must delay loading for some reason).
syncer::DataTypeStatusTable data_type_status_table_;
syncer::DataTypeStatusTable::TypeErrorMap data_type_error_map_;
// The set of currently enabled sync experiments.
syncer::Experiments current_experiments_;
......
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