Index: components/sync/driver/data_type_manager_impl_unittest.cc |
diff --git a/components/sync_driver/data_type_manager_impl_unittest.cc b/components/sync/driver/data_type_manager_impl_unittest.cc |
similarity index 87% |
rename from components/sync_driver/data_type_manager_impl_unittest.cc |
rename to components/sync/driver/data_type_manager_impl_unittest.cc |
index e32db87b4ffc85c3c7761f00f778fb4c452e3014..ea42b308382fb87d2798da96d5eed0d5e2cce4dd 100644 |
--- a/components/sync_driver/data_type_manager_impl_unittest.cc |
+++ b/components/sync/driver/data_type_manager_impl_unittest.cc |
@@ -2,18 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "components/sync_driver/data_type_manager_impl.h" |
+#include "components/sync/driver/data_type_manager_impl.h" |
#include "base/compiler_specific.h" |
#include "base/message_loop/message_loop.h" |
#include "components/sync/base/model_type.h" |
#include "components/sync/core/activation_context.h" |
#include "components/sync/core/configure_reason.h" |
-#include "components/sync_driver/backend_data_type_configurer.h" |
-#include "components/sync_driver/data_type_encryption_handler.h" |
-#include "components/sync_driver/data_type_manager_observer.h" |
-#include "components/sync_driver/data_type_status_table.h" |
-#include "components/sync_driver/fake_data_type_controller.h" |
+#include "components/sync/driver/backend_data_type_configurer.h" |
+#include "components/sync/driver/data_type_encryption_handler.h" |
+#include "components/sync/driver/data_type_manager_observer.h" |
+#include "components/sync/driver/data_type_status_table.h" |
+#include "components/sync/driver/fake_data_type_controller.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace sync_driver { |
@@ -44,31 +44,24 @@ DataTypeStatusTable BuildStatusTable(ModelTypeSet crypto_errors, |
DataTypeStatusTable::TypeErrorMap error_map; |
for (ModelTypeSet::Iterator iter = crypto_errors.First(); iter.Good(); |
iter.Inc()) { |
- error_map[iter.Get()] = SyncError(FROM_HERE, |
- SyncError::CRYPTO_ERROR, |
- "crypto error expected", |
- iter.Get()); |
+ error_map[iter.Get()] = SyncError(FROM_HERE, SyncError::CRYPTO_ERROR, |
+ "crypto error expected", iter.Get()); |
} |
for (ModelTypeSet::Iterator iter = association_errors.First(); iter.Good(); |
iter.Inc()) { |
- error_map[iter.Get()] = SyncError(FROM_HERE, |
- SyncError::DATATYPE_ERROR, |
- "association error expected", |
- iter.Get()); |
+ error_map[iter.Get()] = SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, |
+ "association error expected", iter.Get()); |
} |
for (ModelTypeSet::Iterator iter = unready_errors.First(); iter.Good(); |
iter.Inc()) { |
- error_map[iter.Get()] = SyncError(FROM_HERE, |
- SyncError::UNREADY_ERROR, |
- "unready error expected", |
- iter.Get()); |
+ error_map[iter.Get()] = SyncError(FROM_HERE, SyncError::UNREADY_ERROR, |
+ "unready error expected", iter.Get()); |
} |
for (ModelTypeSet::Iterator iter = unrecoverable_errors.First(); iter.Good(); |
iter.Inc()) { |
- error_map[iter.Get()] = SyncError(FROM_HERE, |
- SyncError::UNRECOVERABLE_ERROR, |
- "unrecoverable error expected", |
- iter.Get()); |
+ error_map[iter.Get()] = |
+ SyncError(FROM_HERE, SyncError::UNRECOVERABLE_ERROR, |
+ "unrecoverable error expected", iter.Get()); |
} |
DataTypeStatusTable status_table; |
status_table.UpdateFailedDataTypes(error_map); |
@@ -132,9 +125,7 @@ class FakeBackendDataTypeConfigurer : public BackendDataTypeConfigurer { |
expected_configure_types_[config_state] = types; |
} |
- void set_ready_types(ModelTypeSet types) { |
- ready_types_ = types; |
- } |
+ void set_ready_types(ModelTypeSet types) { ready_types_ = types; } |
const ModelTypeSet activated_types() { return activated_types_; } |
@@ -160,9 +151,7 @@ class FakeDataTypeManagerObserver : public DataTypeManagerObserver { |
done_expectation_.data_type_status_table.GetFailedTypes().Empty()); |
} |
- void ExpectStart() { |
- start_expected_ = true; |
- } |
+ void ExpectStart() { start_expected_ = true; } |
void ExpectDone(const DataTypeManager::ConfigureResult& result) { |
done_expectation_ = result; |
} |
@@ -181,8 +170,7 @@ class FakeDataTypeManagerObserver : public DataTypeManagerObserver { |
ASSERT_EQ(expected_errors.size(), errors.size()); |
for (DataTypeStatusTable::TypeErrorMap::const_iterator iter = |
expected_errors.begin(); |
- iter != expected_errors.end(); |
- ++iter) { |
+ iter != expected_errors.end(); ++iter) { |
ASSERT_TRUE(errors.find(iter->first) != errors.end()); |
ASSERT_EQ(iter->second.error_type(), |
errors.find(iter->first)->second.error_type()); |
@@ -214,6 +202,7 @@ class FakeDataTypeEncryptionHandler : public DataTypeEncryptionHandler { |
void set_encrypted_types(ModelTypeSet encrypted_types) { |
encrypted_types_ = encrypted_types; |
} |
+ |
private: |
bool passphrase_required_; |
ModelTypeSet encrypted_types_; |
@@ -227,8 +216,7 @@ bool FakeDataTypeEncryptionHandler::IsPassphraseRequired() const { |
return passphrase_required_; |
} |
-ModelTypeSet |
-FakeDataTypeEncryptionHandler::GetEncryptedDataTypes() const { |
+ModelTypeSet FakeDataTypeEncryptionHandler::GetEncryptedDataTypes() const { |
return encrypted_types_; |
} |
@@ -283,18 +271,12 @@ class SyncDataTypeManagerImplTest : public testing::Test { |
protected: |
void SetUp() override { |
- dtm_.reset( |
- new TestDataTypeManager( |
- syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), |
- &configurer_, |
- &controllers_, |
- &encryption_handler_, |
- &observer_)); |
+ dtm_.reset(new TestDataTypeManager( |
+ syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), &configurer_, |
+ &controllers_, &encryption_handler_, &observer_)); |
} |
- void SetConfigureStartExpectation() { |
- observer_.ExpectStart(); |
- } |
+ void SetConfigureStartExpectation() { observer_.ExpectStart(); } |
void SetConfigureDoneExpectation(DataTypeManager::ConfigureStatus status, |
const DataTypeStatusTable& status_table) { |
@@ -305,8 +287,7 @@ class SyncDataTypeManagerImplTest : public testing::Test { |
} |
// Configure the given DTM with the given desired types. |
- void Configure(DataTypeManagerImpl* dtm, |
- const ModelTypeSet& desired_types) { |
+ void Configure(DataTypeManagerImpl* dtm, const ModelTypeSet& desired_types) { |
dtm->Configure(desired_types, syncer::CONFIGURE_REASON_RECONFIGURATION); |
} |
@@ -485,11 +466,10 @@ TEST_F(SyncDataTypeManagerImplTest, OneWaitingForCrypto) { |
AddController(PASSWORDS); |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(PASSWORDS), |
- ModelTypeSet(), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(PASSWORDS), ModelTypeSet(), ModelTypeSet(), |
+ ModelTypeSet())); |
const ModelTypeSet types(PASSWORDS); |
dtm_->set_priority_types(AddControlTypesTo(types)); |
@@ -678,11 +658,10 @@ TEST_F(SyncDataTypeManagerImplTest, OneFailingController) { |
AddController(BOOKMARKS); |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::UNRECOVERABLE_ERROR, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(), |
- ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS))); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::UNRECOVERABLE_ERROR, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(), ModelTypeSet(), |
+ ModelTypeSet(BOOKMARKS))); |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS)); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
@@ -711,11 +690,10 @@ TEST_F(SyncDataTypeManagerImplTest, SecondControllerFails) { |
AddController(PREFERENCES); |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::UNRECOVERABLE_ERROR, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(), |
- ModelTypeSet(), |
- ModelTypeSet(PREFERENCES))); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::UNRECOVERABLE_ERROR, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(), ModelTypeSet(), |
+ ModelTypeSet(PREFERENCES))); |
// Step 1. |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS, PREFERENCES)); |
@@ -731,8 +709,8 @@ TEST_F(SyncDataTypeManagerImplTest, SecondControllerFails) { |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Step 4. |
- GetController(PREFERENCES)->FinishStart( |
- DataTypeController::UNRECOVERABLE_ERROR); |
+ GetController(PREFERENCES) |
+ ->FinishStart(DataTypeController::UNRECOVERABLE_ERROR); |
EXPECT_EQ(DataTypeManager::STOPPED, dtm_->state()); |
} |
@@ -754,11 +732,10 @@ TEST_F(SyncDataTypeManagerImplTest, OneControllerFailsAssociation) { |
AddController(PREFERENCES); |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(PREFERENCES), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(PREFERENCES), |
+ ModelTypeSet(), ModelTypeSet())); |
// Step 1. |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS, PREFERENCES)); |
@@ -774,8 +751,8 @@ TEST_F(SyncDataTypeManagerImplTest, OneControllerFailsAssociation) { |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Step 4. |
- GetController(PREFERENCES)->FinishStart( |
- DataTypeController::ASSOCIATION_FAILED); |
+ GetController(PREFERENCES) |
+ ->FinishStart(DataTypeController::ASSOCIATION_FAILED); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Step 5. |
@@ -905,8 +882,7 @@ TEST_F(SyncDataTypeManagerImplTest, MigrateAll) { |
SetConfigureStartExpectation(); |
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable()); |
- dtm_->PurgeForMigration(to_migrate, |
- syncer::CONFIGURE_REASON_MIGRATION); |
+ dtm_->PurgeForMigration(to_migrate, syncer::CONFIGURE_REASON_MIGRATION); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// The DTM will call ConfigureDataTypes(), even though it is unnecessary. |
@@ -977,8 +953,7 @@ TEST_F(SyncDataTypeManagerImplTest, PrioritizedConfiguration) { |
AddController(BOOKMARKS); |
AddController(PREFERENCES); |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
// Initial configure. |
SetConfigureStartExpectation(); |
@@ -1010,8 +985,7 @@ TEST_F(SyncDataTypeManagerImplTest, PrioritizedConfigurationReconfigure) { |
AddController(PREFERENCES); |
AddController(APPS); |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
// Initial configure. |
SetConfigureStartExpectation(); |
@@ -1062,8 +1036,7 @@ TEST_F(SyncDataTypeManagerImplTest, PrioritizedConfigurationStop) { |
AddController(BOOKMARKS); |
AddController(PREFERENCES); |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
// Initial configure. |
SetConfigureStartExpectation(); |
@@ -1099,17 +1072,15 @@ TEST_F(SyncDataTypeManagerImplTest, PrioritizedConfigurationDownloadError) { |
AddController(BOOKMARKS); |
AddController(PREFERENCES); |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
// Initial configure. Bookmarks will fail to associate due to the download |
// failure. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(BOOKMARKS), ModelTypeSet(), |
+ ModelTypeSet())); |
// Initially only PREFERENCES is configured. |
configurer_.set_expected_configure_types( |
@@ -1144,25 +1115,22 @@ TEST_F(SyncDataTypeManagerImplTest, PrioritizedConfigurationDownloadError) { |
GetController(PREFERENCES)->FinishStart(DataTypeController::OK); |
FinishDownload(*dtm_, ModelTypeSet(PREFERENCES), ModelTypeSet()); |
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
- EXPECT_EQ(DataTypeController::RUNNING, |
- GetController(PREFERENCES)->state()); |
+ EXPECT_EQ(DataTypeController::RUNNING, GetController(PREFERENCES)->state()); |
EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state()); |
} |
TEST_F(SyncDataTypeManagerImplTest, HighPriorityAssociationFailure) { |
- AddController(PREFERENCES); // Will fail. |
- AddController(BOOKMARKS); // Will succeed. |
+ AddController(PREFERENCES); // Will fail. |
+ AddController(BOOKMARKS); // Will succeed. |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
// Initial configure. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(PREFERENCES), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(PREFERENCES), |
+ ModelTypeSet(), ModelTypeSet())); |
// Initially only PREFERENCES is configured. |
configurer_.set_expected_configure_types( |
@@ -1184,8 +1152,8 @@ TEST_F(SyncDataTypeManagerImplTest, HighPriorityAssociationFailure) { |
GetController(BOOKMARKS)->state()); |
// Make PREFERENCES association fail. |
- GetController(PREFERENCES)->FinishStart( |
- DataTypeController::ASSOCIATION_FAILED); |
+ GetController(PREFERENCES) |
+ ->FinishStart(DataTypeController::ASSOCIATION_FAILED); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Reconfigure without PREFERENCES after the BOOKMARKS download completes, |
@@ -1199,8 +1167,7 @@ TEST_F(SyncDataTypeManagerImplTest, HighPriorityAssociationFailure) { |
// Reconfigure with BOOKMARKS. |
FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); |
- EXPECT_EQ(DataTypeController::ASSOCIATING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::ASSOCIATING, GetController(BOOKMARKS)->state()); |
GetController(BOOKMARKS)->FinishStart(DataTypeController::OK); |
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
@@ -1213,16 +1180,14 @@ TEST_F(SyncDataTypeManagerImplTest, LowPriorityAssociationFailure) { |
AddController(PREFERENCES); // Will succeed. |
AddController(BOOKMARKS); // Will fail. |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
// Initial configure. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(BOOKMARKS), ModelTypeSet(), |
+ ModelTypeSet())); |
// Initially only PREFERENCES is configured. |
configurer_.set_expected_configure_types( |
@@ -1254,8 +1219,7 @@ TEST_F(SyncDataTypeManagerImplTest, LowPriorityAssociationFailure) { |
BackendDataTypeConfigurer::CONFIGURE_ACTIVE, |
AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
GetController(BOOKMARKS)->FinishStart(DataTypeController::ASSOCIATION_FAILED); |
- EXPECT_EQ(DataTypeController::NOT_RUNNING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state()); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Finish configuration with only PREFERENCES. |
@@ -1264,8 +1228,7 @@ TEST_F(SyncDataTypeManagerImplTest, LowPriorityAssociationFailure) { |
FinishDownload(*dtm_, ModelTypeSet(PREFERENCES), ModelTypeSet()); |
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
EXPECT_EQ(DataTypeController::RUNNING, GetController(PREFERENCES)->state()); |
- EXPECT_EQ(DataTypeController::NOT_RUNNING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state()); |
} |
TEST_F(SyncDataTypeManagerImplTest, FilterDesiredTypes) { |
@@ -1295,18 +1258,16 @@ TEST_F(SyncDataTypeManagerImplTest, ReenableAfterDataTypeError) { |
AddController(BOOKMARKS); // Will be disabled due to datatype error. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(BOOKMARKS), ModelTypeSet(), |
+ ModelTypeSet())); |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS, PREFERENCES)); |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
FinishDownload(*dtm_, ModelTypeSet(PREFERENCES, BOOKMARKS), ModelTypeSet()); |
GetController(PREFERENCES)->FinishStart(DataTypeController::OK); |
- GetController(BOOKMARKS) |
- ->FinishStart(DataTypeController::ASSOCIATION_FAILED); |
+ GetController(BOOKMARKS)->FinishStart(DataTypeController::ASSOCIATION_FAILED); |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); // Reconfig for error. |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); // Reconfig for error. |
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
@@ -1338,11 +1299,10 @@ TEST_F(SyncDataTypeManagerImplTest, UnreadyType) { |
// Bookmarks is never started due to being unready. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(), ModelTypeSet(BOOKMARKS), |
+ ModelTypeSet())); |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS)); |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
EXPECT_EQ(DataTypeController::NOT_RUNNING, GetController(BOOKMARKS)->state()); |
@@ -1376,15 +1336,14 @@ TEST_F(SyncDataTypeManagerImplTest, UnreadyType) { |
TEST_F(SyncDataTypeManagerImplTest, ModelLoadError) { |
AddController(BOOKMARKS); |
GetController(BOOKMARKS)->SetModelLoadError(syncer::SyncError( |
- FROM_HERE, SyncError::DATATYPE_ERROR, "load error", BOOKMARKS)); |
+ FROM_HERE, SyncError::DATATYPE_ERROR, "load error", BOOKMARKS)); |
// Bookmarks is never started due to hitting a model load error. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(BOOKMARKS), ModelTypeSet(), |
+ ModelTypeSet())); |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS)); |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); |
@@ -1394,24 +1353,20 @@ TEST_F(SyncDataTypeManagerImplTest, ModelLoadError) { |
EXPECT_EQ(0U, configurer_.activated_types().Size()); |
} |
- |
TEST_F(SyncDataTypeManagerImplTest, ErrorBeforeAssociation) { |
AddController(BOOKMARKS); |
// Bookmarks is never started due to hitting a datatype error while the DTM |
// is still downloading types. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(BOOKMARKS), ModelTypeSet(), |
+ ModelTypeSet())); |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS)); |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); |
GetController(BOOKMARKS)->OnSingleDataTypeUnrecoverableError( |
- syncer::SyncError(FROM_HERE, |
- SyncError::DATATYPE_ERROR, |
- "bookmarks error", |
+ syncer::SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, "bookmarks error", |
BOOKMARKS)); |
FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); |
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); // Reconfig for error. |
@@ -1426,11 +1381,10 @@ TEST_F(SyncDataTypeManagerImplTest, AssociationNeverCompletes) { |
// Bookmarks times out during association and so it's never started. |
SetConfigureStartExpectation(); |
- SetConfigureDoneExpectation(DataTypeManager::OK, |
- BuildStatusTable(ModelTypeSet(), |
- ModelTypeSet(BOOKMARKS), |
- ModelTypeSet(), |
- ModelTypeSet())); |
+ SetConfigureDoneExpectation( |
+ DataTypeManager::OK, |
+ BuildStatusTable(ModelTypeSet(), ModelTypeSet(BOOKMARKS), ModelTypeSet(), |
+ ModelTypeSet())); |
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS)); |
GetController(BOOKMARKS)->SetDelayModelLoad(); |
@@ -1458,8 +1412,7 @@ TEST_F(SyncDataTypeManagerImplTest, AllLowPriorityTypesReady) { |
AddController(PREFERENCES); |
AddController(BOOKMARKS); |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
SetConfigureStartExpectation(); |
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable()); |
@@ -1481,20 +1434,17 @@ TEST_F(SyncDataTypeManagerImplTest, AllLowPriorityTypesReady) { |
// can start associating immediately (even before the |
// BackendDataTypeConfigurer calls back). |
GetController(PREFERENCES)->FinishStart(DataTypeController::OK); |
- EXPECT_EQ(DataTypeController::ASSOCIATING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::ASSOCIATING, GetController(BOOKMARKS)->state()); |
// Once the association finishes, the DTM should still be waiting for the |
// Sync configurer to call back. |
GetController(BOOKMARKS)->FinishStart(DataTypeController::OK); |
- EXPECT_EQ(DataTypeController::RUNNING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state()); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Finishing the download should complete the configuration. |
FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); |
- EXPECT_EQ(DataTypeController::RUNNING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state()); |
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
EXPECT_EQ(2U, configurer_.activated_types().Size()); |
@@ -1508,8 +1458,7 @@ TEST_F(SyncDataTypeManagerImplTest, AllHighPriorityTypesReady) { |
AddController(PREFERENCES); |
AddController(BOOKMARKS); |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
SetConfigureStartExpectation(); |
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable()); |
@@ -1538,14 +1487,12 @@ TEST_F(SyncDataTypeManagerImplTest, AllHighPriorityTypesReady) { |
GetController(BOOKMARKS)->state()); |
FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet()); |
- EXPECT_EQ(DataTypeController::ASSOCIATING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::ASSOCIATING, GetController(BOOKMARKS)->state()); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Finishing the Bookmarks association ends the configuration. |
GetController(BOOKMARKS)->FinishStart(DataTypeController::OK); |
- EXPECT_EQ(DataTypeController::RUNNING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state()); |
EXPECT_EQ(DataTypeManager::CONFIGURED, dtm_->state()); |
EXPECT_EQ(2U, configurer_.activated_types().Size()); |
@@ -1560,8 +1507,7 @@ TEST_F(SyncDataTypeManagerImplTest, AllTypesReady) { |
AddController(PREFERENCES); |
AddController(BOOKMARKS); |
- dtm_->set_priority_types( |
- AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
+ dtm_->set_priority_types(AddControlTypesTo(ModelTypeSet(PREFERENCES))); |
SetConfigureStartExpectation(); |
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable()); |
@@ -1587,14 +1533,12 @@ TEST_F(SyncDataTypeManagerImplTest, AllTypesReady) { |
// after the high priority types finish downloading. |
configurer_.set_ready_types(ModelTypeSet(BOOKMARKS)); |
FinishDownload(*dtm_, ModelTypeSet(PREFERENCES), ModelTypeSet()); |
- EXPECT_EQ(DataTypeController::ASSOCIATING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::ASSOCIATING, GetController(BOOKMARKS)->state()); |
// Finishing the Bookmarks association leaves the DTM waiting for the low |
// priority download to finish. |
GetController(BOOKMARKS)->FinishStart(DataTypeController::OK); |
- EXPECT_EQ(DataTypeController::RUNNING, |
- GetController(BOOKMARKS)->state()); |
+ EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state()); |
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state()); |
// Finishing the low priority download ends the configuration. |