diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-29 18:38:57 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-29 18:38:57 +0000 |
commit | 9f4633c617ef393ba4709cba7d8fa23101b64025 (patch) | |
tree | 3084271ab8a071f85855132836626498157ec660 /net/http | |
parent | 4e1e97a61e86320a3c486b200b242e822573a52c (diff) | |
download | chromium_src-9f4633c617ef393ba4709cba7d8fa23101b64025.zip chromium_src-9f4633c617ef393ba4709cba7d8fa23101b64025.tar.gz chromium_src-9f4633c617ef393ba4709cba7d8fa23101b64025.tar.bz2 |
Http cache: Test deleting an entry with a pending_entry when
adding the truncated flag.
BUG=125159
TEST=net_unittests
Review URL: https://chromiumcodereview.appspot.com/10356113
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r-- | net/http/http_cache_unittest.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index dbf0c0f..08065f6 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -4046,7 +4046,17 @@ TEST(HttpCache, GET_IncompleteResource_Cancel) { int rv = cache.http_cache()->CreateTransaction(&c->trans); EXPECT_EQ(net::OK, rv); + // Queue another request to this transaction. We have to start this request + // before the first one gets the response from the server and dooms the entry, + // otherwise it will just create a new entry without being queued to the first + // request. + Context* pending = new Context(); + EXPECT_EQ(net::OK, cache.http_cache()->CreateTransaction(&pending->trans)); + rv = c->trans->Start(&request, c->callback.callback(), net::BoundNetLog()); + EXPECT_EQ(net::ERR_IO_PENDING, + pending->trans->Start(&request, pending->callback.callback(), + net::BoundNetLog())); EXPECT_EQ(net::OK, c->callback.GetResult(rv)); // Make sure that the entry has some data stored. @@ -4054,16 +4064,14 @@ TEST(HttpCache, GET_IncompleteResource_Cancel) { rv = c->trans->Read(buf, buf->size(), c->callback.callback()); EXPECT_EQ(5, c->callback.GetResult(rv)); - // Cancel the request. + // Cancel the requests. delete c; + delete pending; EXPECT_EQ(1, cache.network_layer()->transaction_count()); EXPECT_EQ(1, cache.disk_cache()->open_count()); - EXPECT_EQ(1, cache.disk_cache()->create_count()); + EXPECT_EQ(2, cache.disk_cache()->create_count()); - // Verify that the disk entry was deleted. - disk_cache::Entry* entry; - EXPECT_FALSE(cache.OpenBackendEntry(kRangeGET_TransactionOK.url, &entry)); MessageLoop::current()->RunAllPending(); RemoveMockTransaction(&transaction); } |