| Index: content/browser/blob_storage/blob_dispatcher_host_unittest.cc
|
| diff --git a/content/browser/blob_storage/blob_dispatcher_host_unittest.cc b/content/browser/blob_storage/blob_dispatcher_host_unittest.cc
|
| index ccd53246c449c74f707c05c0ebed4184deb0c543..0293099488e8ab64f83b782bc48b90ff89da1c7e 100644
|
| --- a/content/browser/blob_storage/blob_dispatcher_host_unittest.cc
|
| +++ b/content/browser/blob_storage/blob_dispatcher_host_unittest.cc
|
| @@ -59,11 +59,13 @@ void ConstructionCompletePopulator(bool* succeeded_pointer,
|
| *reason_pointer = reason;
|
| }
|
|
|
| +// TODO(dmurph): Create file test that verifies security policy.
|
| class TestableBlobDispatcherHost : public BlobDispatcherHost {
|
| public:
|
| TestableBlobDispatcherHost(ChromeBlobStorageContext* blob_storage_context,
|
| IPC::TestSink* sink)
|
| - : BlobDispatcherHost(blob_storage_context), sink_(sink) {
|
| + : BlobDispatcherHost(
|
| + 0 /* process_id */, blob_storage_context), sink_(sink) {
|
| this->SetMemoryConstantsForTesting(kTestBlobStorageIPCThresholdBytes,
|
| kTestBlobStorageMaxSharedMemoryBytes,
|
| kTestBlobStorageMaxFileSizeBytes);
|
| @@ -286,6 +288,32 @@ TEST_F(BlobDispatcherHostTest, Shortcut) {
|
| ExpectHandleEqualsData(handle.get(), elements);
|
| }
|
|
|
| +
|
| +TEST_F(BlobDispatcherHostTest, File) {
|
| + const std::string kId = "uuid1";
|
| + sink_.ClearMessages();
|
| + host_->OnRegisterBlobUUID(id, std::string(kContentType),
|
| + std::string(kContentDisposition),
|
| + std::set<std::string>());
|
| + EXPECT_FALSE(host_->shutdown_for_bad_message_);
|
| + DataElement element;
|
| + element.SetToFile()
|
| + std::vector<DataElement> elements = {element};
|
| + host_->OnStartBuildingBlob(id, elements);
|
| + EXPECT_FALSE(host_->shutdown_for_bad_message_);
|
| + ExpectDone(id);
|
| + sink_.ClearMessages();
|
| + EXPECT_TRUE(context_->registry().HasEntry(kId));
|
| + std::unique_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(kId);
|
| + EXPECT_TRUE(handle);
|
| +
|
| + DataElement expected;
|
| + expected.SetToBytes(kData, kDataSize);
|
| + std::vector<DataElement> elements = {expected};
|
| + ExpectHandleEqualsData(handle.get(), elements);
|
| +}
|
| +
|
| +
|
| TEST_F(BlobDispatcherHostTest, RegularTransfer) {
|
| const std::string kId = "uuid1";
|
| AsyncBlobTransfer(kId);
|
|
|