diff options
Diffstat (limited to 'net/http/http_cache_unittest.cc')
-rw-r--r-- | net/http/http_cache_unittest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index dc114da..a6f63d2 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -1401,10 +1401,17 @@ TEST(HttpCache, SimpleGET_ManyReaders) { c->result = cache.http_cache()->CreateTransaction(&c->trans); EXPECT_EQ(net::OK, c->result); + EXPECT_EQ(net::LOAD_STATE_IDLE, c->trans->GetLoadState()); c->result = c->trans->Start(&request, &c->callback, net::BoundNetLog()); } + // All requests are waiting for the active entry. + for (int i = 0; i < kNumTransactions; ++i) { + Context* c = context_list[i]; + EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE, c->trans->GetLoadState()); + } + // Allow all requests to move from the Create queue to the active entry. MessageLoop::current()->RunAllPending(); @@ -1415,6 +1422,13 @@ TEST(HttpCache, SimpleGET_ManyReaders) { EXPECT_EQ(0, cache.disk_cache()->open_count()); EXPECT_EQ(1, cache.disk_cache()->create_count()); + // All requests depend on the writer, and the writer is between Start and + // Read, i.e. idle. + for (int i = 0; i < kNumTransactions; ++i) { + Context* c = context_list[i]; + EXPECT_EQ(net::LOAD_STATE_IDLE, c->trans->GetLoadState()); + } + for (int i = 0; i < kNumTransactions; ++i) { Context* c = context_list[i]; if (c->result == net::ERR_IO_PENDING) @@ -1479,6 +1493,11 @@ TEST(HttpCache, SimpleGET_RacingReaders) { // Now we have 2 active readers and two queued transactions. + EXPECT_EQ(net::LOAD_STATE_IDLE, + context_list[2]->trans->GetLoadState()); + EXPECT_EQ(net::LOAD_STATE_WAITING_FOR_CACHE, + context_list[3]->trans->GetLoadState()); + c = context_list[1]; ASSERT_EQ(net::ERR_IO_PENDING, c->result); c->result = c->callback.WaitForResult(); |