Skip to content

Commit

Permalink
Fix three Windows base_unittests to not require admin
Browse files Browse the repository at this point in the history
These three base_unittests tests fail when run as non-admin on Windows
if %temp% is set to a non-standard location such as d:\src\temp:

- FileTest.GetInfoForDirectory
- FileUtilTest.FileEnumeratorTest
- FileUtilTest.NormalizeFilePathReparsePoints

They all fail because the default user doesn't have enough permissions
to open the directories with FILE_ALL_ACCESS.

Asking for fewer permissions allows the tests to pass regardless of
user-type and %temp% location.

R=rvargas@chromium.org
BUG=533018

Review URL: https://codereview.chromium.org/1348533003

Cr-Commit-Position: refs/heads/master@{#349485}
  • Loading branch information
randomascii authored and Commit bot committed Sep 17, 2015
1 parent 9435a3a commit 35b35d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/files/file_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ TEST(FileTest, GetInfoForDirectory) {

base::File dir(
::CreateFile(empty_dir.value().c_str(),
FILE_ALL_ACCESS,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
Expand Down
2 changes: 1 addition & 1 deletion base/files/file_util_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ReparsePoint {
ReparsePoint(const FilePath& source, const FilePath& target) {
dir_.Set(
::CreateFile(source.value().c_str(),
FILE_ALL_ACCESS,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
Expand Down

0 comments on commit 35b35d8

Please sign in to comment.