| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |