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 21 matching lines...) Expand all Loading... |
32 #endif // OS_POSIX | 32 #endif // OS_POSIX |
33 | 33 |
34 namespace crashpad { | 34 namespace crashpad { |
35 namespace test { | 35 namespace test { |
36 namespace { | 36 namespace { |
37 | 37 |
38 bool FileExists(const base::FilePath& path) { | 38 bool FileExists(const base::FilePath& path) { |
39 #if defined(OS_POSIX) | 39 #if defined(OS_POSIX) |
40 struct stat st; | 40 struct stat st; |
41 int rv = lstat(path.value().c_str(), &st); | 41 int rv = lstat(path.value().c_str(), &st); |
| 42 const char stat_function[] = "lstat"; |
42 #elif defined(OS_WIN) | 43 #elif defined(OS_WIN) |
43 struct _stat st; | 44 struct _stat st; |
44 int rv = _wstat(path.value().c_str(), &st); | 45 int rv = _wstat(path.value().c_str(), &st); |
| 46 const char stat_function[] = "_wstat"; |
45 #else | 47 #else |
46 #error "Not implemented" | 48 #error "Not implemented" |
47 #endif | 49 #endif |
48 if (rv < 0) { | 50 if (rv < 0) { |
49 EXPECT_EQ(ENOENT, errno) << ErrnoMessage("lstat") << " " << path.value(); | 51 EXPECT_EQ(ENOENT, errno) << ErrnoMessage(stat_function) << " " |
| 52 << path.value(); |
50 return false; | 53 return false; |
51 } | 54 } |
52 return true; | 55 return true; |
53 } | 56 } |
54 | 57 |
55 void CreateFile(const base::FilePath& path) { | 58 void CreateFile(const base::FilePath& path) { |
56 #if defined(OS_POSIX) | 59 #if defined(OS_POSIX) |
57 int fd = HANDLE_EINTR(creat(path.value().c_str(), 0644)); | 60 int fd = HANDLE_EINTR(creat(path.value().c_str(), 0644)); |
58 ASSERT_GE(fd, 0) << ErrnoMessage("creat") << " " << path.value(); | 61 ASSERT_GE(fd, 0) << ErrnoMessage("creat") << " " << path.value(); |
59 ASSERT_EQ(0, IGNORE_EINTR(close(fd))) | 62 ASSERT_EQ(0, IGNORE_EINTR(close(fd))) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 134 |
132 EXPECT_FALSE(FileExists(file1)); | 135 EXPECT_FALSE(FileExists(file1)); |
133 EXPECT_FALSE(FileExists(file2)); | 136 EXPECT_FALSE(FileExists(file2)); |
134 EXPECT_FALSE(FileExists(child_dir)); | 137 EXPECT_FALSE(FileExists(child_dir)); |
135 EXPECT_FALSE(FileExists(parent)); | 138 EXPECT_FALSE(FileExists(parent)); |
136 } | 139 } |
137 | 140 |
138 } // namespace | 141 } // namespace |
139 } // namespace test | 142 } // namespace test |
140 } // namespace crashpad | 143 } // namespace crashpad |
OLD | NEW |