Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(505)

Side by Side Diff: net/disk_cache/backend_unittest.cc

Issue 113931: Remove code path that passes a file handle to the renderer... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/load_flags.h ('k') | net/disk_cache/disk_cache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/file_util.h" 6 #include "base/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/platform_thread.h" 8 #include "base/platform_thread.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 BackendDoomAll(); 1240 BackendDoomAll();
1241 } 1241 }
1242 1242
1243 // We should be able to create the same entry on multiple simultaneous instances 1243 // We should be able to create the same entry on multiple simultaneous instances
1244 // of the cache. 1244 // of the cache.
1245 TEST_F(DiskCacheTest, MultipleInstances) { 1245 TEST_F(DiskCacheTest, MultipleInstances) {
1246 ScopedTestCache store1; 1246 ScopedTestCache store1;
1247 ScopedTestCache store2(L"cache_test2"); 1247 ScopedTestCache store2(L"cache_test2");
1248 ScopedTestCache store3(L"cache_test3"); 1248 ScopedTestCache store3(L"cache_test3");
1249 1249
1250 const int kNumberOfCaches = 3; 1250 const int kNumberOfCaches = 2;
1251 scoped_ptr<disk_cache::Backend> cache[kNumberOfCaches]; 1251 scoped_ptr<disk_cache::Backend> cache[kNumberOfCaches];
1252 1252
1253 cache[0].reset(disk_cache::CreateCacheBackend(store1.path_wstring(), false, 0, 1253 cache[0].reset(disk_cache::CreateCacheBackend(store1.path_wstring(), false, 0,
1254 net::DISK_CACHE)); 1254 net::DISK_CACHE));
1255 cache[1].reset(disk_cache::CreateCacheBackend(store2.path_wstring(), false, 0, 1255 cache[1].reset(disk_cache::CreateCacheBackend(store2.path_wstring(), false, 0,
1256 net::MEDIA_CACHE)); 1256 net::MEDIA_CACHE));
1257 cache[2].reset(disk_cache::CreateCacheBackend(store3.path_wstring(), false, 0,
1258 net::TEMP_MEDIA_CACHE));
1259 1257
1260 ASSERT_TRUE(cache[0].get() != NULL && cache[1].get() != NULL && 1258 ASSERT_TRUE(cache[0].get() != NULL && cache[1].get() != NULL);
1261 cache[2].get() != NULL);
1262 1259
1263 std::string key("the first key"); 1260 std::string key("the first key");
1264 disk_cache::Entry* entry; 1261 disk_cache::Entry* entry;
1265 for (int i = 0; i < kNumberOfCaches; i++) { 1262 for (int i = 0; i < kNumberOfCaches; i++) {
1266 ASSERT_TRUE(cache[i]->CreateEntry(key, &entry)); 1263 ASSERT_TRUE(cache[i]->CreateEntry(key, &entry));
1267 entry->Close(); 1264 entry->Close();
1268 } 1265 }
1269 } 1266 }
1270 1267
1271 // Test the four regions of the curve that determines the max cache size. 1268 // Test the four regions of the curve that determines the max cache size.
(...skipping 18 matching lines...) Expand all
1290 EXPECT_EQ(kDefaultSize * 5 / 2, 1287 EXPECT_EQ(kDefaultSize * 5 / 2,
1291 disk_cache::PreferedCacheSize(large_size * 100 / 2)); 1288 disk_cache::PreferedCacheSize(large_size * 100 / 2));
1292 EXPECT_EQ(kDefaultSize * 5 / 2, 1289 EXPECT_EQ(kDefaultSize * 5 / 2,
1293 disk_cache::PreferedCacheSize(large_size * 500 / 2)); 1290 disk_cache::PreferedCacheSize(large_size * 500 / 2));
1294 1291
1295 EXPECT_EQ(kDefaultSize * 6 / 2, 1292 EXPECT_EQ(kDefaultSize * 6 / 2,
1296 disk_cache::PreferedCacheSize(large_size * 600 / 2)); 1293 disk_cache::PreferedCacheSize(large_size * 600 / 2));
1297 EXPECT_EQ(kDefaultSize * 7 / 2, 1294 EXPECT_EQ(kDefaultSize * 7 / 2,
1298 disk_cache::PreferedCacheSize(large_size * 700 / 2)); 1295 disk_cache::PreferedCacheSize(large_size * 700 / 2));
1299 } 1296 }
OLDNEW
« no previous file with comments | « net/base/load_flags.h ('k') | net/disk_cache/disk_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698