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

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

Issue 710073003: Store attachment crc in AttachmentStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Add comment in attachment_util.h. Created 6 years, 1 month 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 857514a3e134c4e425e285b35e8c105dcd07821a..1d6c8a680abdb4f2db127e291e21feb95bc5507e 100644
--- a/sync/internal_api/attachments/attachment_service_impl_unittest.cc
+++ b/sync/internal_api/attachments/attachment_service_impl_unittest.cc
@@ -9,6 +9,7 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/timer/mock_timer.h"
+#include "sync/internal_api/public/attachments/attachment_util.h"
#include "sync/internal_api/public/attachments/fake_attachment_downloader.h"
#include "sync/internal_api/public/attachments/fake_attachment_uploader.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
@@ -55,7 +56,9 @@ class MockAttachmentStore : public AttachmentStore,
for (AttachmentIdList::const_iterator iter = ids.begin(); iter != ids.end();
++iter) {
if (local_attachments.find(*iter) != local_attachments.end()) {
- Attachment attachment = Attachment::CreateWithId(*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);
@@ -112,7 +115,9 @@ class MockAttachmentDownloader
scoped_ptr<Attachment> attachment;
if (result == DOWNLOAD_SUCCESS) {
scoped_refptr<base::RefCountedString> data = new base::RefCountedString();
- attachment.reset(new Attachment(Attachment::CreateWithId(id, data)));
+ uint32_t crc32c = ComputeCrc32c(data);
+ attachment.reset(
+ new Attachment(Attachment::CreateFromParts(id, data, crc32c)));
}
base::MessageLoop::current()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698