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 4256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4267 entry->Close(); | 4267 entry->Close(); |
4268 | 4268 |
4269 base::RunLoop().RunUntilIdle(); | 4269 base::RunLoop().RunUntilIdle(); |
4270 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); | 4270 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
4271 base::RunLoop().RunUntilIdle(); | 4271 base::RunLoop().RunUntilIdle(); |
4272 | 4272 |
4273 EXPECT_TRUE( | 4273 EXPECT_TRUE( |
4274 disk_cache::simple_util::CorruptKeySHA256FromEntry(key, cache_path_)); | 4274 disk_cache::simple_util::CorruptKeySHA256FromEntry(key, cache_path_)); |
4275 EXPECT_NE(net::OK, OpenEntry(key, &entry)); | 4275 EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
4276 } | 4276 } |
| 4277 |
| 4278 TEST_F(DiskCacheEntryTest, SimpleCacheReadCorruptLength) { |
| 4279 SetCacheType(net::APP_CACHE); |
| 4280 SetSimpleCacheMode(); |
| 4281 InitCache(); |
| 4282 disk_cache::Entry* entry; |
| 4283 std::string key("a key"); |
| 4284 ASSERT_EQ(net::OK, CreateEntry(key, &entry)); |
| 4285 entry->Close(); |
| 4286 |
| 4287 base::RunLoop().RunUntilIdle(); |
| 4288 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
| 4289 base::RunLoop().RunUntilIdle(); |
| 4290 |
| 4291 EXPECT_TRUE( |
| 4292 disk_cache::simple_util::CorruptStream0LengthFromEntry(key, cache_path_)); |
| 4293 EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
| 4294 } |
OLD | NEW |