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

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

Issue 18286004: Move PathExists to 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/process/memory_linux.cc ('k') | base/win/shortcut.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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 113
114 } // namespace 114 } // namespace
115 115
116 bool DieFileDie(const base::FilePath& file, bool recurse) { 116 bool DieFileDie(const base::FilePath& file, bool recurse) {
117 // It turns out that to not induce flakiness a long timeout is needed. 117 // It turns out that to not induce flakiness a long timeout is needed.
118 const int kIterations = 25; 118 const int kIterations = 25;
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 (!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::Delete(file, recurse))
130 return true; 130 return true;
131 base::PlatformThread::Sleep(kTimeout); 131 base::PlatformThread::Sleep(kTimeout);
132 } 132 }
(...skipping 149 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/process/memory_linux.cc ('k') | base/win/shortcut.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698