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

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

Issue 448763003: Remove wstring file path helpers from test_file_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « base/test/test_file_util_posix.cc ('k') | net/base/filename_util_unittest.cc » ('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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 261
262 } // namespace base 262 } // namespace base
263 263
264 namespace file_util { 264 namespace file_util {
265 265
266 using base::DenyFilePermission; 266 using base::DenyFilePermission;
267 using base::GetPermissionInfo; 267 using base::GetPermissionInfo;
268 using base::RestorePermissionInfo; 268 using base::RestorePermissionInfo;
269 269
270 std::wstring FilePathAsWString(const base::FilePath& path) {
271 return path.value();
272 }
273 base::FilePath WStringAsFilePath(const std::wstring& path) {
274 return base::FilePath(path);
275 }
276
277 bool MakeFileUnreadable(const base::FilePath& path) { 270 bool MakeFileUnreadable(const base::FilePath& path) {
278 return DenyFilePermission(path, GENERIC_READ); 271 return DenyFilePermission(path, GENERIC_READ);
279 } 272 }
280 273
281 bool MakeFileUnwritable(const base::FilePath& path) { 274 bool MakeFileUnwritable(const base::FilePath& path) {
282 return DenyFilePermission(path, GENERIC_WRITE); 275 return DenyFilePermission(path, GENERIC_WRITE);
283 } 276 }
284 277
285 PermissionRestorer::PermissionRestorer(const base::FilePath& path) 278 PermissionRestorer::PermissionRestorer(const base::FilePath& path)
286 : path_(path), info_(NULL), length_(0) { 279 : path_(path), info_(NULL), length_(0) {
287 info_ = GetPermissionInfo(path_, &length_); 280 info_ = GetPermissionInfo(path_, &length_);
288 DCHECK(info_ != NULL); 281 DCHECK(info_ != NULL);
289 DCHECK_NE(0u, length_); 282 DCHECK_NE(0u, length_);
290 } 283 }
291 284
292 PermissionRestorer::~PermissionRestorer() { 285 PermissionRestorer::~PermissionRestorer() {
293 if (!RestorePermissionInfo(path_, info_, length_)) 286 if (!RestorePermissionInfo(path_, info_, length_))
294 NOTREACHED(); 287 NOTREACHED();
295 } 288 }
296 289
297 } // namespace file_util 290 } // namespace file_util
OLDNEW
« no previous file with comments | « base/test/test_file_util_posix.cc ('k') | net/base/filename_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698