| Index: sync/internal_api/attachments/attachment_service_impl_unittest.cc
|
| diff --git a/sync/internal_api/attachments/attachment_service_impl_unittest.cc b/sync/internal_api/attachments/attachment_service_impl_unittest.cc
|
| index db8369989c4cecb00f301620959256c870877e93..8519244324cb745636d725800010f8feacd256e5 100644
|
| --- a/sync/internal_api/attachments/attachment_service_impl_unittest.cc
|
| +++ b/sync/internal_api/attachments/attachment_service_impl_unittest.cc
|
| @@ -79,7 +79,9 @@
|
| for (AttachmentIdList::const_iterator iter = ids.begin(); iter != ids.end();
|
| ++iter) {
|
| if (local_attachments.find(*iter) != local_attachments.end()) {
|
| - Attachment attachment = Attachment::CreateFromParts(*iter, data);
|
| + uint32_t crc32c = ComputeCrc32c(data);
|
| + Attachment attachment =
|
| + Attachment::CreateFromParts(*iter, data, crc32c);
|
| attachments->insert(std::make_pair(*iter, attachment));
|
| } else {
|
| unavailable_attachments->push_back(*iter);
|
| @@ -135,7 +137,9 @@
|
| scoped_ptr<Attachment> attachment;
|
| if (result == DOWNLOAD_SUCCESS) {
|
| scoped_refptr<base::RefCountedString> data = new base::RefCountedString();
|
| - attachment.reset(new Attachment(Attachment::CreateFromParts(id, data)));
|
| + uint32_t crc32c = ComputeCrc32c(data);
|
| + attachment.reset(
|
| + new Attachment(Attachment::CreateFromParts(id, data, crc32c)));
|
| }
|
| base::MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| @@ -317,7 +321,7 @@
|
|
|
| TEST_F(AttachmentServiceImplTest, GetOrDownload_Local) {
|
| AttachmentIdList attachment_ids;
|
| - attachment_ids.push_back(AttachmentId::Create(0, 0));
|
| + attachment_ids.push_back(AttachmentId::Create());
|
| attachment_service()->GetOrDownloadAttachments(attachment_ids,
|
| download_callback());
|
| AttachmentIdSet local_attachments;
|
| @@ -335,10 +339,10 @@
|
| TEST_F(AttachmentServiceImplTest, GetOrDownload_LocalRemoteUnavailable) {
|
| // Create attachment list with 4 ids.
|
| AttachmentIdList attachment_ids;
|
| - attachment_ids.push_back(AttachmentId::Create(0, 0));
|
| - attachment_ids.push_back(AttachmentId::Create(0, 0));
|
| - attachment_ids.push_back(AttachmentId::Create(0, 0));
|
| - attachment_ids.push_back(AttachmentId::Create(0, 0));
|
| + attachment_ids.push_back(AttachmentId::Create());
|
| + attachment_ids.push_back(AttachmentId::Create());
|
| + attachment_ids.push_back(AttachmentId::Create());
|
| + attachment_ids.push_back(AttachmentId::Create());
|
| // Call attachment service.
|
| attachment_service()->GetOrDownloadAttachments(attachment_ids,
|
| download_callback());
|
| @@ -405,7 +409,7 @@
|
| this);
|
|
|
| AttachmentIdList attachment_ids;
|
| - attachment_ids.push_back(AttachmentId::Create(0, 0));
|
| + attachment_ids.push_back(AttachmentId::Create());
|
| attachment_service()->GetOrDownloadAttachments(attachment_ids,
|
| download_callback());
|
| RunLoop();
|
| @@ -423,7 +427,7 @@
|
| AttachmentIdSet attachment_ids;
|
| const unsigned num_attachments = 3;
|
| for (unsigned i = 0; i < num_attachments; ++i) {
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| + attachment_ids.insert(AttachmentId::Create());
|
| }
|
| attachment_service()->UploadAttachments(attachment_ids);
|
|
|
| @@ -457,7 +461,7 @@
|
| NULL); // No delegate.
|
|
|
| AttachmentIdSet attachment_ids;
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| + attachment_ids.insert(AttachmentId::Create());
|
| attachment_service()->UploadAttachments(attachment_ids);
|
| RunLoopAndFireTimer();
|
| ASSERT_EQ(1U, store()->read_ids.size());
|
| @@ -474,8 +478,8 @@
|
|
|
| TEST_F(AttachmentServiceImplTest, UploadAttachments_SomeMissingFromStore) {
|
| AttachmentIdSet attachment_ids;
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| + attachment_ids.insert(AttachmentId::Create());
|
| + attachment_ids.insert(AttachmentId::Create());
|
| attachment_service()->UploadAttachments(attachment_ids);
|
| RunLoopAndFireTimer();
|
| ASSERT_GE(store()->read_ids.size(), 1U);
|
| @@ -501,7 +505,7 @@
|
| AttachmentIdSet attachment_ids;
|
| const unsigned num_attachments = 2;
|
| for (unsigned i = 0; i < num_attachments; ++i) {
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| + attachment_ids.insert(AttachmentId::Create());
|
| }
|
| attachment_service()->UploadAttachments(attachment_ids);
|
|
|
| @@ -525,7 +529,7 @@
|
| this);
|
|
|
| AttachmentIdSet attachment_ids;
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| + attachment_ids.insert(AttachmentId::Create());
|
| attachment_service()->UploadAttachments(attachment_ids);
|
| RunLoop();
|
| EXPECT_EQ(0U, store()->read_ids.size());
|
| @@ -537,7 +541,7 @@
|
| AttachmentIdSet attachment_ids;
|
| const unsigned num_attachments = 3;
|
| for (unsigned i = 0; i < num_attachments; ++i) {
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| + attachment_ids.insert(AttachmentId::Create());
|
| }
|
| attachment_service()->UploadAttachments(attachment_ids);
|
|
|
| @@ -567,7 +571,7 @@
|
| TEST_F(AttachmentServiceImplTest,
|
| UploadAttachments_ResetBackoffAfterNetworkChange) {
|
| AttachmentIdSet attachment_ids;
|
| - attachment_ids.insert(AttachmentId::Create(0, 0));
|
| + attachment_ids.insert(AttachmentId::Create());
|
| attachment_service()->UploadAttachments(attachment_ids);
|
|
|
| RunLoopAndFireTimer();
|
|
|