summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_unittest.cc
diff options
context:
space:
mode:
authorxeor@yandex-team.ru <xeor@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 11:33:03 +0000
committerxeor@yandex-team.ru <xeor@yandex-team.ru@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-18 11:33:03 +0000
commit1d6fe0725c9668d125cea07917da95bb09e8e1af (patch)
tree35d2896dd1411d0af523f58e001bc0c9053b018b /net/disk_cache/backend_unittest.cc
parentc8fd6c4afeee1e4eeb90d8699eb803be19dee4f3 (diff)
downloadchromium_src-1d6fe0725c9668d125cea07917da95bb09e8e1af.zip
chromium_src-1d6fe0725c9668d125cea07917da95bb09e8e1af.tar.gz
chromium_src-1d6fe0725c9668d125cea07917da95bb09e8e1af.tar.bz2
Changed BackendImpl::SyncInit() so it creates timer only
if the initialization is completed successfully. This should prevent the timer code from running if the object is only partially initialized. Review URL: https://codereview.chromium.org/98563004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241539 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_unittest.cc')
-rw-r--r--net/disk_cache/backend_unittest.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index b25001f..156f206 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -2721,6 +2721,21 @@ TEST_F(DiskCacheTest, Backend_UsageStatsTimer) {
helper.WaitUntilCacheIoFinished(1);
}
+TEST_F(DiskCacheBackendTest, TimerNotCreated) {
+ ASSERT_TRUE(CopyTestCache("wrong_version"));
+
+ scoped_ptr<disk_cache::BackendImpl> cache;
+ cache.reset(new disk_cache::BackendImpl(
+ cache_path_, base::MessageLoopProxy::current().get(), NULL));
+ ASSERT_TRUE(NULL != cache.get());
+ cache->SetUnitTestMode();
+ ASSERT_NE(net::OK, cache->SyncInit());
+
+ ASSERT_TRUE(NULL == cache->GetTimerForTest());
+
+ DisableIntegrityCheck();
+}
+
TEST_F(DiskCacheBackendTest, Backend_UsageStats) {
InitCache();
disk_cache::Entry* entry;