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

Unified Diff: net/disk_cache/entry_unittest.cc

Issue 485753002: A small stress test that SimpleCache can't seem to handle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/entry_unittest.cc
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index 359f7250845df4609a4872fe3473a8d2093185a1..a26ecaaa9bedd4d67b8270596d19b3c604180772 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -2342,6 +2342,33 @@ TEST_F(DiskCacheEntryTest, SimpleCacheInternalAsyncIO) {
InternalAsyncIO();
}
+TEST_F(DiskCacheEntryTest, SimpleCacheStress) {
+ SetSimpleCacheMode();
+ InitCache();
+
+ disk_cache::Entry* entry = NULL;
+
+ std::string stream0 = "0";
+ std::string stream1 = "1";
+ scoped_refptr<net::StringIOBuffer> buff0(new net::StringIOBuffer(stream0));
+ scoped_refptr<net::StringIOBuffer> buff1(new net::StringIOBuffer(stream1));
+
+ for (int i = 0; i < 100; ++i) {
+ ASSERT_EQ(net::OK, CreateEntry("foo", &entry));
+ EXPECT_EQ(buff0->size(),
+ WriteData(entry, 0, 0, buff0.get(), buff0->size(), false));
+ EXPECT_EQ(buff1->size(),
+ WriteData(entry, 1, 0, buff1.get(), buff1->size(), false));
+ entry->Close();
+ entry = NULL;
+
+ ASSERT_EQ(net::OK, OpenEntry("foo", &entry));
+ entry->Doom();
+ entry->Close();
+ entry = NULL;
+ }
+}
+
TEST_F(DiskCacheEntryTest, SimpleCacheExternalAsyncIO) {
SetSimpleCacheMode();
InitCache();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698