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 |
similarity index 86% |
rename from components/sync_driver/generic_change_processor_unittest.cc |
rename to components/sync/driver/generic_change_processor_unittest.cc |
index dfaf95a355dc9ce7f569a3fa419eaede852218ec..cd6e9a4d02e26d1cc9e96a332593740aeec657ae 100644 |
--- a/components/sync_driver/generic_change_processor_unittest.cc |
+++ b/components/sync/driver/generic_change_processor_unittest.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "components/sync_driver/generic_change_processor.h" |
+#include "components/sync/driver/generic_change_processor.h" |
#include <stddef.h> |
@@ -31,9 +31,9 @@ |
#include "components/sync/core/user_share.h" |
#include "components/sync/core/write_node.h" |
#include "components/sync/core/write_transaction.h" |
-#include "components/sync_driver/fake_sync_client.h" |
-#include "components/sync_driver/local_device_info_provider.h" |
-#include "components/sync_driver/sync_api_component_factory.h" |
+#include "components/sync/driver/fake_sync_client.h" |
+#include "components/sync/driver/local_device_info_provider.h" |
+#include "components/sync/driver/sync_api_component_factory.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -66,8 +66,7 @@ MockAttachmentService::MockAttachmentService( |
base::TimeDelta(), |
base::TimeDelta()) {} |
-MockAttachmentService::~MockAttachmentService() { |
-} |
+MockAttachmentService::~MockAttachmentService() {} |
void MockAttachmentService::UploadAttachments( |
const syncer::AttachmentIdList& attachment_ids) { |
@@ -96,7 +95,7 @@ class MockSyncApiComponentFactory : public SyncApiComponentFactory { |
const sync_driver::DataTypeController::TypeMap* controllers, |
const sync_driver::DataTypeEncryptionHandler* encryption_handler, |
browser_sync::SyncBackendHost* backend, |
- sync_driver::DataTypeManagerObserver* observer) override{ |
+ sync_driver::DataTypeManagerObserver* observer) override { |
return nullptr; |
}; |
browser_sync::SyncBackendHost* CreateSyncBackendHost( |
@@ -205,13 +204,9 @@ class SyncGenericChangeProcessorTest : public testing::Test { |
} |
} |
- GenericChangeProcessor* change_processor() { |
- return change_processor_.get(); |
- } |
+ GenericChangeProcessor* change_processor() { return change_processor_.get(); } |
- syncer::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_; |
@@ -251,8 +246,7 @@ TEST_F(SyncGenericChangeProcessorTest, StressGetAllSyncData) { |
ASSERT_NO_FATAL_FAILURE(BuildChildNodes(kType, kNumChildNodes)); |
for (int i = 0; i < kRepeatCount; ++i) { |
- syncer::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()); |
@@ -269,17 +263,15 @@ TEST_F(SyncGenericChangeProcessorTest, SetGetPasswords) { |
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( |
- 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%i", i)); |
+ password_holder.mutable_password() |
+ ->mutable_client_only_encrypted_data() |
+ ->CopyFrom(password_data); |
+ 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( |
@@ -292,14 +284,19 @@ TEST_F(SyncGenericChangeProcessorTest, SetGetPasswords) { |
for (int i = 0; i < kNumPasswords; ++i) { |
// Verify the password is returned properly. |
ASSERT_TRUE(password_list[i].GetSpecifics().has_password()); |
- ASSERT_TRUE(password_list[i].GetSpecifics().password(). |
- has_client_only_encrypted_data()); |
+ ASSERT_TRUE(password_list[i] |
+ .GetSpecifics() |
+ .password() |
+ .has_client_only_encrypted_data()); |
ASSERT_FALSE(password_list[i].GetSpecifics().password().has_encrypted()); |
const sync_pb::PasswordSpecificsData& sync_password = |
password_list[i].GetSpecifics().password().client_only_encrypted_data(); |
const sync_pb::PasswordSpecificsData& change_password = |
- change_list[i].sync_data().GetSpecifics().password(). |
- client_only_encrypted_data(); |
+ change_list[i] |
+ .sync_data() |
+ .GetSpecifics() |
+ .password() |
+ .client_only_encrypted_data(); |
ASSERT_EQ(sync_password.password_value(), change_password.password_value()); |
ASSERT_EQ(sync_password.username_value(), change_password.username_value()); |
@@ -328,28 +325,24 @@ TEST_F(SyncGenericChangeProcessorTest, UpdatePasswords) { |
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( |
- 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( |
- syncer::SyncChange(FROM_HERE, |
- syncer::SyncChange::ACTION_UPDATE, |
- syncer::SyncData::CreateLocalData( |
- base::StringPrintf("tag%i", i), |
- base::StringPrintf("title_m%i", i), |
- password_holder))); |
+ 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(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(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( |
@@ -364,14 +357,19 @@ TEST_F(SyncGenericChangeProcessorTest, UpdatePasswords) { |
for (int i = 0; i < kNumPasswords; ++i) { |
// Verify the password is returned properly. |
ASSERT_TRUE(password_list[i].GetSpecifics().has_password()); |
- ASSERT_TRUE(password_list[i].GetSpecifics().password(). |
- has_client_only_encrypted_data()); |
+ ASSERT_TRUE(password_list[i] |
+ .GetSpecifics() |
+ .password() |
+ .has_client_only_encrypted_data()); |
ASSERT_FALSE(password_list[i].GetSpecifics().password().has_encrypted()); |
const sync_pb::PasswordSpecificsData& sync_password = |
password_list[i].GetSpecifics().password().client_only_encrypted_data(); |
const sync_pb::PasswordSpecificsData& change_password = |
- change_list2[i].sync_data().GetSpecifics().password(). |
- client_only_encrypted_data(); |
+ change_list2[i] |
+ .sync_data() |
+ .GetSpecifics() |
+ .password() |
+ .client_only_encrypted_data(); |
ASSERT_EQ(sync_password.password_value(), change_password.password_value()); |
ASSERT_EQ(sync_password.username_value(), change_password.username_value()); |
@@ -406,8 +404,7 @@ TEST_F(SyncGenericChangeProcessorTest, |
// Add a SyncData with two attachments. |
syncer::SyncChangeList change_list; |
change_list.push_back( |
- syncer::SyncChange(FROM_HERE, |
- syncer::SyncChange::ACTION_ADD, |
+ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD, |
syncer::SyncData::CreateLocalDataWithAttachments( |
tag, title, specifics, attachment_ids))); |
ASSERT_FALSE( |
@@ -418,9 +415,8 @@ TEST_F(SyncGenericChangeProcessorTest, |
ASSERT_EQ(mock_attachment_service()->attachment_id_lists()->size(), 1U); |
const syncer::AttachmentIdList& attachments_added = |
mock_attachment_service()->attachment_id_lists()->front(); |
- ASSERT_THAT( |
- attachments_added, |
- testing::UnorderedElementsAre(attachment_ids[0], attachment_ids[1])); |
+ ASSERT_THAT(attachments_added, testing::UnorderedElementsAre( |
+ attachment_ids[0], attachment_ids[1])); |
// Update the SyncData, replacing its two attachments with one new attachment. |
syncer::AttachmentIdList new_attachment_ids; |
@@ -428,8 +424,7 @@ TEST_F(SyncGenericChangeProcessorTest, |
mock_attachment_service()->attachment_id_lists()->clear(); |
change_list.clear(); |
change_list.push_back( |
- syncer::SyncChange(FROM_HERE, |
- syncer::SyncChange::ACTION_UPDATE, |
+ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_UPDATE, |
syncer::SyncData::CreateLocalDataWithAttachments( |
tag, title, specifics, new_attachment_ids))); |
ASSERT_FALSE( |
@@ -459,8 +454,7 @@ TEST_F(SyncGenericChangeProcessorTest, AttachmentUploaded) { |
// Add a SyncData with two attachments. |
syncer::SyncChangeList change_list; |
change_list.push_back( |
- syncer::SyncChange(FROM_HERE, |
- syncer::SyncChange::ACTION_ADD, |
+ syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD, |
syncer::SyncData::CreateLocalDataWithAttachments( |
tag, title, specifics, attachment_ids))); |
ASSERT_FALSE( |