Chromium Code Reviews| Index: net/disk_cache/entry_unittest.cc |
| diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc |
| index 188a589fa055fa2d3783675c4184893db8cbe9c0..ab8e2dd16c8841edad5a80904e57106102f9372b 100644 |
| --- a/net/disk_cache/entry_unittest.cc |
| +++ b/net/disk_cache/entry_unittest.cc |
| @@ -3085,6 +3085,33 @@ TEST_F(DiskCacheEntryTest, SimpleCacheDoomDoom) { |
| EXPECT_NE(null, entry3); |
| } |
| +TEST_F(DiskCacheEntryTest, SimpleCacheDoomCreateDoom) { |
| + // Test sequence: |
| + // Create, Doom, Create, Doom. |
|
pasko
2013/09/16 14:01:42
nit: I would have written this with more clarity:
|
| + SetSimpleCacheMode(); |
| + InitCache(); |
| + |
| + disk_cache::Entry* null = NULL; |
| + |
| + const char key[] = "the first key"; |
| + |
| + disk_cache::Entry* entry1 = NULL; |
| + ASSERT_EQ(net::OK, CreateEntry(key, &entry1)); |
| + ScopedEntryPtr entry1_closer(entry1); |
| + EXPECT_NE(null, entry1); |
| + |
| + entry1->Doom(); |
| + |
| + disk_cache::Entry* entry2 = NULL; |
| + ASSERT_EQ(net::OK, CreateEntry(key, &entry2)); |
| + ScopedEntryPtr entry2_closer(entry2); |
| + EXPECT_NE(null, entry2); |
| + |
| + entry2->Doom(); |
| + |
| + // This test passes if it doesn't crash. |
| +} |
| + |
| // Checks that an optimistic Create would fail later on a racing Open. |
| TEST_F(DiskCacheEntryTest, SimpleCacheOptimisticCreateFailsOnOpen) { |
| SetSimpleCacheMode(); |