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

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

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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') | base/win/event_trace_consumer_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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (!file_util::PathExists(file)) 122 if (!file_util::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 (file_util::Delete(file, recurse)) 129 if (base::Delete(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
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
OLDNEW
« no previous file with comments | « base/test/test_file_util_posix.cc ('k') | base/win/event_trace_consumer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698