OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ | 5 #ifndef SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ |
6 #define SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ | 6 #define SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ |
7 | 7 |
8 #include "sync/api/attachments/attachment_store.h" | 8 #include "sync/api/attachments/attachment_store.h" |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 } | 126 } |
127 }; | 127 }; |
128 | 128 |
129 TYPED_TEST_CASE_P(AttachmentStoreTest); | 129 TYPED_TEST_CASE_P(AttachmentStoreTest); |
130 | 130 |
131 // Verify that we do not overwrite existing attachments and that we do not treat | 131 // Verify that we do not overwrite existing attachments and that we do not treat |
132 // it as an error. | 132 // it as an error. |
133 TYPED_TEST_P(AttachmentStoreTest, Write_NoOverwriteNoError) { | 133 TYPED_TEST_P(AttachmentStoreTest, Write_NoOverwriteNoError) { |
134 // Create two attachments with the same id but different data. | 134 // Create two attachments with the same id but different data. |
135 Attachment attachment1 = Attachment::Create(this->some_data1); | 135 Attachment attachment1 = Attachment::Create(this->some_data1); |
136 Attachment attachment2 = | 136 uint32_t crc32c = ComputeCrc32c(this->some_data2); |
137 Attachment::CreateFromParts(attachment1.GetId(), this->some_data2); | 137 Attachment attachment2 = Attachment::CreateFromParts( |
| 138 attachment1.GetId(), this->some_data2, crc32c); |
138 | 139 |
139 // Write the first one. | 140 // Write the first one. |
140 AttachmentList some_attachments; | 141 AttachmentList some_attachments; |
141 some_attachments.push_back(attachment1); | 142 some_attachments.push_back(attachment1); |
142 this->store->Write(some_attachments, this->write_callback); | 143 this->store->Write(some_attachments, this->write_callback); |
143 this->ClearAndPumpLoop(); | 144 this->ClearAndPumpLoop(); |
144 EXPECT_EQ(AttachmentStore::SUCCESS, this->result); | 145 EXPECT_EQ(AttachmentStore::SUCCESS, this->result); |
145 | 146 |
146 // Write the second one. | 147 // Write the second one. |
147 some_attachments.clear(); | 148 some_attachments.clear(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 Write_RoundTrip, | 391 Write_RoundTrip, |
391 Read_OneNotFound, | 392 Read_OneNotFound, |
392 Drop_DropTwoButOnlyOneExists, | 393 Drop_DropTwoButOnlyOneExists, |
393 Drop_DoesNotExist, | 394 Drop_DoesNotExist, |
394 ReadMetadata, | 395 ReadMetadata, |
395 ReadAllMetadata); | 396 ReadAllMetadata); |
396 | 397 |
397 } // namespace syncer | 398 } // namespace syncer |
398 | 399 |
399 #endif // SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ | 400 #endif // SYNC_INTERNAL_API_ATTACHMENTS_ATTACHMENT_STORE_TEST_TEMPLATE_H_ |
OLD | NEW |