Chromium Code Reviews| Index: net/disk_cache/backend_unittest.cc |
| diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc |
| index ca9f5a3a6ac15e54f0fe24928a2fe4124d9c5b2d..8865fddded93f5249fab8481c78d42729175a30f 100644 |
| --- a/net/disk_cache/backend_unittest.cc |
| +++ b/net/disk_cache/backend_unittest.cc |
| @@ -245,17 +245,25 @@ TEST_F(DiskCacheTest, CreateBackend) { |
| MessageLoop::current()->RunUntilIdle(); |
| } |
| -// Testst that re-creating the cache performs the expected cleanup. |
| +// Tests that |BackendImpl| fails to initialize with a missing file. |
| TEST_F(DiskCacheBackendTest, CreateBackend_MissingFile) { |
| ASSERT_TRUE(CopyTestCache("bad_entry")); |
| base::FilePath filename = cache_path_.AppendASCII("data_1"); |
| file_util::Delete(filename, false); |
| - DisableFirstCleanup(); |
| - SetForceCreation(); |
| + base::Thread cache_thread("CacheThread"); |
| + ASSERT_TRUE(cache_thread.StartWithOptions( |
| + base::Thread::Options(MessageLoop::TYPE_IO, 0))); |
| + net::TestCompletionCallback cb; |
| bool prev = base::ThreadRestrictions::SetIOAllowed(false); |
| - InitDefaultCacheViaCreator(); |
| + disk_cache::BackendImpl* cache = new disk_cache::BackendImpl( |
| + cache_path_, cache_thread.message_loop_proxy(), NULL); |
| + int rv = cache->Init(cb.callback()); |
| + ASSERT_EQ(net::ERR_FAILED, cb.GetResult(rv)); |
| base::ThreadRestrictions::SetIOAllowed(prev); |
| + |
| + delete cache; |
| + DisableIntegrityCheck(); |
| } |
| TEST_F(DiskCacheBackendTest, ExternalFiles) { |
| @@ -1541,7 +1549,10 @@ TEST_F(DiskCacheTest, WrongVersion) { |
| // Tests that the cache is properly restarted on recovery error. |
| TEST_F(DiskCacheBackendTest, DeleteOld) { |
| ASSERT_TRUE(CopyTestCache("wrong_version")); |
| - InitDefaultCacheViaCreator(); |
| + SetNewEviction(); |
| + bool prev = base::ThreadRestrictions::SetIOAllowed(false); |
| + CreateCacheViaPublicInterface(); |
|
rvargas (doing something else)
2013/04/03 17:44:22
I think the test would be more clear if it is expl
pasko-google - do not use
2013/04/03 18:12:30
Done.
|
| + base::ThreadRestrictions::SetIOAllowed(prev); |
| } |
| // We want to be able to deal with messed up entries on disk. |