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

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

Issue 261045: Start migrating the disk cache to using FilePath. (Closed)
Patch Set: rebase Created 11 years, 2 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
« no previous file with comments | « net/disk_cache/backend_impl.cc ('k') | net/disk_cache/cache_util.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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 InitCache(); 1424 InitCache();
1425 BackendDisable4(); 1425 BackendDisable4();
1426 } 1426 }
1427 1427
1428 TEST_F(DiskCacheTest, Backend_UsageStats) { 1428 TEST_F(DiskCacheTest, Backend_UsageStats) {
1429 MessageLoopHelper helper; 1429 MessageLoopHelper helper;
1430 1430
1431 std::wstring path = GetCachePath(); 1431 std::wstring path = GetCachePath();
1432 ASSERT_TRUE(DeleteCache(path.c_str())); 1432 ASSERT_TRUE(DeleteCache(path.c_str()));
1433 scoped_ptr<disk_cache::BackendImpl> cache; 1433 scoped_ptr<disk_cache::BackendImpl> cache;
1434 cache.reset(new disk_cache::BackendImpl(path)); 1434 cache.reset(new disk_cache::BackendImpl(FilePath::FromWStringHack(path)));
1435 ASSERT_TRUE(NULL != cache.get()); 1435 ASSERT_TRUE(NULL != cache.get());
1436 cache->SetUnitTestMode(); 1436 cache->SetUnitTestMode();
1437 ASSERT_TRUE(cache->Init()); 1437 ASSERT_TRUE(cache->Init());
1438 1438
1439 // Wait for a callback that never comes... about 2 secs :). The message loop 1439 // Wait for a callback that never comes... about 2 secs :). The message loop
1440 // has to run to allow invocation of the usage timer. 1440 // has to run to allow invocation of the usage timer.
1441 helper.WaitUntilCacheIoFinished(1); 1441 helper.WaitUntilCacheIoFinished(1);
1442 } 1442 }
1443 1443
1444 void DiskCacheBackendTest::BackendDoomAll() { 1444 void DiskCacheBackendTest::BackendDoomAll() {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 EXPECT_EQ(kDefaultSize * 5 / 2, 1572 EXPECT_EQ(kDefaultSize * 5 / 2,
1573 disk_cache::PreferedCacheSize(large_size * 100 / 2)); 1573 disk_cache::PreferedCacheSize(large_size * 100 / 2));
1574 EXPECT_EQ(kDefaultSize * 5 / 2, 1574 EXPECT_EQ(kDefaultSize * 5 / 2,
1575 disk_cache::PreferedCacheSize(large_size * 500 / 2)); 1575 disk_cache::PreferedCacheSize(large_size * 500 / 2));
1576 1576
1577 EXPECT_EQ(kDefaultSize * 6 / 2, 1577 EXPECT_EQ(kDefaultSize * 6 / 2,
1578 disk_cache::PreferedCacheSize(large_size * 600 / 2)); 1578 disk_cache::PreferedCacheSize(large_size * 600 / 2));
1579 EXPECT_EQ(kDefaultSize * 7 / 2, 1579 EXPECT_EQ(kDefaultSize * 7 / 2,
1580 disk_cache::PreferedCacheSize(large_size * 700 / 2)); 1580 disk_cache::PreferedCacheSize(large_size * 700 / 2));
1581 } 1581 }
OLDNEW
« no previous file with comments | « net/disk_cache/backend_impl.cc ('k') | net/disk_cache/cache_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698