| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/test_file_util.h" | 5 #include "base/test/test_file_util.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <aclapi.h> | 8 #include <aclapi.h> |
| 9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 const base::TimeDelta kTimeout = base::TimeDelta::FromSeconds(10) / | 119 const base::TimeDelta kTimeout = base::TimeDelta::FromSeconds(10) / |
| 120 kIterations; | 120 kIterations; |
| 121 | 121 |
| 122 if (!base::PathExists(file)) | 122 if (!base::PathExists(file)) |
| 123 return true; | 123 return true; |
| 124 | 124 |
| 125 // Sometimes Delete fails, so try a few more times. Divide the timeout | 125 // Sometimes Delete fails, so try a few more times. Divide the timeout |
| 126 // into short chunks, so that if a try succeeds, we won't delay the test | 126 // into short chunks, so that if a try succeeds, we won't delay the test |
| 127 // for too long. | 127 // for too long. |
| 128 for (int i = 0; i < kIterations; ++i) { | 128 for (int i = 0; i < kIterations; ++i) { |
| 129 if (base::Delete(file, recurse)) | 129 if (base::DeleteFile(file, recurse)) |
| 130 return true; | 130 return true; |
| 131 base::PlatformThread::Sleep(kTimeout); | 131 base::PlatformThread::Sleep(kTimeout); |
| 132 } | 132 } |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool EvictFileFromSystemCache(const base::FilePath& file) { | 136 bool EvictFileFromSystemCache(const base::FilePath& file) { |
| 137 // Request exclusive access to the file and overwrite it with no buffering. | 137 // Request exclusive access to the file and overwrite it with no buffering. |
| 138 base::win::ScopedHandle file_handle( | 138 base::win::ScopedHandle file_handle( |
| 139 CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, | 139 CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 DCHECK(info_ != NULL); | 282 DCHECK(info_ != NULL); |
| 283 DCHECK_NE(0u, length_); | 283 DCHECK_NE(0u, length_); |
| 284 } | 284 } |
| 285 | 285 |
| 286 PermissionRestorer::~PermissionRestorer() { | 286 PermissionRestorer::~PermissionRestorer() { |
| 287 if (!RestorePermissionInfo(path_, info_, length_)) | 287 if (!RestorePermissionInfo(path_, info_, length_)) |
| 288 NOTREACHED(); | 288 NOTREACHED(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace file_util | 291 } // namespace file_util |
| OLD | NEW |