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

Unified Diff: components/sync/driver/generic_change_processor_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
Index: components/sync/driver/generic_change_processor_unittest.cc
diff --git a/components/sync/driver/generic_change_processor_unittest.cc b/components/sync/driver/generic_change_processor_unittest.cc
index 446700cd61c45fcfcbcb7d265b15886d2f513895..953f50727360ad57131770b0d1c75016cab1e35f 100644
--- a/components/sync/driver/generic_change_processor_unittest.cc
+++ b/components/sync/driver/generic_change_processor_unittest.cc
@@ -37,42 +37,45 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace syncer {
+namespace sync_driver {
namespace {
// A mock that keeps track of attachments passed to UploadAttachments.
-class MockAttachmentService : public AttachmentServiceImpl {
+class MockAttachmentService : public syncer::AttachmentServiceImpl {
public:
MockAttachmentService(
- std::unique_ptr<AttachmentStoreForSync> attachment_store);
+ std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store);
~MockAttachmentService() override;
- void UploadAttachments(const AttachmentIdList& attachment_ids) override;
- std::vector<AttachmentIdList>* attachment_id_lists();
+ void UploadAttachments(
+ const syncer::AttachmentIdList& attachment_ids) override;
+ std::vector<syncer::AttachmentIdList>* attachment_id_lists();
private:
- std::vector<AttachmentIdList> attachment_id_lists_;
+ std::vector<syncer::AttachmentIdList> attachment_id_lists_;
};
MockAttachmentService::MockAttachmentService(
- std::unique_ptr<AttachmentStoreForSync> attachment_store)
- : AttachmentServiceImpl(
- std::move(attachment_store),
- std::unique_ptr<AttachmentUploader>(new FakeAttachmentUploader),
- std::unique_ptr<AttachmentDownloader>(new FakeAttachmentDownloader),
- NULL,
- base::TimeDelta(),
- base::TimeDelta()) {}
+ std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store)
+ : AttachmentServiceImpl(std::move(attachment_store),
+ std::unique_ptr<syncer::AttachmentUploader>(
+ new syncer::FakeAttachmentUploader),
+ std::unique_ptr<syncer::AttachmentDownloader>(
+ new syncer::FakeAttachmentDownloader),
+ NULL,
+ base::TimeDelta(),
+ base::TimeDelta()) {}
MockAttachmentService::~MockAttachmentService() {}
void MockAttachmentService::UploadAttachments(
- const AttachmentIdList& attachment_ids) {
+ const syncer::AttachmentIdList& attachment_ids) {
attachment_id_lists_.push_back(attachment_ids);
AttachmentServiceImpl::UploadAttachments(attachment_ids);
}
-std::vector<AttachmentIdList>* MockAttachmentService::attachment_id_lists() {
+std::vector<syncer::AttachmentIdList>*
+MockAttachmentService::attachment_id_lists() {
return &attachment_id_lists_;
}
@@ -84,39 +87,40 @@ class MockSyncApiComponentFactory : public SyncApiComponentFactory {
// SyncApiComponentFactory implementation.
void RegisterDataTypes(
- SyncService* sync_service,
+ sync_driver::SyncService* sync_service,
const RegisterDataTypesMethod& register_platform_types_method) override {}
- DataTypeManager* CreateDataTypeManager(
- const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener,
- const DataTypeController::TypeMap* controllers,
- const DataTypeEncryptionHandler* encryption_handler,
- SyncBackendHost* backend,
- DataTypeManagerObserver* observer) override {
+ sync_driver::DataTypeManager* CreateDataTypeManager(
+ const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
+ debug_info_listener,
+ const sync_driver::DataTypeController::TypeMap* controllers,
+ const sync_driver::DataTypeEncryptionHandler* encryption_handler,
+ browser_sync::SyncBackendHost* backend,
+ sync_driver::DataTypeManagerObserver* observer) override {
return nullptr;
};
- SyncBackendHost* CreateSyncBackendHost(
+ browser_sync::SyncBackendHost* CreateSyncBackendHost(
const std::string& name,
invalidation::InvalidationService* invalidator,
- const base::WeakPtr<SyncPrefs>& sync_prefs,
+ const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs,
const base::FilePath& sync_folder) override {
return nullptr;
}
- std::unique_ptr<LocalDeviceInfoProvider> CreateLocalDeviceInfoProvider()
- override {
+ std::unique_ptr<sync_driver::LocalDeviceInfoProvider>
+ CreateLocalDeviceInfoProvider() override {
return nullptr;
}
SyncComponents CreateBookmarkSyncComponents(
- SyncService* sync_service,
- std::unique_ptr<DataTypeErrorHandler> error_handler) override {
+ sync_driver::SyncService* sync_service,
+ std::unique_ptr<syncer::DataTypeErrorHandler> error_handler) override {
return SyncComponents(nullptr, nullptr);
}
- std::unique_ptr<AttachmentService> CreateAttachmentService(
- std::unique_ptr<AttachmentStoreForSync> attachment_store,
- const UserShare& user_share,
+ std::unique_ptr<syncer::AttachmentService> CreateAttachmentService(
+ std::unique_ptr<syncer::AttachmentStoreForSync> attachment_store,
+ const syncer::UserShare& user_share,
const std::string& store_birthday,
- ModelType model_type,
- AttachmentService::Delegate* delegate) override {
+ syncer::ModelType model_type,
+ syncer::AttachmentService::Delegate* delegate) override {
std::unique_ptr<MockAttachmentService> attachment_service(
new MockAttachmentService(std::move(attachment_store)));
// GenericChangeProcessor takes ownership of the AttachmentService, but we
@@ -139,7 +143,7 @@ class SyncGenericChangeProcessorTest : public testing::Test {
public:
// Most test cases will use this type. For those that need a
// GenericChangeProcessor for a different type, use |InitializeForType|.
- static const ModelType kType = PREFERENCES;
+ static const syncer::ModelType kType = syncer::PREFERENCES;
SyncGenericChangeProcessorTest()
: syncable_service_ptr_factory_(&fake_syncable_service_),
@@ -162,44 +166,47 @@ class SyncGenericChangeProcessorTest : public testing::Test {
// Initialize GenericChangeProcessor and related classes for testing with
// model type |type|.
- void InitializeForType(ModelType type) {
+ void InitializeForType(syncer::ModelType type) {
TearDown();
- test_user_share_.reset(new TestUserShare);
+ test_user_share_.reset(new syncer::TestUserShare);
test_user_share_->SetUp();
- sync_merge_result_.reset(new SyncMergeResult(type));
+ sync_merge_result_.reset(new syncer::SyncMergeResult(type));
merge_result_ptr_factory_.reset(
- new base::WeakPtrFactory<SyncMergeResult>(sync_merge_result_.get()));
-
- ModelTypeSet types = ProtocolTypes();
- for (ModelTypeSet::Iterator iter = types.First(); iter.Good(); iter.Inc()) {
- TestUserShare::CreateRoot(iter.Get(), test_user_share_->user_share());
+ new base::WeakPtrFactory<syncer::SyncMergeResult>(
+ sync_merge_result_.get()));
+
+ syncer::ModelTypeSet types = syncer::ProtocolTypes();
+ for (syncer::ModelTypeSet::Iterator iter = types.First(); iter.Good();
+ iter.Inc()) {
+ syncer::TestUserShare::CreateRoot(iter.Get(),
+ test_user_share_->user_share());
}
test_user_share_->encryption_handler()->Init();
ConstructGenericChangeProcessor(type);
}
- void ConstructGenericChangeProcessor(ModelType type) {
- std::unique_ptr<AttachmentStore> attachment_store =
- AttachmentStore::CreateInMemoryStore();
+ void ConstructGenericChangeProcessor(syncer::ModelType type) {
+ std::unique_ptr<syncer::AttachmentStore> attachment_store =
+ syncer::AttachmentStore::CreateInMemoryStore();
change_processor_.reset(new GenericChangeProcessor(
- type, base::MakeUnique<DataTypeErrorHandlerMock>(),
+ type, base::MakeUnique<syncer::DataTypeErrorHandlerMock>(),
syncable_service_ptr_factory_.GetWeakPtr(),
merge_result_ptr_factory_->GetWeakPtr(), test_user_share_->user_share(),
&sync_client_, attachment_store->CreateAttachmentStoreForSync()));
mock_attachment_service_ = sync_factory_.GetMockAttachmentService();
}
- void BuildChildNodes(ModelType type, int n) {
- WriteTransaction trans(FROM_HERE, user_share());
+ void BuildChildNodes(syncer::ModelType type, int n) {
+ syncer::WriteTransaction trans(FROM_HERE, user_share());
for (int i = 0; i < n; ++i) {
- WriteNode node(&trans);
+ syncer::WriteNode node(&trans);
node.InitUniqueByCreation(type, base::StringPrintf("node%05d", i));
}
}
GenericChangeProcessor* change_processor() { return change_processor_.get(); }
- UserShare* user_share() { return test_user_share_->user_share(); }
+ syncer::UserShare* user_share() { return test_user_share_->user_share(); }
MockAttachmentService* mock_attachment_service() {
return mock_attachment_service_;
@@ -213,14 +220,15 @@ class SyncGenericChangeProcessorTest : public testing::Test {
private:
base::MessageLoopForUI loop_;
- std::unique_ptr<SyncMergeResult> sync_merge_result_;
- std::unique_ptr<base::WeakPtrFactory<SyncMergeResult>>
+ std::unique_ptr<syncer::SyncMergeResult> sync_merge_result_;
+ std::unique_ptr<base::WeakPtrFactory<syncer::SyncMergeResult>>
merge_result_ptr_factory_;
- FakeSyncableService fake_syncable_service_;
- base::WeakPtrFactory<FakeSyncableService> syncable_service_ptr_factory_;
+ syncer::FakeSyncableService fake_syncable_service_;
+ base::WeakPtrFactory<syncer::FakeSyncableService>
+ syncable_service_ptr_factory_;
- std::unique_ptr<TestUserShare> test_user_share_;
+ std::unique_ptr<syncer::TestUserShare> test_user_share_;
MockAttachmentService* mock_attachment_service_;
FakeSyncClient sync_client_;
MockSyncApiComponentFactory sync_factory_;
@@ -237,7 +245,7 @@ TEST_F(SyncGenericChangeProcessorTest, StressGetAllSyncData) {
ASSERT_NO_FATAL_FAILURE(BuildChildNodes(kType, kNumChildNodes));
for (int i = 0; i < kRepeatCount; ++i) {
- SyncDataList sync_data = change_processor()->GetAllSyncData(kType);
+ syncer::SyncDataList sync_data = change_processor()->GetAllSyncData(kType);
// Start with a simple test. We can add more in-depth testing later.
EXPECT_EQ(static_cast<size_t>(kNumChildNodes), sync_data.size());
@@ -245,30 +253,31 @@ TEST_F(SyncGenericChangeProcessorTest, StressGetAllSyncData) {
}
TEST_F(SyncGenericChangeProcessorTest, SetGetPasswords) {
- InitializeForType(PASSWORDS);
+ InitializeForType(syncer::PASSWORDS);
const int kNumPasswords = 10;
sync_pb::PasswordSpecificsData password_data;
password_data.set_username_value("user");
sync_pb::EntitySpecifics password_holder;
- SyncChangeList change_list;
+ syncer::SyncChangeList change_list;
for (int i = 0; i < kNumPasswords; ++i) {
password_data.set_password_value(base::StringPrintf("password%i", i));
password_holder.mutable_password()
->mutable_client_only_encrypted_data()
->CopyFrom(password_data);
- change_list.push_back(
- SyncChange(FROM_HERE, SyncChange::ACTION_ADD,
- SyncData::CreateLocalData(base::StringPrintf("tag%i", i),
- base::StringPrintf("title%i", i),
- password_holder)));
+ change_list.push_back(syncer::SyncChange(
+ FROM_HERE, syncer::SyncChange::ACTION_ADD,
+ syncer::SyncData::CreateLocalData(base::StringPrintf("tag%i", i),
+ base::StringPrintf("title%i", i),
+ password_holder)));
}
ASSERT_FALSE(
change_processor()->ProcessSyncChanges(FROM_HERE, change_list).IsSet());
- SyncDataList password_list(change_processor()->GetAllSyncData(PASSWORDS));
+ syncer::SyncDataList password_list(
+ change_processor()->GetAllSyncData(syncer::PASSWORDS));
ASSERT_EQ(password_list.size(), change_list.size());
for (int i = 0; i < kNumPasswords; ++i) {
@@ -291,11 +300,11 @@ TEST_F(SyncGenericChangeProcessorTest, SetGetPasswords) {
ASSERT_EQ(sync_password.username_value(), change_password.username_value());
// Verify the raw sync data was stored securely.
- ReadTransaction read_transaction(FROM_HERE, user_share());
- ReadNode node(&read_transaction);
- ASSERT_EQ(
- node.InitByClientTagLookup(PASSWORDS, base::StringPrintf("tag%i", i)),
- BaseNode::INIT_OK);
+ syncer::ReadTransaction read_transaction(FROM_HERE, user_share());
+ syncer::ReadNode node(&read_transaction);
+ ASSERT_EQ(node.InitByClientTagLookup(syncer::PASSWORDS,
+ base::StringPrintf("tag%i", i)),
+ syncer::BaseNode::INIT_OK);
ASSERT_EQ(node.GetTitle(), "encrypted");
const sync_pb::EntitySpecifics& raw_specifics = node.GetEntitySpecifics();
ASSERT_TRUE(raw_specifics.has_password());
@@ -305,34 +314,34 @@ TEST_F(SyncGenericChangeProcessorTest, SetGetPasswords) {
}
TEST_F(SyncGenericChangeProcessorTest, UpdatePasswords) {
- InitializeForType(PASSWORDS);
+ InitializeForType(syncer::PASSWORDS);
const int kNumPasswords = 10;
sync_pb::PasswordSpecificsData password_data;
password_data.set_username_value("user");
sync_pb::EntitySpecifics password_holder;
- SyncChangeList change_list;
- SyncChangeList change_list2;
+ syncer::SyncChangeList change_list;
+ syncer::SyncChangeList change_list2;
for (int i = 0; i < kNumPasswords; ++i) {
password_data.set_password_value(base::StringPrintf("password%i", i));
password_holder.mutable_password()
->mutable_client_only_encrypted_data()
->CopyFrom(password_data);
- change_list.push_back(
- SyncChange(FROM_HERE, SyncChange::ACTION_ADD,
- SyncData::CreateLocalData(base::StringPrintf("tag%i", i),
- base::StringPrintf("title%i", i),
- password_holder)));
+ change_list.push_back(syncer::SyncChange(
+ FROM_HERE, syncer::SyncChange::ACTION_ADD,
+ syncer::SyncData::CreateLocalData(base::StringPrintf("tag%i", i),
+ base::StringPrintf("title%i", i),
+ password_holder)));
password_data.set_password_value(base::StringPrintf("password_m%i", i));
password_holder.mutable_password()
->mutable_client_only_encrypted_data()
->CopyFrom(password_data);
- change_list2.push_back(
- SyncChange(FROM_HERE, SyncChange::ACTION_UPDATE,
- SyncData::CreateLocalData(base::StringPrintf("tag%i", i),
- base::StringPrintf("title_m%i", i),
- password_holder)));
+ change_list2.push_back(syncer::SyncChange(
+ FROM_HERE, syncer::SyncChange::ACTION_UPDATE,
+ syncer::SyncData::CreateLocalData(base::StringPrintf("tag%i", i),
+ base::StringPrintf("title_m%i", i),
+ password_holder)));
}
ASSERT_FALSE(
@@ -340,7 +349,8 @@ TEST_F(SyncGenericChangeProcessorTest, UpdatePasswords) {
ASSERT_FALSE(
change_processor()->ProcessSyncChanges(FROM_HERE, change_list2).IsSet());
- SyncDataList password_list(change_processor()->GetAllSyncData(PASSWORDS));
+ syncer::SyncDataList password_list(
+ change_processor()->GetAllSyncData(syncer::PASSWORDS));
ASSERT_EQ(password_list.size(), change_list2.size());
for (int i = 0; i < kNumPasswords; ++i) {
@@ -363,11 +373,11 @@ TEST_F(SyncGenericChangeProcessorTest, UpdatePasswords) {
ASSERT_EQ(sync_password.username_value(), change_password.username_value());
// Verify the raw sync data was stored securely.
- ReadTransaction read_transaction(FROM_HERE, user_share());
- ReadNode node(&read_transaction);
- ASSERT_EQ(
- node.InitByClientTagLookup(PASSWORDS, base::StringPrintf("tag%i", i)),
- BaseNode::INIT_OK);
+ syncer::ReadTransaction read_transaction(FROM_HERE, user_share());
+ syncer::ReadNode node(&read_transaction);
+ ASSERT_EQ(node.InitByClientTagLookup(syncer::PASSWORDS,
+ base::StringPrintf("tag%i", i)),
+ syncer::BaseNode::INIT_OK);
ASSERT_EQ(node.GetTitle(), "encrypted");
const sync_pb::EntitySpecifics& raw_specifics = node.GetEntitySpecifics();
ASSERT_TRUE(raw_specifics.has_password());
@@ -386,42 +396,43 @@ TEST_F(SyncGenericChangeProcessorTest,
sync_pb::PreferenceSpecifics* pref_specifics = specifics.mutable_preference();
pref_specifics->set_name("test");
- AttachmentIdList attachment_ids;
- attachment_ids.push_back(AttachmentId::Create(0, 0));
- attachment_ids.push_back(AttachmentId::Create(0, 0));
+ syncer::AttachmentIdList attachment_ids;
+ attachment_ids.push_back(syncer::AttachmentId::Create(0, 0));
+ attachment_ids.push_back(syncer::AttachmentId::Create(0, 0));
// Add a SyncData with two attachments.
- SyncChangeList change_list;
- change_list.push_back(SyncChange(FROM_HERE, SyncChange::ACTION_ADD,
- SyncData::CreateLocalDataWithAttachments(
- tag, title, specifics, attachment_ids)));
+ syncer::SyncChangeList change_list;
+ change_list.push_back(
+ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD,
+ syncer::SyncData::CreateLocalDataWithAttachments(
+ tag, title, specifics, attachment_ids)));
ASSERT_FALSE(
change_processor()->ProcessSyncChanges(FROM_HERE, change_list).IsSet());
RunLoop();
// Check that the AttachmentService received the new attachments.
ASSERT_EQ(mock_attachment_service()->attachment_id_lists()->size(), 1U);
- const AttachmentIdList& attachments_added =
+ const syncer::AttachmentIdList& attachments_added =
mock_attachment_service()->attachment_id_lists()->front();
ASSERT_THAT(attachments_added, testing::UnorderedElementsAre(
attachment_ids[0], attachment_ids[1]));
// Update the SyncData, replacing its two attachments with one new attachment.
- AttachmentIdList new_attachment_ids;
- new_attachment_ids.push_back(AttachmentId::Create(0, 0));
+ syncer::AttachmentIdList new_attachment_ids;
+ new_attachment_ids.push_back(syncer::AttachmentId::Create(0, 0));
mock_attachment_service()->attachment_id_lists()->clear();
change_list.clear();
change_list.push_back(
- SyncChange(FROM_HERE, SyncChange::ACTION_UPDATE,
- SyncData::CreateLocalDataWithAttachments(tag, title, specifics,
- new_attachment_ids)));
+ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_UPDATE,
+ syncer::SyncData::CreateLocalDataWithAttachments(
+ tag, title, specifics, new_attachment_ids)));
ASSERT_FALSE(
change_processor()->ProcessSyncChanges(FROM_HERE, change_list).IsSet());
RunLoop();
// Check that the AttachmentService received it.
ASSERT_EQ(mock_attachment_service()->attachment_id_lists()->size(), 1U);
- const AttachmentIdList& new_attachments_added =
+ const syncer::AttachmentIdList& new_attachments_added =
mock_attachment_service()->attachment_id_lists()->front();
ASSERT_THAT(new_attachments_added,
testing::UnorderedElementsAre(new_attachment_ids[0]));
@@ -436,25 +447,26 @@ TEST_F(SyncGenericChangeProcessorTest, AttachmentUploaded) {
sync_pb::PreferenceSpecifics* pref_specifics = specifics.mutable_preference();
pref_specifics->set_name("test");
- AttachmentIdList attachment_ids;
- attachment_ids.push_back(AttachmentId::Create(0, 0));
+ syncer::AttachmentIdList attachment_ids;
+ attachment_ids.push_back(syncer::AttachmentId::Create(0, 0));
// Add a SyncData with two attachments.
- SyncChangeList change_list;
- change_list.push_back(SyncChange(FROM_HERE, SyncChange::ACTION_ADD,
- SyncData::CreateLocalDataWithAttachments(
- tag, title, specifics, attachment_ids)));
+ syncer::SyncChangeList change_list;
+ change_list.push_back(
+ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD,
+ syncer::SyncData::CreateLocalDataWithAttachments(
+ tag, title, specifics, attachment_ids)));
ASSERT_FALSE(
change_processor()->ProcessSyncChanges(FROM_HERE, change_list).IsSet());
sync_pb::AttachmentIdProto attachment_id_proto = attachment_ids[0].GetProto();
- AttachmentId attachment_id =
- AttachmentId::CreateFromProto(attachment_id_proto);
+ syncer::AttachmentId attachment_id =
+ syncer::AttachmentId::CreateFromProto(attachment_id_proto);
change_processor()->OnAttachmentUploaded(attachment_id);
- ReadTransaction read_transaction(FROM_HERE, user_share());
- ReadNode node(&read_transaction);
- ASSERT_EQ(node.InitByClientTagLookup(kType, tag), BaseNode::INIT_OK);
+ syncer::ReadTransaction read_transaction(FROM_HERE, user_share());
+ syncer::ReadNode node(&read_transaction);
+ ASSERT_EQ(node.InitByClientTagLookup(kType, tag), syncer::BaseNode::INIT_OK);
attachment_ids = node.GetAttachmentIds();
EXPECT_EQ(1U, attachment_ids.size());
}
@@ -463,14 +475,14 @@ TEST_F(SyncGenericChangeProcessorTest, AttachmentUploaded) {
// scheduled for upload.
TEST_F(SyncGenericChangeProcessorTest, UploadAllAttachmentsNotOnServer) {
// Create two attachment ids. id2 will be marked as "on server".
- AttachmentId id1 = AttachmentId::Create(0, 0);
- AttachmentId id2 = AttachmentId::Create(0, 0);
+ syncer::AttachmentId id1 = syncer::AttachmentId::Create(0, 0);
+ syncer::AttachmentId id2 = syncer::AttachmentId::Create(0, 0);
{
// Write an entry containing these two attachment ids.
- WriteTransaction trans(FROM_HERE, user_share());
- ReadNode root(&trans);
- ASSERT_EQ(BaseNode::INIT_OK, root.InitTypeRoot(kType));
- WriteNode node(&trans);
+ syncer::WriteTransaction trans(FROM_HERE, user_share());
+ syncer::ReadNode root(&trans);
+ ASSERT_EQ(syncer::BaseNode::INIT_OK, root.InitTypeRoot(kType));
+ syncer::WriteNode node(&trans);
node.InitUniqueByCreation(kType, root, "some node");
sync_pb::AttachmentMetadata metadata;
sync_pb::AttachmentMetadataRecord* record1 = metadata.add_record();
@@ -491,38 +503,40 @@ TEST_F(SyncGenericChangeProcessorTest, UploadAllAttachmentsNotOnServer) {
// Test that attempting to add an entry that already exists still works.
TEST_F(SyncGenericChangeProcessorTest, AddExistingEntry) {
- InitializeForType(SESSIONS);
+ InitializeForType(syncer::SESSIONS);
sync_pb::EntitySpecifics sessions_specifics;
sessions_specifics.mutable_session()->set_session_tag("session tag");
- SyncChangeList changes;
+ syncer::SyncChangeList changes;
// First add it normally.
- changes.push_back(
- SyncChange(FROM_HERE, SyncChange::ACTION_ADD,
- SyncData::CreateLocalData(base::StringPrintf("tag"),
- base::StringPrintf("title"),
- sessions_specifics)));
+ changes.push_back(syncer::SyncChange(
+ FROM_HERE, syncer::SyncChange::ACTION_ADD,
+ syncer::SyncData::CreateLocalData(base::StringPrintf("tag"),
+ base::StringPrintf("title"),
+ sessions_specifics)));
ASSERT_FALSE(
change_processor()->ProcessSyncChanges(FROM_HERE, changes).IsSet());
// Now attempt to add it again, but with different specifics. Should not
// result in an error and should still update the specifics.
sessions_specifics.mutable_session()->set_session_tag("session tag 2");
- changes[0] = SyncChange(FROM_HERE, SyncChange::ACTION_ADD,
- SyncData::CreateLocalData(base::StringPrintf("tag"),
- base::StringPrintf("title"),
- sessions_specifics));
+ changes[0] =
+ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD,
+ syncer::SyncData::CreateLocalData(
+ base::StringPrintf("tag"),
+ base::StringPrintf("title"), sessions_specifics));
ASSERT_FALSE(
change_processor()->ProcessSyncChanges(FROM_HERE, changes).IsSet());
// Verify the data was updated properly.
- SyncDataList sync_data = change_processor()->GetAllSyncData(SESSIONS);
+ syncer::SyncDataList sync_data =
+ change_processor()->GetAllSyncData(syncer::SESSIONS);
ASSERT_EQ(sync_data.size(), 1U);
ASSERT_EQ("session tag 2",
sync_data[0].GetSpecifics().session().session_tag());
- EXPECT_FALSE(SyncDataRemote(sync_data[0]).GetClientTagHash().empty());
+ EXPECT_FALSE(syncer::SyncDataRemote(sync_data[0]).GetClientTagHash().empty());
}
} // namespace
-} // namespace syncer
+} // namespace sync_driver
« no previous file with comments | « components/sync/driver/generic_change_processor_factory.cc ('k') | components/sync/driver/glue/browser_thread_model_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698