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

Unified Diff: net/disk_cache/backend_unittest.cc

Issue 13907009: Support optimistic Create and Write operations on the SimpleCache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make linker happy Created 7 years, 8 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
« no previous file with comments | « no previous file | net/disk_cache/entry_unittest.cc » ('j') | net/disk_cache/entry_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « no previous file | net/disk_cache/entry_unittest.cc » ('j') | net/disk_cache/entry_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698