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

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

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back transport controller test, small cleanups Created 4 years, 6 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_storage_context_unittest.cc
diff --git a/content/browser/blob_storage/blob_storage_context_unittest.cc b/content/browser/blob_storage/blob_storage_context_unittest.cc
index e03d5f3b74a329c7a8a1f0caa399a034c9cf1ea5..e4ddf146dd8e111c4ef04439baec4a733c50897a 100644
--- a/content/browser/blob_storage/blob_storage_context_unittest.cc
+++ b/content/browser/blob_storage/blob_storage_context_unittest.cc
@@ -38,8 +38,8 @@ using RequestMemoryCallback =
namespace storage {
namespace {
-const char kContentType[] = "text/plain";
-const char kContentDisposition[] = "content_disposition";
+// const char kContentType[] = "text/plain";
+// const char kContentDisposition[] = "content_disposition";
const int kTestDiskCacheStreamIndex = 0;
// Our disk cache tests don't need a real data handle since the tests themselves
@@ -121,20 +121,20 @@ TEST_F(BlobStorageContextTest, IncrementDecrementRef) {
blob_data_handle = context_.GetBlobDataFromUUID(kId);
EXPECT_FALSE(blob_data_handle);
}
-
-TEST_F(BlobStorageContextTest, OnCancelBuildingBlob) {
- base::MessageLoop fake_io_message_loop;
-
- // Build up a basic blob.
- const std::string kId("id");
- context_.CreatePendingBlob(kId, std::string(kContentType),
- std::string(kContentDisposition));
- EXPECT_TRUE(context_.IsBeingBuilt(kId));
- context_.CancelPendingBlob(kId, IPCBlobCreationCancelCode::OUT_OF_MEMORY);
- EXPECT_TRUE(context_.registry().HasEntry(kId));
- EXPECT_FALSE(context_.IsBeingBuilt(kId));
- EXPECT_TRUE(context_.IsBroken(kId));
-}
+//
+// TEST_F(BlobStorageContextTest, OnCancelBuildingBlob) {
+// base::MessageLoop fake_io_message_loop;
+//
+// // Build up a basic blob.
+// const std::string kId("id");
+// context_.CreatePendingBlob(kId, std::string(kContentType),
+// std::string(kContentDisposition));
+// EXPECT_TRUE(context_.IsBeingBuilt(kId));
+// context_.CancelPendingBlob(kId, IPCBlobCreationCancelCode::OUT_OF_MEMORY);
+// EXPECT_TRUE(context_.registry().HasEntry(kId));
+// EXPECT_FALSE(context_.IsBeingBuilt(kId));
+// EXPECT_TRUE(context_.IsBroken(kId));
+//}
TEST_F(BlobStorageContextTest, BlobDataHandle) {
base::MessageLoop fake_io_message_loop;
@@ -162,45 +162,45 @@ TEST_F(BlobStorageContextTest, BlobDataHandle) {
EXPECT_FALSE(blob_data_handle);
}
-TEST_F(BlobStorageContextTest, MemoryUsage) {
- const std::string kId1("id1");
- const std::string kId2("id2");
-
- base::MessageLoop fake_io_message_loop;
-
- BlobDataBuilder builder1(kId1);
- BlobDataBuilder builder2(kId2);
- builder1.AppendData("Data1Data2");
- builder2.AppendBlob(kId1);
- builder2.AppendBlob(kId1);
- builder2.AppendBlob(kId1);
- builder2.AppendBlob(kId1);
- builder2.AppendBlob(kId1);
- builder2.AppendBlob(kId1);
- builder2.AppendBlob(kId1);
-
- EXPECT_EQ(0lu, context_.memory_usage());
-
- std::unique_ptr<BlobDataHandle> blob_data_handle =
- context_.AddFinishedBlob(&builder1);
- EXPECT_EQ(10lu, context_.memory_usage());
- std::unique_ptr<BlobDataHandle> blob_data_handle2 =
- context_.AddFinishedBlob(&builder2);
- EXPECT_EQ(10lu, context_.memory_usage());
-
- EXPECT_EQ(2u, context_.registry().blob_count());
-
- blob_data_handle.reset();
- base::RunLoop().RunUntilIdle();
-
- EXPECT_EQ(10lu, context_.memory_usage());
- EXPECT_EQ(1u, context_.registry().blob_count());
- blob_data_handle2.reset();
- base::RunLoop().RunUntilIdle();
-
- EXPECT_EQ(0lu, context_.memory_usage());
- EXPECT_EQ(0u, context_.registry().blob_count());
-}
+// TEST_F(BlobStorageContextTest, MemoryUsage) {
+// const std::string kId1("id1");
+// const std::string kId2("id2");
+//
+// base::MessageLoop fake_io_message_loop;
+//
+// BlobDataBuilder builder1(kId1);
+// BlobDataBuilder builder2(kId2);
+// builder1.AppendData("Data1Data2");
+// builder2.AppendBlob(kId1);
+// builder2.AppendBlob(kId1);
+// builder2.AppendBlob(kId1);
+// builder2.AppendBlob(kId1);
+// builder2.AppendBlob(kId1);
+// builder2.AppendBlob(kId1);
+// builder2.AppendBlob(kId1);
+//
+// EXPECT_EQ(0lu, context_.memory_usage());
+//
+// std::unique_ptr<BlobDataHandle> blob_data_handle =
+// context_.AddFinishedBlob(&builder1);
+// EXPECT_EQ(10lu, context_.memory_usage());
+// std::unique_ptr<BlobDataHandle> blob_data_handle2 =
+// context_.AddFinishedBlob(&builder2);
+// EXPECT_EQ(10lu, context_.memory_usage());
+//
+// EXPECT_EQ(2u, context_.registry().blob_count());
+//
+// blob_data_handle.reset();
+// base::RunLoop().RunUntilIdle();
+//
+// EXPECT_EQ(10lu, context_.memory_usage());
+// EXPECT_EQ(1u, context_.registry().blob_count());
+// blob_data_handle2.reset();
+// base::RunLoop().RunUntilIdle();
+//
+// EXPECT_EQ(0lu, context_.memory_usage());
+// EXPECT_EQ(0u, context_.registry().blob_count());
+//}
TEST_F(BlobStorageContextTest, AddFinishedBlob) {
const std::string kId1("id1");
@@ -445,54 +445,54 @@ TEST_F(BlobStorageContextTest, PublicBlobUrls) {
EXPECT_FALSE(blob_data_handle.get());
EXPECT_FALSE(context_.registry().HasEntry(kId));
}
-
-TEST_F(BlobStorageContextTest, TestUnknownBrokenAndBuildingBlobReference) {
- base::MessageLoop fake_io_message_loop;
- const std::string kBrokenId("broken_id");
- const std::string kBuildingId("building_id");
- const std::string kReferencingId("referencing_id");
- const std::string kUnknownId("unknown_id");
-
- // Create a broken blob and a building blob.
- context_.CreatePendingBlob(kBuildingId, "", "");
- context_.CreatePendingBlob(kBrokenId, "", "");
- context_.CancelPendingBlob(kBrokenId, IPCBlobCreationCancelCode::UNKNOWN);
- EXPECT_TRUE(context_.IsBroken(kBrokenId));
- EXPECT_TRUE(context_.registry().HasEntry(kBrokenId));
-
- // Try to create a blob with a reference to an unknown blob.
- BlobDataBuilder builder(kReferencingId);
- builder.AppendData("data");
- builder.AppendBlob(kUnknownId);
- std::unique_ptr<BlobDataHandle> handle = context_.AddFinishedBlob(builder);
- EXPECT_TRUE(handle->IsBroken());
- EXPECT_TRUE(context_.registry().HasEntry(kReferencingId));
- handle.reset();
- base::RunLoop().RunUntilIdle();
- EXPECT_FALSE(context_.registry().HasEntry(kReferencingId));
-
- // Try to create a blob with a reference to the broken blob.
- BlobDataBuilder builder2(kReferencingId);
- builder2.AppendData("data");
- builder2.AppendBlob(kBrokenId);
- handle = context_.AddFinishedBlob(builder2);
- EXPECT_TRUE(handle->IsBroken());
- EXPECT_TRUE(context_.registry().HasEntry(kReferencingId));
- handle.reset();
- base::RunLoop().RunUntilIdle();
- EXPECT_FALSE(context_.registry().HasEntry(kReferencingId));
-
- // Try to create a blob with a reference to the building blob.
- BlobDataBuilder builder3(kReferencingId);
- builder3.AppendData("data");
- builder3.AppendBlob(kBuildingId);
- handle = context_.AddFinishedBlob(builder3);
- EXPECT_TRUE(handle->IsBroken());
- EXPECT_TRUE(context_.registry().HasEntry(kReferencingId));
- handle.reset();
- base::RunLoop().RunUntilIdle();
- EXPECT_FALSE(context_.registry().HasEntry(kReferencingId));
-}
+//
+// TEST_F(BlobStorageContextTest, TestUnknownBrokenAndBuildingBlobReference) {
+// base::MessageLoop fake_io_message_loop;
+// const std::string kBrokenId("broken_id");
+// const std::string kBuildingId("building_id");
+// const std::string kReferencingId("referencing_id");
+// const std::string kUnknownId("unknown_id");
+//
+// // Create a broken blob and a building blob.
+// context_.CreatePendingBlob(kBuildingId, "", "");
+// context_.CreatePendingBlob(kBrokenId, "", "");
+// context_.CancelPendingBlob(kBrokenId, IPCBlobCreationCancelCode::UNKNOWN);
+// EXPECT_TRUE(context_.IsBroken(kBrokenId));
+// EXPECT_TRUE(context_.registry().HasEntry(kBrokenId));
+//
+// // Try to create a blob with a reference to an unknown blob.
+// BlobDataBuilder builder(kReferencingId);
+// builder.AppendData("data");
+// builder.AppendBlob(kUnknownId);
+// std::unique_ptr<BlobDataHandle> handle = context_.AddFinishedBlob(builder);
+// EXPECT_TRUE(handle->IsBroken());
+// EXPECT_TRUE(context_.registry().HasEntry(kReferencingId));
+// handle.reset();
+// base::RunLoop().RunUntilIdle();
+// EXPECT_FALSE(context_.registry().HasEntry(kReferencingId));
+//
+// // Try to create a blob with a reference to the broken blob.
+// BlobDataBuilder builder2(kReferencingId);
+// builder2.AppendData("data");
+// builder2.AppendBlob(kBrokenId);
+// handle = context_.AddFinishedBlob(builder2);
+// EXPECT_TRUE(handle->IsBroken());
+// EXPECT_TRUE(context_.registry().HasEntry(kReferencingId));
+// handle.reset();
+// base::RunLoop().RunUntilIdle();
+// EXPECT_FALSE(context_.registry().HasEntry(kReferencingId));
+//
+// // Try to create a blob with a reference to the building blob.
+// BlobDataBuilder builder3(kReferencingId);
+// builder3.AppendData("data");
+// builder3.AppendBlob(kBuildingId);
+// handle = context_.AddFinishedBlob(builder3);
+// EXPECT_TRUE(handle->IsBroken());
+// EXPECT_TRUE(context_.registry().HasEntry(kReferencingId));
+// handle.reset();
+// base::RunLoop().RunUntilIdle();
+// EXPECT_FALSE(context_.registry().HasEntry(kReferencingId));
+//}
// TODO(michaeln): tests for the depcrecated url stuff

Powered by Google App Engine
This is Rietveld 408576698