| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <limits> | 5 #include <limits> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 class DiskCachePerfTest : public DiskCacheTestWithCache { | 56 class DiskCachePerfTest : public DiskCacheTestWithCache { |
| 57 public: | 57 public: |
| 58 DiskCachePerfTest() : saved_fd_limit_(MaybeGetMaxFds()) { | 58 DiskCachePerfTest() : saved_fd_limit_(MaybeGetMaxFds()) { |
| 59 if (saved_fd_limit_ < kFdLimitForCacheTests) | 59 if (saved_fd_limit_ < kFdLimitForCacheTests) |
| 60 MaybeSetFdLimit(kFdLimitForCacheTests); | 60 MaybeSetFdLimit(kFdLimitForCacheTests); |
| 61 } | 61 } |
| 62 | 62 |
| 63 ~DiskCachePerfTest() override { | 63 ~DiskCachePerfTest() override { |
| 64 if (saved_fd_limit_ < kFdLimitForCacheTests) | 64 if (saved_fd_limit_ < kFdLimitForCacheTests) |
| 65 MaybeSetFdLimit(kFdLimitForCacheTests); | 65 MaybeSetFdLimit(saved_fd_limit_); |
| 66 } | 66 } |
| 67 | 67 |
| 68 protected: | 68 protected: |
| 69 enum class WhatToRead { | 69 enum class WhatToRead { |
| 70 HEADERS_ONLY, | 70 HEADERS_ONLY, |
| 71 HEADERS_AND_BODY, | 71 HEADERS_AND_BODY, |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // Helper methods for constructing tests. | 74 // Helper methods for constructing tests. |
| 75 bool TimeWrite(); | 75 bool TimeWrite(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 files.DeleteBlock(address[entry], false); | 299 files.DeleteBlock(address[entry], false); |
| 300 EXPECT_TRUE( | 300 EXPECT_TRUE( |
| 301 files.CreateBlock(disk_cache::RANKINGS, block_size, &address[entry])); | 301 files.CreateBlock(disk_cache::RANKINGS, block_size, &address[entry])); |
| 302 } | 302 } |
| 303 | 303 |
| 304 timer2.Done(); | 304 timer2.Done(); |
| 305 base::RunLoop().RunUntilIdle(); | 305 base::RunLoop().RunUntilIdle(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 } // namespace | 308 } // namespace |
| OLD | NEW |