diff options
author | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-28 00:25:48 +0000 |
---|---|---|
committer | dkegel@google.com <dkegel@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-28 00:25:48 +0000 |
commit | 603a07f3de22e75e6dcc11b45f42861525a7b674 (patch) | |
tree | bad3391ffedf3edcc3ec3ad7fba4d6df217d1de5 | |
parent | fd1e44cd31fc8c90d39479a5fe4bae6019a989b3 (diff) | |
download | chromium_src-603a07f3de22e75e6dcc11b45f42861525a7b674.zip chromium_src-603a07f3de22e75e6dcc11b45f42861525a7b674.tar.gz chromium_src-603a07f3de22e75e6dcc11b45f42861525a7b674.tar.bz2 |
Don't hang during DiskCacheEntryTest.CancelSparseIO on infinitely fast disks.
Review URL: http://codereview.chromium.org/341006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30291 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/disk_cache/entry_unittest.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index f5d440f..ca4d6ed 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -1356,8 +1356,16 @@ TEST_F(DiskCacheEntryTest, CancelSparseIO) { SimpleCallbackTest cb1, cb2, cb3, cb4; int64 offset = 0; - for (int ret = 0; ret != net::ERR_IO_PENDING; offset += kSize * 4) + int tries = 0; + const int maxtries = 100; // Avoid hang on infinitely fast disks + for (int ret = 0; ret != net::ERR_IO_PENDING; offset += kSize * 4) { ret = entry->WriteSparseData(offset, buf, kSize, &cb1); + if (++tries > maxtries) { + LOG(ERROR) << "Data writes never come back PENDING; skipping test"; + entry->Close(); + return; + } + } // Cannot use the entry at this point. offset = 0; |