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

Unified Diff: sync/internal_api/attachments/attachment_uploader_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_uploader_impl_unittest.cc
diff --git a/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc b/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc
index 1213b9faaa47df0a15b868217c6c1d2134f3f286..5e62799d986e90e2aedef3102d9737e9beb944ad 100644
--- a/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc
+++ b/sync/internal_api/attachments/attachment_uploader_impl_unittest.cc
@@ -23,6 +23,7 @@
#include "net/test/embedded_test_server/http_response.h"
#include "net/url_request/url_request_test_util.h"
#include "sync/api/attachments/attachment.h"
+#include "sync/internal_api/public/attachments/attachment_util.h"
#include "sync/protocol/sync.pb.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -312,7 +313,7 @@ Attachment AttachmentUploaderImplTest::UploadAndRespondWith(
request_handler().SetStatusCode(status_code);
scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString);
some_data->data() = kAttachmentData;
- Attachment attachment = Attachment::Create(some_data);
+ Attachment attachment = Attachment::CreateNew(some_data);
uploader()->UploadAttachment(attachment, upload_callback());
return attachment;
}
@@ -533,7 +534,7 @@ TEST_F(AttachmentUploaderImplTest, UploadAttachment_FailToGetToken) {
// token service.
scoped_refptr<base::RefCountedString> some_data(new base::RefCountedString);
some_data->data() = kAttachmentData;
- Attachment attachment = Attachment::Create(some_data);
+ Attachment attachment = Attachment::CreateNew(some_data);
uploader()->UploadAttachment(attachment, upload_callback());
RunAndWaitFor(1);
@@ -631,14 +632,12 @@ TEST_F(AttachmentUploaderImplTest, ComputeCrc32cHash) {
scoped_refptr<base::RefCountedString> empty(new base::RefCountedString);
empty->data() = "";
EXPECT_EQ("AAAAAA==",
- AttachmentUploaderImpl::ComputeCrc32cHash(empty->front_as<char>(),
- empty->size()));
+ AttachmentUploaderImpl::FormatCrc32cHash(ComputeCrc32c(empty)));
scoped_refptr<base::RefCountedString> hello_world(new base::RefCountedString);
hello_world->data() = "hello world";
- EXPECT_EQ("yZRlqg==",
- AttachmentUploaderImpl::ComputeCrc32cHash(
- hello_world->front_as<char>(), hello_world->size()));
+ EXPECT_EQ("yZRlqg==", AttachmentUploaderImpl::FormatCrc32cHash(
+ ComputeCrc32c(hello_world)));
}
// TODO(maniscalco): Add test case for when we are uploading an attachment that

Powered by Google App Engine
This is Rietveld 408576698