Index: net/disk_cache/entry_unittest.cc |
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc |
index 8f35755c6b30df5069603d67340341bb08bc6e0b..758e777a739d8705eb574e2ed51ffa48d77040ee 100644 |
--- a/net/disk_cache/entry_unittest.cc |
+++ b/net/disk_cache/entry_unittest.cc |
@@ -4265,3 +4265,21 @@ TEST_F(DiskCacheEntryTest, SimpleCacheReadCorruptKeySHA256) { |
disk_cache::simple_util::CorruptKeySHA256FromEntry(key, cache_path_)); |
EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
} |
+ |
+TEST_F(DiskCacheEntryTest, SimpleCacheReadCorruptLength) { |
+ SetCacheType(net::APP_CACHE); |
+ SetSimpleCacheMode(); |
+ InitCache(); |
+ disk_cache::Entry* entry; |
+ std::string key("a key"); |
+ ASSERT_EQ(net::OK, CreateEntry(key, &entry)); |
+ entry->Close(); |
+ |
+ base::RunLoop().RunUntilIdle(); |
+ disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
+ base::RunLoop().RunUntilIdle(); |
+ |
+ EXPECT_TRUE( |
+ disk_cache::simple_util::CorruptStream0LengthFromEntry(key, cache_path_)); |
+ EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
+} |