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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/files/file.h" | 7 #include "base/files/file.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 entry->Close(); | 189 entry->Close(); |
190 | 190 |
191 return rv; | 191 return rv; |
192 } | 192 } |
193 | 193 |
194 void DiskCacheBackendTest::InitSparseCache(base::Time* doomed_start, | 194 void DiskCacheBackendTest::InitSparseCache(base::Time* doomed_start, |
195 base::Time* doomed_end) { | 195 base::Time* doomed_end) { |
196 InitCache(); | 196 InitCache(); |
197 | 197 |
198 const int kSize = 50; | 198 const int kSize = 50; |
199 // This must be greater then MemEntryImpl::kMaxSparseEntrySize. | 199 // This must be greater than MemEntryImpl::kMaxSparseEntrySize. |
200 const int kOffset = 10 + 1024 * 1024; | 200 const int kOffset = 10 + 1024 * 1024; |
201 | 201 |
202 disk_cache::Entry* entry0 = NULL; | 202 disk_cache::Entry* entry0 = NULL; |
203 disk_cache::Entry* entry1 = NULL; | 203 disk_cache::Entry* entry1 = NULL; |
204 disk_cache::Entry* entry2 = NULL; | 204 disk_cache::Entry* entry2 = NULL; |
205 | 205 |
206 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); | 206 scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); |
207 CacheTestFillBuffer(buffer->data(), kSize, false); | 207 CacheTestFillBuffer(buffer->data(), kSize, false); |
208 | 208 |
209 ASSERT_THAT(CreateEntry("zeroth", &entry0), IsOk()); | 209 ASSERT_THAT(CreateEntry("zeroth", &entry0), IsOk()); |
(...skipping 3596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3806 // because that would advance the cache directory mtime and invalidate the | 3806 // because that would advance the cache directory mtime and invalidate the |
3807 // index. | 3807 // index. |
3808 entry2->Doom(); | 3808 entry2->Doom(); |
3809 entry2->Close(); | 3809 entry2->Close(); |
3810 | 3810 |
3811 DisableFirstCleanup(); | 3811 DisableFirstCleanup(); |
3812 InitCache(); | 3812 InitCache(); |
3813 EXPECT_EQ(disk_cache::SimpleIndex::INITIALIZE_METHOD_LOADED, | 3813 EXPECT_EQ(disk_cache::SimpleIndex::INITIALIZE_METHOD_LOADED, |
3814 simple_cache_impl_->index()->init_method()); | 3814 simple_cache_impl_->index()->init_method()); |
3815 } | 3815 } |
OLD | NEW |