diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 21:41:54 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-30 21:41:54 +0000 |
commit | a9da16d0e7aa10ad2f4ee3290edc361b862e6314 (patch) | |
tree | a5ecba94190bd01ae479f7274d450296ad241f11 /net/disk_cache/backend_impl.cc | |
parent | 01e9c8a645db02edb5b0c8b33ff091f55b47dbd5 (diff) | |
download | chromium_src-a9da16d0e7aa10ad2f4ee3290edc361b862e6314.zip chromium_src-a9da16d0e7aa10ad2f4ee3290edc361b862e6314.tar.gz chromium_src-a9da16d0e7aa10ad2f4ee3290edc361b862e6314.tar.bz2 |
Add unit tests to the disk cache to verify that a failure during cache reinitialization is handled properly.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r-- | net/disk_cache/backend_impl.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 790b618..7810a97 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -1037,7 +1037,10 @@ void BackendImpl::RestartCache() { init_ = false; restarted_ = true; int64 errors = stats_.GetCounter(Stats::FATAL_ERROR); - if (Init()) + + // Don't call Init() if directed by the unit test: we are simulating a failure + // trying to re-enable the cache. + if (!unit_test_ && Init()) stats_.SetCounter(Stats::FATAL_ERROR, errors + 1); } |