OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 4247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4258 entry->Close(); | 4258 entry->Close(); |
4259 | 4259 |
4260 base::RunLoop().RunUntilIdle(); | 4260 base::RunLoop().RunUntilIdle(); |
4261 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); | 4261 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
4262 base::RunLoop().RunUntilIdle(); | 4262 base::RunLoop().RunUntilIdle(); |
4263 | 4263 |
4264 EXPECT_TRUE( | 4264 EXPECT_TRUE( |
4265 disk_cache::simple_util::CorruptKeySHA256FromEntry(key, cache_path_)); | 4265 disk_cache::simple_util::CorruptKeySHA256FromEntry(key, cache_path_)); |
4266 EXPECT_NE(net::OK, OpenEntry(key, &entry)); | 4266 EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
4267 } | 4267 } |
| 4268 |
| 4269 TEST_F(DiskCacheEntryTest, SimpleCacheReadCorruptLength) { |
| 4270 SetCacheType(net::APP_CACHE); |
| 4271 SetSimpleCacheMode(); |
| 4272 InitCache(); |
| 4273 disk_cache::Entry* entry; |
| 4274 std::string key("a key"); |
| 4275 ASSERT_EQ(net::OK, CreateEntry(key, &entry)); |
| 4276 entry->Close(); |
| 4277 |
| 4278 base::RunLoop().RunUntilIdle(); |
| 4279 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
| 4280 base::RunLoop().RunUntilIdle(); |
| 4281 |
| 4282 EXPECT_TRUE( |
| 4283 disk_cache::simple_util::CorruptStream0LengthFromEntry(key, cache_path_)); |
| 4284 EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
| 4285 } |
OLD | NEW |