| 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 "net/disk_cache/disk_cache_test_util.h" | 5 #include "net/disk_cache/disk_cache_test_util.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "net/disk_cache/backend_impl.h" | 9 #include "net/disk_cache/backend_impl.h" |
| 10 #include "net/disk_cache/cache_util.h" | 10 #include "net/disk_cache/cache_util.h" |
| 11 #include "net/disk_cache/file.h" | 11 #include "net/disk_cache/file.h" |
| 12 | 12 |
| 13 using base::Time; |
| 14 using base::TimeDelta; |
| 15 |
| 13 std::string GenerateKey(bool same_length) { | 16 std::string GenerateKey(bool same_length) { |
| 14 char key[200]; | 17 char key[200]; |
| 15 CacheTestFillBuffer(key, sizeof(key), same_length); | 18 CacheTestFillBuffer(key, sizeof(key), same_length); |
| 16 | 19 |
| 17 key[199] = '\0'; | 20 key[199] = '\0'; |
| 18 return std::string(key); | 21 return std::string(key); |
| 19 } | 22 } |
| 20 | 23 |
| 21 void CacheTestFillBuffer(char* buffer, size_t len, bool no_nulls) { | 24 void CacheTestFillBuffer(char* buffer, size_t len, bool no_nulls) { |
| 22 static bool called = false; | 25 static bool called = false; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } else { | 129 } else { |
| 127 // Not finished yet. See if we have to abort. | 130 // Not finished yet. See if we have to abort. |
| 128 if (last_ == g_cache_tests_received) | 131 if (last_ == g_cache_tests_received) |
| 129 num_iterations_++; | 132 num_iterations_++; |
| 130 else | 133 else |
| 131 last_ = g_cache_tests_received; | 134 last_ = g_cache_tests_received; |
| 132 if (40 == num_iterations_) | 135 if (40 == num_iterations_) |
| 133 MessageLoop::current()->Quit(); | 136 MessageLoop::current()->Quit(); |
| 134 } | 137 } |
| 135 } | 138 } |
| OLD | NEW |