Commit 603a07f3 authored by dkegel@google.com's avatar dkegel@google.com

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
parent fd1e44cd
...@@ -1356,8 +1356,16 @@ TEST_F(DiskCacheEntryTest, CancelSparseIO) { ...@@ -1356,8 +1356,16 @@ TEST_F(DiskCacheEntryTest, CancelSparseIO) {
SimpleCallbackTest cb1, cb2, cb3, cb4; SimpleCallbackTest cb1, cb2, cb3, cb4;
int64 offset = 0; 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); 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. // Cannot use the entry at this point.
offset = 0; offset = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment