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 | |
pasko-google - do not use
2013/04/17 15:14:46
s/windows/Windows/, also no need to mention Window
gavinp
2013/04/17 15:18:48
Also, windows isn't actually very different from w
felipeg
2013/04/17 15:53:57
Done.
felipeg
2013/04/17 15:53:57
Done.
| |
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 // TODO(felipeg): flaky, failing to WritePlatformFile in | |
2139 // simple_synchronous_entry.cc. It failed in linux_asan bot. | |
2140 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheReleaseBuffer) { | |
2141 SetSimpleCacheMode(); | |
2142 InitCache(); | |
2143 ReleaseBuffer(); | |
2144 } | |
2145 | |
2146 TEST_F(DiskCacheEntryTest, SimpleCacheStreamAccess) { | |
2147 SetSimpleCacheMode(); | |
2148 InitCache(); | |
2149 StreamAccess(); | |
2150 } | |
2151 | |
2152 TEST_F(DiskCacheEntryTest, SimpleCacheGetKey) { | |
2153 SetSimpleCacheMode(); | |
2154 InitCache(); | |
2155 GetKey(); | |
2156 } | |
2157 | |
2158 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheGetTimes) { | |
2159 SetSimpleCacheMode(); | |
2160 InitCache(); | |
2161 GetTimes(); | |
2162 } | |
2163 | |
2164 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheGrowData) { | |
2165 SetSimpleCacheMode(); | |
2166 InitCache(); | |
2167 GrowData(); | |
2168 } | |
2169 | |
2170 TEST_F(DiskCacheEntryTest, SimpleCacheTruncateData) { | |
2171 SetSimpleCacheMode(); | |
2172 InitCache(); | |
2173 TruncateData(); | |
2174 } | |
2175 | |
2176 TEST_F(DiskCacheEntryTest, DISABLED_SimpleCacheZeroLengthIO) { | |
2177 SetSimpleCacheMode(); | |
2178 InitCache(); | |
2179 ZeroLengthIO(); | |
2180 } | |
2181 | |
2182 TEST_F(DiskCacheEntryTest, SimpleCacheReuseExternalEntry) { | |
2183 SetSimpleCacheMode(); | |
2184 SetMaxSize(200 * 1024); | |
2185 InitCache(); | |
2186 ReuseEntry(20 * 1024); | |
2187 } | |
2188 | |
2189 TEST_F(DiskCacheEntryTest, SimpleCacheReuseInternalEntry) { | |
2190 SetSimpleCacheMode(); | |
2191 SetMaxSize(100 * 1024); | |
2192 InitCache(); | |
2193 ReuseEntry(10 * 1024); | |
2194 } | |
2195 | |
2196 TEST_F(DiskCacheEntryTest, SimpleCacheInvalidData) { | |
2197 SetSimpleCacheMode(); | |
2198 InitCache(); | |
2199 InvalidData(); | |
2200 } | |
2201 | |
2202 TEST_F(DiskCacheEntryTest, SimpleCacheDoomEntry) { | |
2203 SetSimpleCacheMode(); | |
2204 InitCache(); | |
2205 DoomNormalEntry(); | |
2206 } | |
2207 | |
2208 TEST_F(DiskCacheEntryTest, SimpleCacheDoomedEntry) { | |
2209 SetSimpleCacheMode(); | |
2210 InitCache(); | |
2211 DoomedEntry(); | |
2212 } | |
2213 | |
2214 #endif // !defined(OS_WIN) | |
OLD | NEW |