| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/disk_cache/backend_impl.h" | 11 #include "net/disk_cache/backend_impl.h" |
| 12 #include "net/disk_cache/cache_util.h" | 12 #include "net/disk_cache/cache_util.h" |
| 13 #include "net/disk_cache/file.h" | 13 #include "net/disk_cache/file.h" |
| 14 | 14 |
| 15 using base::Time; | 15 using base::Time; |
| 16 using base::TimeDelta; | 16 using base::TimeDelta; |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 std::wstring BuildCachePath(const std::wstring& name) { | 20 std::wstring BuildCachePath(const std::wstring& name) { |
| 21 FilePath path; | 21 FilePath path; |
| 22 PathService::Get(base::DIR_TEMP, &path); | 22 PathService::Get(base::DIR_TEMP, &path); // Ignore return value; |
| 23 path = path.Append(FilePath::FromWStringHack(name)); | 23 path = path.Append(FilePath::FromWStringHack(name)); |
| 24 if (!file_util::PathExists(path)) | 24 if (!file_util::PathExists(path)) |
| 25 file_util::CreateDirectory(path); | 25 file_util::CreateDirectory(path); |
| 26 | 26 |
| 27 return path.ToWStringHack(); | 27 return path.ToWStringHack(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace. | 30 } // namespace. |
| 31 | 31 |
| 32 std::string GenerateKey(bool same_length) { | 32 std::string GenerateKey(bool same_length) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } else { | 163 } else { |
| 164 // Not finished yet. See if we have to abort. | 164 // Not finished yet. See if we have to abort. |
| 165 if (last_ == g_cache_tests_received) | 165 if (last_ == g_cache_tests_received) |
| 166 num_iterations_++; | 166 num_iterations_++; |
| 167 else | 167 else |
| 168 last_ = g_cache_tests_received; | 168 last_ = g_cache_tests_received; |
| 169 if (40 == num_iterations_) | 169 if (40 == num_iterations_) |
| 170 MessageLoop::current()->Quit(); | 170 MessageLoop::current()->Quit(); |
| 171 } | 171 } |
| 172 } | 172 } |
| OLD | NEW |