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

Unified Diff: content/browser/blob_storage/blob_dispatcher_host_unittest.cc

Issue 2214293002: [BlobStorage] Added back security policy for files in blobs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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: 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);

Powered by Google App Engine
This is Rietveld 408576698