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

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

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