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

Unified Diff: sync/internal_api/attachments/attachment_store_test_template.h

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_store_test_template.h
diff --git a/sync/internal_api/attachments/attachment_store_test_template.h b/sync/internal_api/attachments/attachment_store_test_template.h
index 1d9bd053daa1c31bf2153e3b34abe957509ce783..faa8450aeafbd6c84bb7c30f9d855816fb1c74a3 100644
--- a/sync/internal_api/attachments/attachment_store_test_template.h
+++ b/sync/internal_api/attachments/attachment_store_test_template.h
@@ -14,6 +14,7 @@
#include "base/message_loop/message_loop.h"
#include "base/thread_task_runner_handle.h"
#include "sync/api/attachments/attachment.h"
+#include "sync/internal_api/public/attachments/attachment_util.h"
#include "sync/protocol/sync.pb.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -115,9 +116,10 @@ TYPED_TEST_CASE_P(AttachmentStoreTest);
// it as an error.
TYPED_TEST_P(AttachmentStoreTest, Write_NoOverwriteNoError) {
// Create two attachments with the same id but different data.
- Attachment attachment1 = Attachment::Create(this->some_data1);
+ Attachment attachment1 = Attachment::CreateNew(this->some_data1);
+ uint32_t crc = ComputeCrc32c(this->some_data2);
Attachment attachment2 =
- Attachment::CreateWithId(attachment1.GetId(), this->some_data2);
+ Attachment::RestoreExisting(attachment1.GetId(), this->some_data2, crc);
// Write the first one.
AttachmentList some_attachments;
@@ -149,8 +151,8 @@ TYPED_TEST_P(AttachmentStoreTest, Write_NoOverwriteNoError) {
// Verify that we can write some attachments and read them back.
TYPED_TEST_P(AttachmentStoreTest, Write_RoundTrip) {
- Attachment attachment1 = Attachment::Create(this->some_data1);
- Attachment attachment2 = Attachment::Create(this->some_data2);
+ Attachment attachment1 = Attachment::CreateNew(this->some_data1);
+ Attachment attachment2 = Attachment::CreateNew(this->some_data2);
AttachmentList some_attachments;
some_attachments.push_back(attachment1);
some_attachments.push_back(attachment2);
@@ -181,8 +183,8 @@ TYPED_TEST_P(AttachmentStoreTest, Write_RoundTrip) {
// Try to read two attachments when only one exists.
TYPED_TEST_P(AttachmentStoreTest, Read_OneNotFound) {
- Attachment attachment1 = Attachment::Create(this->some_data1);
- Attachment attachment2 = Attachment::Create(this->some_data2);
+ Attachment attachment1 = Attachment::CreateNew(this->some_data1);
+ Attachment attachment2 = Attachment::CreateNew(this->some_data2);
AttachmentList some_attachments;
// Write attachment1 only.
@@ -208,8 +210,8 @@ TYPED_TEST_P(AttachmentStoreTest, Read_OneNotFound) {
// and that the existing attachment was dropped.
TYPED_TEST_P(AttachmentStoreTest, Drop_DropTwoButOnlyOneExists) {
// First, create two attachments.
- Attachment attachment1 = Attachment::Create(this->some_data1);
- Attachment attachment2 = Attachment::Create(this->some_data2);
+ Attachment attachment1 = Attachment::CreateNew(this->some_data1);
+ Attachment attachment2 = Attachment::CreateNew(this->some_data2);
AttachmentList some_attachments;
some_attachments.push_back(attachment1);
some_attachments.push_back(attachment2);
@@ -254,7 +256,7 @@ TYPED_TEST_P(AttachmentStoreTest, Drop_DropTwoButOnlyOneExists) {
// Verify that attempting to drop an attachment that does not exist is not an
// error.
TYPED_TEST_P(AttachmentStoreTest, Drop_DoesNotExist) {
- Attachment attachment1 = Attachment::Create(this->some_data1);
+ Attachment attachment1 = Attachment::CreateNew(this->some_data1);
AttachmentList some_attachments;
some_attachments.push_back(attachment1);
this->store->Write(some_attachments, this->write_callback);

Powered by Google App Engine
This is Rietveld 408576698