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

Unified Diff: sync/internal_api/attachments/attachment_service_impl_unittest.cc

Issue 982883002: [Sync] Add size and crc32c to AttachmentId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix argument evaluation order bug. Created 5 years, 10 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: 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 e72bb8fe578f469740f4744f0839c4cec1b28a48..c90bcd9b0fbda063c1a19e8acbebcceada2e092c 100644
--- a/sync/internal_api/attachments/attachment_service_impl_unittest.cc
+++ b/sync/internal_api/attachments/attachment_service_impl_unittest.cc
@@ -68,9 +68,7 @@ class MockAttachmentStore : public AttachmentStore,
for (AttachmentIdList::const_iterator iter = ids.begin(); iter != ids.end();
++iter) {
if (local_attachments.find(*iter) != local_attachments.end()) {
- uint32_t crc32c = ComputeCrc32c(data);
- Attachment attachment =
- Attachment::CreateFromParts(*iter, data, crc32c);
+ Attachment attachment = Attachment::CreateFromParts(*iter, data);
attachments->insert(std::make_pair(*iter, attachment));
} else {
unavailable_attachments->push_back(*iter);
@@ -127,9 +125,7 @@ class MockAttachmentDownloader
scoped_ptr<Attachment> attachment;
if (result == DOWNLOAD_SUCCESS) {
scoped_refptr<base::RefCountedString> data = new base::RefCountedString();
- uint32_t crc32c = ComputeCrc32c(data);
- attachment.reset(
- new Attachment(Attachment::CreateFromParts(id, data, crc32c)));
+ attachment.reset(new Attachment(Attachment::CreateFromParts(id, data)));
}
base::MessageLoop::current()->PostTask(
FROM_HERE,
@@ -309,7 +305,7 @@ TEST_F(AttachmentServiceImplTest, GetOrDownload_EmptyAttachmentList) {
TEST_F(AttachmentServiceImplTest, GetOrDownload_Local) {
AttachmentIdList attachment_ids;
- attachment_ids.push_back(AttachmentId::Create());
+ attachment_ids.push_back(AttachmentId::Create(0, 0));
attachment_service()->GetOrDownloadAttachments(attachment_ids,
download_callback());
AttachmentIdSet local_attachments;
@@ -326,10 +322,10 @@ TEST_F(AttachmentServiceImplTest, GetOrDownload_Local) {
TEST_F(AttachmentServiceImplTest, GetOrDownload_LocalRemoteUnavailable) {
// Create attachment list with 4 ids.
AttachmentIdList attachment_ids;
- attachment_ids.push_back(AttachmentId::Create());
- attachment_ids.push_back(AttachmentId::Create());
- attachment_ids.push_back(AttachmentId::Create());
- attachment_ids.push_back(AttachmentId::Create());
+ 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));
// Call attachment service.
attachment_service()->GetOrDownloadAttachments(attachment_ids,
download_callback());
@@ -395,7 +391,7 @@ TEST_F(AttachmentServiceImplTest, GetOrDownload_NoDownloader) {
this);
AttachmentIdList attachment_ids;
- attachment_ids.push_back(AttachmentId::Create());
+ attachment_ids.push_back(AttachmentId::Create(0, 0));
attachment_service()->GetOrDownloadAttachments(attachment_ids,
download_callback());
EXPECT_FALSE(store()->read_ids.empty());
@@ -412,7 +408,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_Success) {
AttachmentIdSet attachment_ids;
const unsigned num_attachments = 3;
for (unsigned i = 0; i < num_attachments; ++i) {
- attachment_ids.insert(AttachmentId::Create());
+ attachment_ids.insert(AttachmentId::Create(0, 0));
}
attachment_service()->UploadAttachments(attachment_ids);
@@ -446,7 +442,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_Success_NoDelegate) {
NULL); // No delegate.
AttachmentIdSet attachment_ids;
- attachment_ids.insert(AttachmentId::Create());
+ attachment_ids.insert(AttachmentId::Create(0, 0));
attachment_service()->UploadAttachments(attachment_ids);
RunLoopAndFireTimer();
ASSERT_EQ(1U, store()->read_ids.size());
@@ -463,8 +459,8 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_Success_NoDelegate) {
TEST_F(AttachmentServiceImplTest, UploadAttachments_SomeMissingFromStore) {
AttachmentIdSet attachment_ids;
- attachment_ids.insert(AttachmentId::Create());
- attachment_ids.insert(AttachmentId::Create());
+ attachment_ids.insert(AttachmentId::Create(0, 0));
+ attachment_ids.insert(AttachmentId::Create(0, 0));
attachment_service()->UploadAttachments(attachment_ids);
RunLoopAndFireTimer();
ASSERT_GE(store()->read_ids.size(), 1U);
@@ -490,7 +486,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_AllMissingFromStore) {
AttachmentIdSet attachment_ids;
const unsigned num_attachments = 2;
for (unsigned i = 0; i < num_attachments; ++i) {
- attachment_ids.insert(AttachmentId::Create());
+ attachment_ids.insert(AttachmentId::Create(0, 0));
}
attachment_service()->UploadAttachments(attachment_ids);
@@ -514,7 +510,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_NoUploader) {
this);
AttachmentIdSet attachment_ids;
- attachment_ids.insert(AttachmentId::Create());
+ attachment_ids.insert(AttachmentId::Create(0, 0));
attachment_service()->UploadAttachments(attachment_ids);
RunLoop();
EXPECT_EQ(0U, store()->read_ids.size());
@@ -526,7 +522,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_OneUploadFails) {
AttachmentIdSet attachment_ids;
const unsigned num_attachments = 3;
for (unsigned i = 0; i < num_attachments; ++i) {
- attachment_ids.insert(AttachmentId::Create());
+ attachment_ids.insert(AttachmentId::Create(0, 0));
}
attachment_service()->UploadAttachments(attachment_ids);
@@ -556,7 +552,7 @@ TEST_F(AttachmentServiceImplTest, UploadAttachments_OneUploadFails) {
TEST_F(AttachmentServiceImplTest,
UploadAttachments_ResetBackoffAfterNetworkChange) {
AttachmentIdSet attachment_ids;
- attachment_ids.insert(AttachmentId::Create());
+ attachment_ids.insert(AttachmentId::Create(0, 0));
attachment_service()->UploadAttachments(attachment_ids);
RunLoopAndFireTimer();

Powered by Google App Engine
This is Rietveld 408576698