| 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 <fcntl.h> | 5 #include <fcntl.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/perftimer.h" | 11 #include "base/perftimer.h" |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include "base/scoped_handle.h" | 13 #include "base/scoped_handle.h" |
| 14 #endif | 14 #endif |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/timer.h" | 16 #include "base/timer.h" |
| 17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
| 18 #include "net/disk_cache/block_files.h" | 18 #include "net/disk_cache/block_files.h" |
| 19 #include "net/disk_cache/disk_cache.h" | 19 #include "net/disk_cache/disk_cache.h" |
| 20 #include "net/disk_cache/disk_cache_test_base.h" | 20 #include "net/disk_cache/disk_cache_test_base.h" |
| 21 #include "net/disk_cache/disk_cache_test_util.h" | 21 #include "net/disk_cache/disk_cache_test_util.h" |
| 22 #include "net/disk_cache/hash.h" | 22 #include "net/disk_cache/hash.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 using base::Time; |
| 26 |
| 25 extern int g_cache_tests_max_id; | 27 extern int g_cache_tests_max_id; |
| 26 extern volatile int g_cache_tests_received; | 28 extern volatile int g_cache_tests_received; |
| 27 extern volatile bool g_cache_tests_error; | 29 extern volatile bool g_cache_tests_error; |
| 28 | 30 |
| 29 namespace { | 31 namespace { |
| 30 | 32 |
| 31 bool EvictFileFromSystemCache(const wchar_t* name) { | 33 bool EvictFileFromSystemCache(const wchar_t* name) { |
| 32 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 33 // Overwrite it with no buffering. | 35 // Overwrite it with no buffering. |
| 34 ScopedHandle file(CreateFile(name, GENERIC_READ | GENERIC_WRITE, | 36 ScopedHandle file(CreateFile(name, GENERIC_READ | GENERIC_WRITE, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 if (entry >= kNumEntries) | 297 if (entry >= kNumEntries) |
| 296 entry = 0; | 298 entry = 0; |
| 297 | 299 |
| 298 files.DeleteBlock(address[entry], false); | 300 files.DeleteBlock(address[entry], false); |
| 299 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(), | 301 EXPECT_TRUE(files.CreateBlock(disk_cache::RANKINGS, BlockSize(), |
| 300 &address[entry])); | 302 &address[entry])); |
| 301 } | 303 } |
| 302 | 304 |
| 303 timer2.Done(); | 305 timer2.Done(); |
| 304 } | 306 } |
| OLD | NEW |