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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "base/timer.h" | 10 #include "base/timer.h" |
(...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1995 } | 1995 } |
1996 | 1996 |
1997 TEST_F(DiskCacheEntryTest, MemoryPartialSparseEntry) { | 1997 TEST_F(DiskCacheEntryTest, MemoryPartialSparseEntry) { |
1998 SetMemoryOnlyMode(); | 1998 SetMemoryOnlyMode(); |
1999 InitCache(); | 1999 InitCache(); |
2000 PartialSparseEntry(); | 2000 PartialSparseEntry(); |
2001 } | 2001 } |
2002 | 2002 |
2003 // Tests that corrupt sparse children are removed automatically. | 2003 // Tests that corrupt sparse children are removed automatically. |
2004 TEST_F(DiskCacheEntryTest, CleanupSparseEntry) { | 2004 TEST_F(DiskCacheEntryTest, CleanupSparseEntry) { |
2005 SetDirectMode(); | |
2005 InitCache(); | 2006 InitCache(); |
2007 cache_impl_->ClearIndexBitmapForTest(); | |
rvargas (doing something else)
2013/02/12 01:58:33
why is this needed?
| |
2008 | |
2006 std::string key("the first key"); | 2009 std::string key("the first key"); |
2007 disk_cache::Entry* entry; | 2010 disk_cache::Entry* entry; |
2008 ASSERT_EQ(net::OK, CreateEntry(key, &entry)); | 2011 ASSERT_EQ(net::OK, CreateEntry(key, &entry)); |
2009 | 2012 |
2010 const int kSize = 4 * 1024; | 2013 const int kSize = 4 * 1024; |
2011 scoped_refptr<net::IOBuffer> buf1(new net::IOBuffer(kSize)); | 2014 scoped_refptr<net::IOBuffer> buf1(new net::IOBuffer(kSize)); |
2012 CacheTestFillBuffer(buf1->data(), kSize, false); | 2015 CacheTestFillBuffer(buf1->data(), kSize, false); |
2013 | 2016 |
2014 const int k1Meg = 1024 * 1024; | 2017 const int k1Meg = 1024 * 1024; |
2015 EXPECT_EQ(kSize, WriteSparseData(entry, 8192, buf1, kSize)); | 2018 EXPECT_EQ(kSize, WriteSparseData(entry, 8192, buf1, kSize)); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2124 store->key_len = 800; | 2127 store->key_len = 800; |
2125 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size()); | 2128 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size()); |
2126 entry_impl->entry()->set_modified(); | 2129 entry_impl->entry()->set_modified(); |
2127 entry->Close(); | 2130 entry->Close(); |
2128 | 2131 |
2129 // We have a corrupt entry. Now reload it. We should NOT read beyond the | 2132 // We have a corrupt entry. Now reload it. We should NOT read beyond the |
2130 // allocated buffer here. | 2133 // allocated buffer here. |
2131 ASSERT_NE(net::OK, OpenEntry(key, &entry)); | 2134 ASSERT_NE(net::OK, OpenEntry(key, &entry)); |
2132 DisableIntegrityCheck(); | 2135 DisableIntegrityCheck(); |
2133 } | 2136 } |
OLD | NEW |