Index: components/sync/driver/glue/sync_backend_registrar_unittest.cc |
diff --git a/components/sync/driver/glue/sync_backend_registrar_unittest.cc b/components/sync/driver/glue/sync_backend_registrar_unittest.cc |
index cd4f11d81e825157e0f331e8341ee5943fd4cdfa..d4be414864d45f99838a6cc3f30d974fe0be380d 100644 |
--- a/components/sync/driver/glue/sync_backend_registrar_unittest.cc |
+++ b/components/sync/driver/glue/sync_backend_registrar_unittest.cc |
@@ -17,7 +17,7 @@ |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-namespace syncer { |
+namespace browser_sync { |
namespace { |
@@ -25,13 +25,27 @@ using ::testing::_; |
using ::testing::InSequence; |
using ::testing::Return; |
using ::testing::StrictMock; |
+using syncer::FIRST_REAL_MODEL_TYPE; |
+using syncer::AUTOFILL; |
+using syncer::BOOKMARKS; |
+using syncer::PREFERENCES; |
+using syncer::THEMES; |
+using syncer::NIGORI; |
+using syncer::PASSWORDS; |
+using syncer::MODEL_TYPE_COUNT; |
+using syncer::ModelSafeGroup; |
+using syncer::ModelSafeRoutingInfo; |
+using syncer::ModelTypeSet; |
+using syncer::ModelType; |
+using syncer::ModelTypeFromInt; |
void TriggerChanges(SyncBackendRegistrar* registrar, ModelType type) { |
- registrar->OnChangesApplied(type, 0, NULL, ImmutableChangeRecordList()); |
+ registrar->OnChangesApplied(type, 0, NULL, |
+ syncer::ImmutableChangeRecordList()); |
registrar->OnChangesComplete(type); |
} |
-class RegistrarSyncClient : public FakeSyncClient { |
+class RegistrarSyncClient : public sync_driver::FakeSyncClient { |
public: |
RegistrarSyncClient( |
const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
@@ -41,18 +55,18 @@ class RegistrarSyncClient : public FakeSyncClient { |
db_task_runner_(db_task_runner), |
file_task_runner_(file_task_runner) {} |
- scoped_refptr<ModelSafeWorker> CreateModelWorkerForGroup( |
+ scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( |
ModelSafeGroup group, |
- WorkerLoopDestructionObserver* observer) override { |
+ syncer::WorkerLoopDestructionObserver* observer) override { |
switch (group) { |
- case GROUP_UI: |
+ case syncer::GROUP_UI: |
return new BrowserThreadModelWorker(ui_task_runner_, group, observer); |
- case GROUP_DB: |
+ case syncer::GROUP_DB: |
return new BrowserThreadModelWorker(db_task_runner_, group, observer); |
- case GROUP_FILE: |
+ case syncer::GROUP_FILE: |
return new BrowserThreadModelWorker(file_task_runner_, group, observer); |
- case GROUP_PASSIVE: |
- return new PassiveModelWorker(observer); |
+ case syncer::GROUP_PASSIVE: |
+ return new syncer::PassiveModelWorker(observer); |
default: |
return nullptr; |
} |
@@ -67,11 +81,11 @@ class RegistrarSyncClient : public FakeSyncClient { |
// Flaky: https://crbug.com/498238 |
class SyncBackendRegistrarTest : public testing::Test { |
public: |
- void TestNonUIDataTypeActivationAsync(ChangeProcessor* processor, |
+ void TestNonUIDataTypeActivationAsync(sync_driver::ChangeProcessor* processor, |
base::WaitableEvent* done) { |
- registrar_->ActivateDataType(AUTOFILL, GROUP_DB, processor, |
+ registrar_->ActivateDataType(AUTOFILL, syncer::GROUP_DB, processor, |
test_user_share_.user_share()); |
- ExpectRoutingInfo(registrar_.get(), {{AUTOFILL, GROUP_DB}}); |
+ ExpectRoutingInfo(registrar_.get(), {{AUTOFILL, syncer::GROUP_DB}}); |
ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet(AUTOFILL)); |
TriggerChanges(registrar_.get(), AUTOFILL); |
done->Signal(); |
@@ -124,7 +138,7 @@ class SyncBackendRegistrarTest : public testing::Test { |
} |
size_t GetWorkersSize() { |
- std::vector<scoped_refptr<ModelSafeWorker>> workers; |
+ std::vector<scoped_refptr<syncer::ModelSafeWorker>> workers; |
registrar_->GetWorkers(&workers); |
return workers.size(); |
} |
@@ -145,7 +159,7 @@ class SyncBackendRegistrarTest : public testing::Test { |
base::Thread db_thread_; |
base::Thread file_thread_; |
- TestUserShare test_user_share_; |
+ syncer::TestUserShare test_user_share_; |
std::unique_ptr<RegistrarSyncClient> sync_client_; |
std::unique_ptr<SyncBackendRegistrar> registrar_; |
@@ -168,7 +182,7 @@ TEST_F(SyncBackendRegistrarTest, ConstructorNonEmpty) { |
EXPECT_EQ(ModelTypeSet(NIGORI), registrar_->GetLastConfiguredTypes()); |
// Bookmarks dropped because it is nonblocking. |
// Passwords dropped because of no password store. |
- ExpectRoutingInfo(registrar_.get(), {{NIGORI, GROUP_PASSIVE}}); |
+ ExpectRoutingInfo(registrar_.get(), {{NIGORI, syncer::GROUP_PASSIVE}}); |
ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); |
} |
@@ -181,7 +195,7 @@ TEST_F(SyncBackendRegistrarTest, ConstructorNonEmptyReversedInitialization) { |
EXPECT_EQ(ModelTypeSet(NIGORI), registrar_->GetLastConfiguredTypes()); |
// Bookmarks dropped because it is nonblocking. |
// Passwords dropped because of no password store. |
- ExpectRoutingInfo(registrar_.get(), {{NIGORI, GROUP_PASSIVE}}); |
+ ExpectRoutingInfo(registrar_.get(), {{NIGORI, syncer::GROUP_PASSIVE}}); |
ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); |
} |
@@ -192,9 +206,9 @@ TEST_F(SyncBackendRegistrarTest, ConfigureDataTypes) { |
// Add. |
const ModelTypeSet types1(BOOKMARKS, NIGORI, AUTOFILL); |
EXPECT_EQ(types1, registrar_->ConfigureDataTypes(types1, ModelTypeSet())); |
- ExpectRoutingInfo(registrar_.get(), {{BOOKMARKS, GROUP_NON_BLOCKING}, |
- {NIGORI, GROUP_PASSIVE}, |
- {AUTOFILL, GROUP_PASSIVE}}); |
+ ExpectRoutingInfo(registrar_.get(), {{BOOKMARKS, syncer::GROUP_NON_BLOCKING}, |
+ {NIGORI, syncer::GROUP_PASSIVE}, |
+ {AUTOFILL, syncer::GROUP_PASSIVE}}); |
ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); |
EXPECT_EQ(types1, registrar_->GetLastConfiguredTypes()); |
@@ -202,8 +216,8 @@ TEST_F(SyncBackendRegistrarTest, ConfigureDataTypes) { |
const ModelTypeSet types2(PREFERENCES, THEMES); |
EXPECT_EQ(types2, registrar_->ConfigureDataTypes(types2, types1)); |
- ExpectRoutingInfo(registrar_.get(), |
- {{PREFERENCES, GROUP_PASSIVE}, {THEMES, GROUP_PASSIVE}}); |
+ ExpectRoutingInfo(registrar_.get(), {{PREFERENCES, syncer::GROUP_PASSIVE}, |
+ {THEMES, syncer::GROUP_PASSIVE}}); |
ExpectHasProcessorsForTypes(*registrar_, ModelTypeSet()); |
EXPECT_EQ(types2, registrar_->GetLastConfiguredTypes()); |
@@ -221,7 +235,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) { |
// Should do nothing. |
TriggerChanges(registrar_.get(), BOOKMARKS); |
- StrictMock<ChangeProcessorMock> change_processor_mock; |
+ StrictMock<sync_driver::ChangeProcessorMock> change_processor_mock; |
EXPECT_CALL(change_processor_mock, StartImpl()); |
EXPECT_CALL(change_processor_mock, IsRunning()).WillRepeatedly(Return(true)); |
EXPECT_CALL(change_processor_mock, ApplyChangesFromSyncModel(NULL, _, _)); |
@@ -231,9 +245,10 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateUIDataType) { |
const ModelTypeSet types(BOOKMARKS); |
EXPECT_EQ(types, registrar_->ConfigureDataTypes(types, ModelTypeSet())); |
- registrar_->ActivateDataType(BOOKMARKS, GROUP_UI, &change_processor_mock, |
+ registrar_->ActivateDataType(BOOKMARKS, syncer::GROUP_UI, |
+ &change_processor_mock, |
test_user_share_.user_share()); |
- ExpectRoutingInfo(registrar_.get(), {{BOOKMARKS, GROUP_UI}}); |
+ ExpectRoutingInfo(registrar_.get(), {{BOOKMARKS, syncer::GROUP_UI}}); |
ExpectHasProcessorsForTypes(*registrar_, types); |
TriggerChanges(registrar_.get(), BOOKMARKS); |
@@ -253,7 +268,7 @@ TEST_F(SyncBackendRegistrarTest, ActivateDeactivateNonUIDataType) { |
// Should do nothing. |
TriggerChanges(registrar_.get(), AUTOFILL); |
- StrictMock<ChangeProcessorMock> change_processor_mock; |
+ StrictMock<sync_driver::ChangeProcessorMock> change_processor_mock; |
EXPECT_CALL(change_processor_mock, StartImpl()); |
EXPECT_CALL(change_processor_mock, IsRunning()).WillRepeatedly(Return(true)); |
EXPECT_CALL(change_processor_mock, ApplyChangesFromSyncModel(NULL, _, _)); |
@@ -291,7 +306,7 @@ TEST_F(SyncBackendRegistrarTest, ConfigureNonBlockingDataType) { |
registrar_->AddRestoredNonBlockingType(AUTOFILL); |
// It should be added to routing info and set of configured types. |
EXPECT_EQ(ModelTypeSet(AUTOFILL), registrar_->GetLastConfiguredTypes()); |
- ExpectRoutingInfo(registrar_.get(), {{AUTOFILL, GROUP_NON_BLOCKING}}); |
+ ExpectRoutingInfo(registrar_.get(), {{AUTOFILL, syncer::GROUP_NON_BLOCKING}}); |
// Configure two non-blocking types. Initial sync wasn't done for BOOKMARKS so |
// it should be included in types to be downloaded. |
@@ -300,8 +315,9 @@ TEST_F(SyncBackendRegistrarTest, ConfigureNonBlockingDataType) { |
registrar_->ConfigureDataTypes(types_to_add, ModelTypeSet()); |
EXPECT_EQ(ModelTypeSet(BOOKMARKS), newly_added_types); |
EXPECT_EQ(types_to_add, registrar_->GetLastConfiguredTypes()); |
- ExpectRoutingInfo(registrar_.get(), {{AUTOFILL, GROUP_NON_BLOCKING}, |
- {BOOKMARKS, GROUP_NON_BLOCKING}}); |
+ ExpectRoutingInfo(registrar_.get(), |
+ {{AUTOFILL, syncer::GROUP_NON_BLOCKING}, |
+ {BOOKMARKS, syncer::GROUP_NON_BLOCKING}}); |
} |
class SyncBackendRegistrarShutdownTest : public testing::Test { |
@@ -365,7 +381,7 @@ class SyncBackendRegistrarShutdownTest : public testing::Test { |
class TestRegistrar : public SyncBackendRegistrar { |
public: |
explicit TestRegistrar( |
- SyncClient* sync_client, |
+ sync_driver::SyncClient* sync_client, |
const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread, |
const scoped_refptr<base::SingleThreadTaskRunner>& db_thread, |
const scoped_refptr<base::SingleThreadTaskRunner>& file_thread, |
@@ -430,4 +446,4 @@ TEST_F(SyncBackendRegistrarShutdownTest, BlockingShutdown) { |
} // namespace |
-} // namespace syncer |
+} // namespace browser_sync |