| Index: sync/api/attachments/attachment_unittest.cc
|
| diff --git a/sync/api/attachments/attachment_unittest.cc b/sync/api/attachments/attachment_unittest.cc
|
| index c9e55503e715606ad9c6f69d5ca7880308d51faf..3dcb444abf7dec80291da5318b16578b9b89b9b9 100644
|
| --- a/sync/api/attachments/attachment_unittest.cc
|
| +++ b/sync/api/attachments/attachment_unittest.cc
|
| @@ -8,6 +8,7 @@
|
|
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/ref_counted_memory.h"
|
| +#include "sync/internal_api/public/attachments/attachment_util.h"
|
| #include "sync/protocol/sync.pb.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -24,23 +25,24 @@ class AttachmentTest : public testing::Test {};
|
| TEST_F(AttachmentTest, Create_UniqueIdIsUnique) {
|
| scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString);
|
| some_data->data() = kAttachmentData;
|
| - Attachment a1 = Attachment::Create(some_data);
|
| - Attachment a2 = Attachment::Create(some_data);
|
| + Attachment a1 = Attachment::CreateNew(some_data);
|
| + Attachment a2 = Attachment::CreateNew(some_data);
|
| EXPECT_NE(a1.GetId(), a2.GetId());
|
| EXPECT_EQ(a1.GetData(), a2.GetData());
|
| }
|
|
|
| TEST_F(AttachmentTest, Create_WithEmptyData) {
|
| scoped_refptr<base::RefCountedString> empty_data(new base::RefCountedString);
|
| - Attachment a = Attachment::Create(empty_data);
|
| + Attachment a = Attachment::CreateNew(empty_data);
|
| EXPECT_EQ(empty_data, a.GetData());
|
| }
|
|
|
| -TEST_F(AttachmentTest, CreateWithId_HappyCase) {
|
| +TEST_F(AttachmentTest, RestoreExisting_HappyCase) {
|
| AttachmentId id = AttachmentId::Create();
|
| scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString);
|
| some_data->data() = kAttachmentData;
|
| - Attachment a = Attachment::CreateWithId(id, some_data);
|
| + uint32_t crc = ComputeCrc32c(some_data);
|
| + Attachment a = Attachment::RestoreExisting(id, some_data, crc);
|
| EXPECT_EQ(id, a.GetId());
|
| EXPECT_EQ(some_data, a.GetData());
|
| }
|
|
|