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 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 store->key_len = 800; | 2111 store->key_len = 800; |
2112 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size()); | 2112 memset(store->key + key.size(), 'k', sizeof(store->key) - key.size()); |
2113 entry_impl->entry()->set_modified(); | 2113 entry_impl->entry()->set_modified(); |
2114 entry->Close(); | 2114 entry->Close(); |
2115 | 2115 |
2116 // We have a corrupt entry. Now reload it. We should NOT read beyond the | 2116 // We have a corrupt entry. Now reload it. We should NOT read beyond the |
2117 // allocated buffer here. | 2117 // allocated buffer here. |
2118 ASSERT_NE(net::OK, OpenEntry(key, &entry)); | 2118 ASSERT_NE(net::OK, OpenEntry(key, &entry)); |
2119 DisableIntegrityCheck(); | 2119 DisableIntegrityCheck(); |
2120 } | 2120 } |
| 2121 |
| 2122 // The simple cache backend isn't intended to work on windows, which has very |
| 2123 // different file system guarantees from Windows. |
| 2124 #if !defined(OS_WIN) |
| 2125 |
| 2126 TEST_F(DiskCacheEntryTest, SimpleCacheInternalAsyncIO) { |
| 2127 SetSimpleCacheMode(); |
| 2128 InitCache(); |
| 2129 InternalAsyncIO(); |
| 2130 } |
| 2131 |
| 2132 TEST_F(DiskCacheEntryTest, SimpleCacheExternalAsyncIO) { |
| 2133 SetSimpleCacheMode(); |
| 2134 InitCache(); |
| 2135 ExternalAsyncIO(); |
| 2136 } |
| 2137 |
| 2138 TEST_F(DiskCacheEntryTest, SimpleCacheReleaseBuffer) { |
| 2139 SetSimpleCacheMode(); |
| 2140 InitCache(); |
| 2141 ReleaseBuffer(); |
| 2142 } |
| 2143 |
| 2144 TEST_F(DiskCacheEntryTest, SimpleCacheStreamAccess) { |
| 2145 SetSimpleCacheMode(); |
| 2146 InitCache(); |
| 2147 StreamAccess(); |
| 2148 } |
| 2149 |
| 2150 TEST_F(DiskCacheEntryTest, SimpleCacheGetKey) { |
| 2151 SetSimpleCacheMode(); |
| 2152 InitCache(); |
| 2153 GetKey(); |
| 2154 } |
| 2155 |
| 2156 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheGetTimes) { |
| 2157 SetSimpleCacheMode(); |
| 2158 InitCache(); |
| 2159 GetTimes(); |
| 2160 } |
| 2161 |
| 2162 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheGrowData) { |
| 2163 SetSimpleCacheMode(); |
| 2164 InitCache(); |
| 2165 GrowData(); |
| 2166 } |
| 2167 |
| 2168 TEST_F(DiskCacheEntryTest, SimpleCacheTruncateData) { |
| 2169 SetSimpleCacheMode(); |
| 2170 InitCache(); |
| 2171 TruncateData(); |
| 2172 } |
| 2173 |
| 2174 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheZeroLengthIO) { |
| 2175 SetSimpleCacheMode(); |
| 2176 InitCache(); |
| 2177 ZeroLengthIO(); |
| 2178 } |
| 2179 |
| 2180 TEST_F(DiskCacheEntryTest, SimpleCacheReuseExternalEntry) { |
| 2181 SetSimpleCacheMode(); |
| 2182 SetMaxSize(200 * 1024); |
| 2183 InitCache(); |
| 2184 ReuseEntry(20 * 1024); |
| 2185 } |
| 2186 |
| 2187 TEST_F(DiskCacheEntryTest, SimpleCacheReuseInternalEntry) { |
| 2188 SetSimpleCacheMode(); |
| 2189 SetMaxSize(100 * 1024); |
| 2190 InitCache(); |
| 2191 ReuseEntry(10 * 1024); |
| 2192 } |
| 2193 |
| 2194 TEST_F(DiskCacheEntryTest, SimpleCacheInvalidData) { |
| 2195 SetSimpleCacheMode(); |
| 2196 InitCache(); |
| 2197 InvalidData(); |
| 2198 } |
| 2199 |
| 2200 TEST_F(DiskCacheEntryTest, SimpleCacheDoomEntry) { |
| 2201 SetSimpleCacheMode(); |
| 2202 InitCache(); |
| 2203 DoomNormalEntry(); |
| 2204 } |
| 2205 |
| 2206 TEST_F(DiskCacheEntryTest, SimpleCacheDoomedEntry) { |
| 2207 SetSimpleCacheMode(); |
| 2208 InitCache(); |
| 2209 DoomedEntry(); |
| 2210 } |
| 2211 |
| 2212 #endif // !defined(OS_WIN) |
OLD | NEW |