Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: base/test/test_file_util_win.cc

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/test/task_runner_test_template.h ('k') | base/test/test_mock_time_task_runner.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // WriteFile will fail if we provide a buffer size that isn't a 168 // WriteFile will fail if we provide a buffer size that isn't a
169 // sector multiple, so we'll have to write the entire buffer with 169 // sector multiple, so we'll have to write the entire buffer with
170 // padded zeros and then use SetEndOfFile to truncate the file. 170 // padded zeros and then use SetEndOfFile to truncate the file.
171 ZeroMemory(buffer + bytes_read, kOneMB - bytes_read); 171 ZeroMemory(buffer + bytes_read, kOneMB - bytes_read);
172 file_is_aligned = false; 172 file_is_aligned = false;
173 } 173 }
174 174
175 // Move back to the position we just read from. 175 // Move back to the position we just read from.
176 // Note that SetFilePointer will also fail if total_bytes isn't sector 176 // Note that SetFilePointer will also fail if total_bytes isn't sector
177 // aligned, but that shouldn't happen here. 177 // aligned, but that shouldn't happen here.
178 DCHECK((total_bytes % kOneMB) == 0); 178 DCHECK_EQ(total_bytes % kOneMB, 0);
179 SetFilePointer(file_handle.Get(), total_bytes, NULL, FILE_BEGIN); 179 SetFilePointer(file_handle.Get(), total_bytes, NULL, FILE_BEGIN);
180 if (!::WriteFile(file_handle.Get(), buffer, kOneMB, &bytes_written, NULL) || 180 if (!::WriteFile(file_handle.Get(), buffer, kOneMB, &bytes_written, NULL) ||
181 bytes_written != kOneMB) { 181 bytes_written != kOneMB) {
182 BOOL freed = VirtualFree(buffer, 0, MEM_RELEASE); 182 BOOL freed = VirtualFree(buffer, 0, MEM_RELEASE);
183 DCHECK(freed); 183 DCHECK(freed);
184 NOTREACHED(); 184 NOTREACHED();
185 return false; 185 return false;
186 } 186 }
187 187
188 total_bytes += bytes_read; 188 total_bytes += bytes_read;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 DCHECK(info_ != NULL); 273 DCHECK(info_ != NULL);
274 DCHECK_NE(0u, length_); 274 DCHECK_NE(0u, length_);
275 } 275 }
276 276
277 FilePermissionRestorer::~FilePermissionRestorer() { 277 FilePermissionRestorer::~FilePermissionRestorer() {
278 if (!RestorePermissionInfo(path_, info_, length_)) 278 if (!RestorePermissionInfo(path_, info_, length_))
279 NOTREACHED(); 279 NOTREACHED();
280 } 280 }
281 281
282 } // namespace base 282 } // namespace base
OLDNEW
« no previous file with comments | « base/test/task_runner_test_template.h ('k') | base/test/test_mock_time_task_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698