| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void CreateFile(const base::FilePath& path) { | 58 void CreateFile(const base::FilePath& path) { |
| 59 #if defined(OS_POSIX) | 59 #if defined(OS_POSIX) |
| 60 int fd = HANDLE_EINTR(creat(path.value().c_str(), 0644)); | 60 int fd = HANDLE_EINTR(creat(path.value().c_str(), 0644)); |
| 61 ASSERT_GE(fd, 0) << ErrnoMessage("creat") << " " << path.value(); | 61 ASSERT_GE(fd, 0) << ErrnoMessage("creat") << " " << path.value(); |
| 62 ASSERT_EQ(0, IGNORE_EINTR(close(fd))) | 62 ASSERT_EQ(0, IGNORE_EINTR(close(fd))) |
| 63 << ErrnoMessage("close") << " " << path.value(); | 63 << ErrnoMessage("close") << " " << path.value(); |
| 64 #elif defined(OS_WIN) | 64 #elif defined(OS_WIN) |
| 65 int fd = _wcreat(path.value().c_str(), 0644); | 65 int fd = _wcreat(path.value().c_str(), _S_IREAD | _S_IWRITE); |
| 66 ASSERT_GE(fd, 0) << ErrnoMessage("_wcreat") << " " << path.value(); | 66 ASSERT_GE(fd, 0) << ErrnoMessage("_wcreat") << " " << path.value(); |
| 67 ASSERT_EQ(0, _close(fd)) << ErrnoMessage("_close") << " " << path.value(); | 67 ASSERT_EQ(0, _close(fd)) << ErrnoMessage("_close") << " " << path.value(); |
| 68 #else | 68 #else |
| 69 #error "Not implemented" | 69 #error "Not implemented" |
| 70 #endif | 70 #endif |
| 71 EXPECT_TRUE(FileExists(path)); | 71 EXPECT_TRUE(FileExists(path)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CreateDirectory(const base::FilePath& path) { | 74 void CreateDirectory(const base::FilePath& path) { |
| 75 #if defined(OS_POSIX) | 75 #if defined(OS_POSIX) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 EXPECT_FALSE(FileExists(file1)); | 135 EXPECT_FALSE(FileExists(file1)); |
| 136 EXPECT_FALSE(FileExists(file2)); | 136 EXPECT_FALSE(FileExists(file2)); |
| 137 EXPECT_FALSE(FileExists(child_dir)); | 137 EXPECT_FALSE(FileExists(child_dir)); |
| 138 EXPECT_FALSE(FileExists(parent)); | 138 EXPECT_FALSE(FileExists(parent)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace | 141 } // namespace |
| 142 } // namespace test | 142 } // namespace test |
| 143 } // namespace crashpad | 143 } // namespace crashpad |
| OLD | NEW |