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

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 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..e6814bb9a6affd819e2c3c2e9b2b9c7af0a5cf21 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,8 @@ 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 crc = ComputeCrc32c(data);
maniscalco 2014/11/11 00:44:54 crc -> crc32c (and elsewhere in this file)
pavely 2014/11/11 22:27:15 Done.
+ Attachment attachment = Attachment::RestoreExisting(*iter, data, crc);
attachments->insert(std::make_pair(*iter, attachment));
} else {
unavailable_attachments->push_back(*iter);
@@ -112,7 +114,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 crc = ComputeCrc32c(data);
+ attachment.reset(
+ new Attachment(Attachment::RestoreExisting(id, data, crc)));
}
base::MessageLoop::current()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698