| 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 15 matching lines...) Expand all Loading... |
| 26 namespace test { | 26 namespace test { |
| 27 | 27 |
| 28 void ScopedTempDir::Rename() { | 28 void ScopedTempDir::Rename() { |
| 29 base::FilePath move_to = CreateTemporaryDirectory(); | 29 base::FilePath move_to = CreateTemporaryDirectory(); |
| 30 PCHECK(rename(path_.value().c_str(), move_to.value().c_str()) == 0); | 30 PCHECK(rename(path_.value().c_str(), move_to.value().c_str()) == 0); |
| 31 path_ = move_to; | 31 path_ = move_to; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 base::FilePath ScopedTempDir::CreateTemporaryDirectory() { | 35 base::FilePath ScopedTempDir::CreateTemporaryDirectory() { |
| 36 char dir_template[] = "/tmp/com.googlecode.crashpad.test.XXXXXX"; | 36 char dir_template[] = "/tmp/org.chromium.crashpad.test.XXXXXX"; |
| 37 PCHECK(mkdtemp(dir_template)) << "mkdtemp " << dir_template; | 37 PCHECK(mkdtemp(dir_template)) << "mkdtemp " << dir_template; |
| 38 return base::FilePath(dir_template); | 38 return base::FilePath(dir_template); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 void ScopedTempDir::RecursivelyDeleteTemporaryDirectory( | 42 void ScopedTempDir::RecursivelyDeleteTemporaryDirectory( |
| 43 const base::FilePath& path) { | 43 const base::FilePath& path) { |
| 44 DIR* dir = opendir(path.value().c_str()); | 44 DIR* dir = opendir(path.value().c_str()); |
| 45 ASSERT_TRUE(dir) << ErrnoMessage("opendir") << " " << path.value(); | 45 ASSERT_TRUE(dir) << ErrnoMessage("opendir") << " " << path.value(); |
| 46 | 46 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 EXPECT_EQ(0, closedir(dir)) | 62 EXPECT_EQ(0, closedir(dir)) |
| 63 << ErrnoMessage("closedir") << " " << path.value(); | 63 << ErrnoMessage("closedir") << " " << path.value(); |
| 64 EXPECT_EQ(0, rmdir(path.value().c_str())) | 64 EXPECT_EQ(0, rmdir(path.value().c_str())) |
| 65 << ErrnoMessage("rmdir") << " " << path.value(); | 65 << ErrnoMessage("rmdir") << " " << path.value(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace test | 68 } // namespace test |
| 69 } // namespace crashpad | 69 } // namespace crashpad |
| OLD | NEW |