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

Unified Diff: components/sync/driver/data_type_manager_impl_unittest.cc

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/driver/data_type_manager_impl.cc ('k') | components/sync/driver/data_type_manager_mock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index cc31f5d48aff36765ed1a4e2ebec80396a8023cc..ce74a49acf020294a14fda28ca94ce1e98f67787 100644
--- a/components/sync/driver/data_type_manager_impl_unittest.cc
+++ b/components/sync/driver/data_type_manager_impl_unittest.cc
@@ -20,13 +20,23 @@
#include "components/sync/driver/fake_data_type_controller.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace syncer {
+namespace sync_driver {
+
+using syncer::SyncError;
+using syncer::ModelType;
+using syncer::ModelTypeSet;
+using syncer::ModelTypeToString;
+using syncer::BOOKMARKS;
+using syncer::APPS;
+using syncer::PASSWORDS;
+using syncer::PREFERENCES;
+using syncer::NIGORI;
namespace {
// Helper for unioning with control types.
ModelTypeSet AddControlTypesTo(ModelTypeSet types) {
- ModelTypeSet result = ControlTypes();
+ ModelTypeSet result = syncer::ControlTypes();
result.PutAll(types);
return result;
}
@@ -69,8 +79,8 @@ class FakeBackendDataTypeConfigurer : public BackendDataTypeConfigurer {
FakeBackendDataTypeConfigurer() : configure_call_count_(0) {}
~FakeBackendDataTypeConfigurer() override {}
- ModelTypeSet ConfigureDataTypes(
- ConfigureReason reason,
+ syncer::ModelTypeSet ConfigureDataTypes(
+ syncer::ConfigureReason reason,
const DataTypeConfigStateMap& config_state_map,
const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task,
const base::Callback<void()>& retry_callback) override {
@@ -91,22 +101,22 @@ class FakeBackendDataTypeConfigurer : public BackendDataTypeConfigurer {
return ready_types_;
}
- void ActivateDirectoryDataType(ModelType type,
- ModelSafeGroup group,
+ void ActivateDirectoryDataType(syncer::ModelType type,
+ syncer::ModelSafeGroup group,
ChangeProcessor* change_processor) override {
activated_types_.Put(type);
}
- void DeactivateDirectoryDataType(ModelType type) override {
+ void DeactivateDirectoryDataType(syncer::ModelType type) override {
activated_types_.Remove(type);
}
- void ActivateNonBlockingDataType(
- ModelType type,
- std::unique_ptr<ActivationContext> activation_context) override {
+ void ActivateNonBlockingDataType(syncer::ModelType type,
+ std::unique_ptr<syncer_v2::ActivationContext>
+ activation_context) override {
// TODO(stanisc): crbug.com/515962: Add test coverage.
}
- void DeactivateNonBlockingDataType(ModelType type) override {
+ void DeactivateNonBlockingDataType(syncer::ModelType type) override {
// TODO(stanisc): crbug.com/515962: Add test coverage.
}
@@ -219,7 +229,8 @@ ModelTypeSet FakeDataTypeEncryptionHandler::GetEncryptedDataTypes() const {
class TestDataTypeManager : public DataTypeManagerImpl {
public:
TestDataTypeManager(
- const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
+ const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
+ debug_info_listener,
BackendDataTypeConfigurer* configurer,
const DataTypeController::TypeMap* controllers,
const DataTypeEncryptionHandler* encryption_handler,
@@ -229,7 +240,7 @@ class TestDataTypeManager : public DataTypeManagerImpl {
encryption_handler,
configurer,
observer),
- custom_priority_types_(ControlTypes()) {}
+ custom_priority_types_(syncer::ControlTypes()) {}
void set_priority_types(const ModelTypeSet& priority_types) {
custom_priority_types_ = priority_types;
@@ -264,9 +275,9 @@ class SyncDataTypeManagerImplTest : public testing::Test {
protected:
void SetUp() override {
- dtm_.reset(new TestDataTypeManager(WeakHandle<DataTypeDebugInfoListener>(),
- &configurer_, &controllers_,
- &encryption_handler_, &observer_));
+ dtm_.reset(new TestDataTypeManager(
+ syncer::WeakHandle<syncer::DataTypeDebugInfoListener>(), &configurer_,
+ &controllers_, &encryption_handler_, &observer_));
}
void SetConfigureStartExpectation() { observer_.ExpectStart(); }
@@ -281,7 +292,7 @@ class SyncDataTypeManagerImplTest : public testing::Test {
// Configure the given DTM with the given desired types.
void Configure(DataTypeManagerImpl* dtm, const ModelTypeSet& desired_types) {
- dtm->Configure(desired_types, CONFIGURE_REASON_RECONFIGURATION);
+ dtm->Configure(desired_types, syncer::CONFIGURE_REASON_RECONFIGURATION);
}
// Finish downloading for the given DTM. Should be done only after
@@ -292,7 +303,7 @@ class SyncDataTypeManagerImplTest : public testing::Test {
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm.state());
ASSERT_FALSE(configurer_.last_ready_task().is_null());
configurer_.last_ready_task().Run(
- Difference(types_to_configure, failed_download_types),
+ syncer::Difference(types_to_configure, failed_download_types),
failed_download_types);
}
@@ -882,11 +893,11 @@ TEST_F(SyncDataTypeManagerImplTest, MigrateAll) {
// Pretend we were told to migrate all types.
ModelTypeSet to_migrate;
to_migrate.Put(BOOKMARKS);
- to_migrate.PutAll(ControlTypes());
+ to_migrate.PutAll(syncer::ControlTypes());
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- dtm_->PurgeForMigration(to_migrate, 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.
@@ -920,7 +931,8 @@ TEST_F(SyncDataTypeManagerImplTest, ConfigureDuringPurge) {
// Purge the Nigori type.
SetConfigureStartExpectation();
- dtm_->PurgeForMigration(ModelTypeSet(NIGORI), CONFIGURE_REASON_MIGRATION);
+ dtm_->PurgeForMigration(ModelTypeSet(NIGORI),
+ syncer::CONFIGURE_REASON_MIGRATION);
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
observer_.ResetExpectations();
@@ -1162,7 +1174,7 @@ TEST_F(SyncDataTypeManagerImplTest, HighPriorityAssociationFailure) {
// Reconfigure without PREFERENCES after the BOOKMARKS download completes,
// then reconfigure with BOOKMARKS.
configurer_.set_expected_configure_types(
- BackendDataTypeConfigurer::CONFIGURE_ACTIVE, ControlTypes());
+ BackendDataTypeConfigurer::CONFIGURE_ACTIVE, syncer::ControlTypes());
FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet());
configurer_.set_expected_configure_types(
BackendDataTypeConfigurer::CONFIGURE_ACTIVE, ModelTypeSet(BOOKMARKS));
@@ -1243,7 +1255,7 @@ TEST_F(SyncDataTypeManagerImplTest, FilterDesiredTypes) {
SetConfigureStartExpectation();
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- ModelTypeSet expected_types = ControlTypes();
+ ModelTypeSet expected_types = syncer::ControlTypes();
expected_types.Put(BOOKMARKS);
// APPS is filtered out because there's no controller for it.
configurer_.set_expected_configure_types(
@@ -1281,7 +1293,7 @@ TEST_F(SyncDataTypeManagerImplTest, ReenableAfterDataTypeError) {
// Re-enable bookmarks.
SetConfigureDoneExpectation(DataTypeManager::OK, DataTypeStatusTable());
- dtm_->ReenableType(BOOKMARKS);
+ dtm_->ReenableType(syncer::BOOKMARKS);
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet());
@@ -1293,7 +1305,7 @@ TEST_F(SyncDataTypeManagerImplTest, ReenableAfterDataTypeError) {
EXPECT_EQ(DataTypeController::RUNNING, GetController(BOOKMARKS)->state());
// Should do nothing.
- dtm_->ReenableType(BOOKMARKS);
+ dtm_->ReenableType(syncer::BOOKMARKS);
}
TEST_F(SyncDataTypeManagerImplTest, UnreadyType) {
@@ -1338,8 +1350,8 @@ TEST_F(SyncDataTypeManagerImplTest, UnreadyType) {
TEST_F(SyncDataTypeManagerImplTest, ModelLoadError) {
AddController(BOOKMARKS);
- GetController(BOOKMARKS)->SetModelLoadError(
- SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, "load error", BOOKMARKS));
+ GetController(BOOKMARKS)->SetModelLoadError(syncer::SyncError(
+ FROM_HERE, SyncError::DATATYPE_ERROR, "load error", BOOKMARKS));
// Bookmarks is never started due to hitting a model load error.
SetConfigureStartExpectation();
@@ -1369,8 +1381,8 @@ TEST_F(SyncDataTypeManagerImplTest, ErrorBeforeAssociation) {
Configure(dtm_.get(), ModelTypeSet(BOOKMARKS));
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet());
GetController(BOOKMARKS)->CreateErrorHandler()->OnUnrecoverableError(
- SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, "bookmarks error",
- BOOKMARKS));
+ syncer::SyncError(FROM_HERE, SyncError::DATATYPE_ERROR, "bookmarks error",
+ BOOKMARKS));
base::RunLoop().RunUntilIdle();
FinishDownload(*dtm_, ModelTypeSet(BOOKMARKS), ModelTypeSet());
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet()); // Reconfig for error.
@@ -1568,7 +1580,7 @@ TEST_F(SyncDataTypeManagerImplTest, CatchUpTypeAddedToConfigureClean) {
AddControlTypesTo(ModelTypeSet(BOOKMARKS, PASSWORDS)));
dtm_->Configure(ModelTypeSet(BOOKMARKS, PASSWORDS),
- CONFIGURE_REASON_CATCH_UP);
+ syncer::CONFIGURE_REASON_CATCH_UP);
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet());
@@ -1601,7 +1613,7 @@ TEST_F(SyncDataTypeManagerImplTest, CatchUpMultipleConfigureCalls) {
configurer_.set_expected_configure_types(
BackendDataTypeConfigurer::CONFIGURE_CLEAN,
AddControlTypesTo(ModelTypeSet(BOOKMARKS)));
- dtm_->Configure(ModelTypeSet(BOOKMARKS), CONFIGURE_REASON_CATCH_UP);
+ dtm_->Configure(ModelTypeSet(BOOKMARKS), syncer::CONFIGURE_REASON_CATCH_UP);
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
// Configure with both types before the first one completes. Both types should
@@ -1610,7 +1622,7 @@ TEST_F(SyncDataTypeManagerImplTest, CatchUpMultipleConfigureCalls) {
BackendDataTypeConfigurer::CONFIGURE_CLEAN,
AddControlTypesTo(ModelTypeSet(BOOKMARKS, PASSWORDS)));
dtm_->Configure(ModelTypeSet(BOOKMARKS, PASSWORDS),
- CONFIGURE_REASON_RECONFIGURATION);
+ syncer::CONFIGURE_REASON_RECONFIGURATION);
EXPECT_EQ(DataTypeManager::CONFIGURING, dtm_->state());
FinishDownload(*dtm_, ModelTypeSet(), ModelTypeSet());
@@ -1678,4 +1690,4 @@ TEST_F(SyncDataTypeManagerImplTest, RegisterWithBackendOnEncryptionError) {
EXPECT_EQ(1, GetController(PASSWORDS)->register_with_backend_call_count());
}
-} // namespace syncer
+} // namespace sync_driver
« no previous file with comments | « components/sync/driver/data_type_manager_impl.cc ('k') | components/sync/driver/data_type_manager_mock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698