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

Unified Diff: net/http/http_cache_unittest.cc

Issue 2774603003: Doom and create new entry when validation is not a match (Closed)
Patch Set: Feedback addressed. Created 3 years, 6 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
« net/http/http_cache_transaction.cc ('K') | « net/http/http_cache_transaction.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache_unittest.cc
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 62269b7952c8b89bc3d66dc773b42c22f62311fb..5e606f965daaee57936657efd15f14bfc482bb38 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -1704,11 +1704,9 @@ TEST(HttpCache, SimpleGET_ParallelValidationNoMatch) {
// entries since none of them matched the headers of the earlier one.
EXPECT_TRUE(cache.IsWriterPresent(kSimpleGET_Transaction.url));
- // Note that there are only 3 entries created and not 5 since every other
- // transaction would have gone to the network.
EXPECT_EQ(5, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
- EXPECT_EQ(3, cache.disk_cache()->create_count());
+ EXPECT_EQ(5, cache.disk_cache()->create_count());
// All requests depend on the writer, and the writer is between Start and
// Read, i.e. idle.
@@ -1724,7 +1722,7 @@ TEST(HttpCache, SimpleGET_ParallelValidationNoMatch) {
EXPECT_EQ(5, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
- EXPECT_EQ(3, cache.disk_cache()->create_count());
+ EXPECT_EQ(5, cache.disk_cache()->create_count());
}
// Tests that a GET followed by a DELETE results in DELETE immediately starting
@@ -1926,7 +1924,7 @@ TEST(HttpCache, SimpleGET_ParallelValidationCancelReader) {
// The pending transactions will be added to a new entry.
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(1, cache.GetCountDoneHeadersQueue(kSimpleGET_Transaction.url));
+ EXPECT_EQ(2, cache.GetCountDoneHeadersQueue(kSimpleGET_Transaction.url));
EXPECT_TRUE(cache.IsWriterPresent(kSimpleGET_Transaction.url));
// Complete the rest of the transactions.
@@ -1935,7 +1933,7 @@ TEST(HttpCache, SimpleGET_ParallelValidationCancelReader) {
ReadAndVerifyTransaction(c->trans.get(), kSimpleGET_Transaction);
}
- EXPECT_EQ(3, cache.network_layer()->transaction_count());
+ EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
EXPECT_EQ(2, cache.disk_cache()->create_count());
}
@@ -2000,10 +1998,6 @@ TEST(HttpCache, SimpleGET_ParallelValidationCancelWriter) {
c->trans->ResumeNetworkStart();
base::RunLoop().RunUntilIdle();
- // Headers transaction would have doomed the new entry created.
- EXPECT_TRUE(
- cache.disk_cache()->IsDiskEntryDoomed(kSimpleGET_Transaction.url));
-
// Complete the rest of the transactions.
for (auto& context : context_list) {
if (!context)
@@ -2013,7 +2007,7 @@ TEST(HttpCache, SimpleGET_ParallelValidationCancelWriter) {
EXPECT_EQ(4, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
- EXPECT_EQ(2, cache.disk_cache()->create_count());
+ EXPECT_EQ(3, cache.disk_cache()->create_count());
}
// Tests when a writer is destroyed mid-read and entry is marked as truncated,
@@ -2142,10 +2136,6 @@ TEST(HttpCache, SimpleGET_ParallelValidationStopCaching) {
c->trans->ResumeNetworkStart();
base::RunLoop().RunUntilIdle();
- // Headers transaction would have doomed the new entry created.
- EXPECT_TRUE(
- cache.disk_cache()->IsDiskEntryDoomed(kSimpleGET_Transaction.url));
-
// Complete the rest of the transactions.
for (auto& context : context_list) {
if (!context)
@@ -2155,7 +2145,7 @@ TEST(HttpCache, SimpleGET_ParallelValidationStopCaching) {
EXPECT_EQ(4, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
- EXPECT_EQ(2, cache.disk_cache()->create_count());
+ EXPECT_EQ(3, cache.disk_cache()->create_count());
}
// Tests that a transaction is currently in headers phase and is destroyed
@@ -2449,7 +2439,7 @@ TEST(HttpCache, FastNoStoreGET_DoneWithPending) {
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
- EXPECT_EQ(2, cache.disk_cache()->create_count());
+ EXPECT_EQ(3, cache.disk_cache()->create_count());
// Now, make sure that the second request asks for the entry not to be stored.
request_handler.set_no_store(true);
@@ -2464,7 +2454,7 @@ TEST(HttpCache, FastNoStoreGET_DoneWithPending) {
EXPECT_EQ(3, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
- EXPECT_EQ(2, cache.disk_cache()->create_count());
+ EXPECT_EQ(3, cache.disk_cache()->create_count());
RemoveMockTransaction(&kFastNoStoreGET_Transaction);
}
« net/http/http_cache_transaction.cc ('K') | « net/http/http_cache_transaction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698