Index: net/disk_cache/backend_unittest.cc |
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc |
index 1ec66eb8e98e7f1eec7bbd38811c0efee128d320..eb26f8822f2a1bdaaeda5c57f739ff15bbc3f6d0 100644 |
--- a/net/disk_cache/backend_unittest.cc |
+++ b/net/disk_cache/backend_unittest.cc |
@@ -2856,6 +2856,13 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenMissingFile) { |
entry->Close(); |
entry = NULL; |
+ // To make sure the file creation completed we need to call open again so that |
gavinp
2013/05/01 13:11:22
Good catch on this.
I think it should be moved ou
felipeg
2013/05/02 09:49:27
Done.
gavinp
2013/05/02 12:47:39
Not done, right?
felipeg
2013/05/02 13:55:58
I thought we agreed to leave it as a comment.
gavinp
2013/05/02 14:05:45
Yeah. I am sorry for being unclear; I just want to
|
+ // we block until it actually created the files. |
+ ASSERT_EQ(net::OK, OpenEntry(key, &entry)); |
+ ASSERT_TRUE(entry != NULL); |
+ entry->Close(); |
+ entry = NULL; |
+ |
// Delete one of the files in the entry. |
base::FilePath to_delete_file = cache_path_.AppendASCII( |
disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, 0)); |
@@ -2864,7 +2871,6 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenMissingFile) { |
// Failing to open the entry should delete the rest of these files. |
ASSERT_EQ(net::ERR_FAILED, OpenEntry(key, &entry)); |
- |
// Confirm the rest of the files are gone. |
for (int i = 1; i < disk_cache::kSimpleEntryFileCount; ++i) { |
base::FilePath |
@@ -2887,6 +2893,13 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenBadFile) { |
entry->Close(); |
entry = NULL; |
+ // To make sure the file creation completed we need to call open again so that |
+ // we block until it actually created the files. |
+ ASSERT_EQ(net::OK, OpenEntry(key, &entry)); |
+ ASSERT_NE(null, entry); |
+ entry->Close(); |
+ entry = NULL; |
+ |
// Write an invalid header on stream 1. |
base::FilePath entry_file1_path = cache_path_.AppendASCII( |
disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, 1)); |