| Index: base/test/test_file_util_win.cc
|
| diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc
|
| index 94eb3ef66ebeecb176fb22e585d899963f640509..fd22a636d3d9ee6289b22429d93d22653e72445c 100644
|
| --- a/base/test/test_file_util_win.cc
|
| +++ b/base/test/test_file_util_win.cc
|
| @@ -136,12 +136,12 @@ bool EvictFileFromSystemCache(const FilePath& file) {
|
| base::win::ScopedHandle file_handle(
|
| CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
|
| OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
|
| - if (!file_handle)
|
| + if (!file_handle.IsValid())
|
| return false;
|
|
|
| // Get some attributes to restore later.
|
| BY_HANDLE_FILE_INFORMATION bhi = {0};
|
| - CHECK(::GetFileInformationByHandle(file_handle, &bhi));
|
| + CHECK(::GetFileInformationByHandle(file_handle.Get(), &bhi));
|
|
|
| // Execute in chunks. It could be optimized. We want to do few of these since
|
| // these operations will be slow without the cache.
|
| @@ -159,7 +159,7 @@ bool EvictFileFromSystemCache(const FilePath& file) {
|
| DWORD bytes_read, bytes_written;
|
| for (;;) {
|
| bytes_read = 0;
|
| - ::ReadFile(file_handle, buffer, kOneMB, &bytes_read, NULL);
|
| + ::ReadFile(file_handle.Get(), buffer, kOneMB, &bytes_read, NULL);
|
| if (bytes_read == 0)
|
| break;
|
|
|
| @@ -176,8 +176,8 @@ bool EvictFileFromSystemCache(const FilePath& file) {
|
| // Note that SetFilePointer will also fail if total_bytes isn't sector
|
| // aligned, but that shouldn't happen here.
|
| DCHECK((total_bytes % kOneMB) == 0);
|
| - SetFilePointer(file_handle, total_bytes, NULL, FILE_BEGIN);
|
| - if (!::WriteFile(file_handle, buffer, kOneMB, &bytes_written, NULL) ||
|
| + SetFilePointer(file_handle.Get(), total_bytes, NULL, FILE_BEGIN);
|
| + if (!::WriteFile(file_handle.Get(), buffer, kOneMB, &bytes_written, NULL) ||
|
| bytes_written != kOneMB) {
|
| BOOL freed = VirtualFree(buffer, 0, MEM_RELEASE);
|
| DCHECK(freed);
|
| @@ -202,14 +202,14 @@ bool EvictFileFromSystemCache(const FilePath& file) {
|
| file_handle.Set(NULL);
|
| file_handle.Set(CreateFile(file.value().c_str(), GENERIC_WRITE, 0, NULL,
|
| OPEN_EXISTING, 0, NULL));
|
| - CHECK_NE(SetFilePointer(file_handle, total_bytes, NULL, FILE_BEGIN),
|
| + CHECK_NE(SetFilePointer(file_handle.Get(), total_bytes, NULL, FILE_BEGIN),
|
| INVALID_SET_FILE_POINTER);
|
| - CHECK(::SetEndOfFile(file_handle));
|
| + CHECK(::SetEndOfFile(file_handle.Get()));
|
| }
|
|
|
| // Restore the file attributes.
|
| - CHECK(::SetFileTime(file_handle, &bhi.ftCreationTime, &bhi.ftLastAccessTime,
|
| - &bhi.ftLastWriteTime));
|
| + CHECK(::SetFileTime(file_handle.Get(), &bhi.ftCreationTime,
|
| + &bhi.ftLastAccessTime, &bhi.ftLastWriteTime));
|
|
|
| return true;
|
| }
|
|
|