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

Unified Diff: sync/internal_api/attachments/on_disk_attachment_store_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/on_disk_attachment_store_unittest.cc
diff --git a/sync/internal_api/attachments/on_disk_attachment_store_unittest.cc b/sync/internal_api/attachments/on_disk_attachment_store_unittest.cc
index e46f060216094041516edca0248e1a323c4f1dab..3b8c59922f65790f976f515dc00243560805a89b 100644
--- a/sync/internal_api/attachments/on_disk_attachment_store_unittest.cc
+++ b/sync/internal_api/attachments/on_disk_attachment_store_unittest.cc
@@ -322,10 +322,12 @@ TEST_F(OnDiskAttachmentStoreSpecificTest, MismatchedCrc) {
// Write attachment with incorrect crc32c.
AttachmentStore::Result write_result = AttachmentStore::UNSPECIFIED_ERROR;
const uint32_t intentionally_wrong_crc32c = 0;
- std::string some_data("data1");
+
+ scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString());
+ some_data->data() = "data1";
Attachment attachment = Attachment::CreateFromParts(
- AttachmentId::Create(), base::RefCountedString::TakeString(&some_data),
- intentionally_wrong_crc32c);
+ AttachmentId::Create(some_data->size(), intentionally_wrong_crc32c),
+ some_data);
AttachmentList attachments;
attachments.push_back(attachment);
store_->Write(attachments,
@@ -365,7 +367,10 @@ TEST_F(OnDiskAttachmentStoreSpecificTest, OpsAfterInitializationFailed) {
// STORE_INITIALIZATION_FAILED.
AttachmentStore::Result read_result = AttachmentStore::SUCCESS;
AttachmentIdList attachment_ids;
- attachment_ids.push_back(AttachmentId::Create());
+ std::string some_data("data1");
+ Attachment attachment =
+ Attachment::Create(base::RefCountedString::TakeString(&some_data));
+ attachment_ids.push_back(attachment.GetId());
AttachmentIdList failed_attachment_ids;
store_->Read(
attachment_ids,
@@ -382,11 +387,8 @@ TEST_F(OnDiskAttachmentStoreSpecificTest, OpsAfterInitializationFailed) {
// Writing to uninitialized store should result in
// STORE_INITIALIZATION_FAILED.
AttachmentStore::Result write_result = AttachmentStore::SUCCESS;
- std::string some_data;
AttachmentList attachments;
- some_data = "data1";
- attachments.push_back(
- Attachment::Create(base::RefCountedString::TakeString(&some_data)));
+ attachments.push_back(attachment);
store_->Write(attachments,
base::Bind(&OnDiskAttachmentStoreSpecificTest::CopyResult,
base::Unretained(this), &write_result));

Powered by Google App Engine
This is Rietveld 408576698