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 18 matching lines...) Expand all Loading... |
29 class ScopedTempDir { | 29 class ScopedTempDir { |
30 public: | 30 public: |
31 ScopedTempDir(); | 31 ScopedTempDir(); |
32 ~ScopedTempDir(); | 32 ~ScopedTempDir(); |
33 | 33 |
34 //! \brief Returns the path of the temporary directory. | 34 //! \brief Returns the path of the temporary directory. |
35 //! | 35 //! |
36 //! \return The temporary directory path. | 36 //! \return The temporary directory path. |
37 const base::FilePath& path() const { return path_; } | 37 const base::FilePath& path() const { return path_; } |
38 | 38 |
39 //! \brief Move the temporary directory to a new temporary location. | 39 //! \brief Moves the temporary directory to a new temporary location. |
40 void Rename(); | 40 void Rename(); |
41 | 41 |
42 private: | 42 private: |
43 //! \brief Creates the temporary directory and asserts success of the | 43 //! \brief Creates the temporary directory and asserts success of the |
44 //! operation. | 44 //! operation. |
45 static base::FilePath CreateTemporaryDirectory(); | 45 static base::FilePath CreateTemporaryDirectory(); |
46 | 46 |
47 //! \brief Removes all files and subdirectories at the given \a path, | 47 //! \brief Removes all files and subdirectories at the given \a path, |
48 //! including the \a path itself. | 48 //! including the \a path itself. |
49 //! | 49 //! |
50 //! Failures are recorded by gtest expectations. | 50 //! Failures are recorded by gtest expectations. |
51 //! | 51 //! |
52 //! \param[in] path The path to delete, along with its contents. This must | 52 //! \param[in] path The path to delete, along with its contents. This must |
53 //! reference a directory. | 53 //! reference a directory. |
54 static void RecursivelyDeleteTemporaryDirectory(const base::FilePath& path); | 54 static void RecursivelyDeleteTemporaryDirectory(const base::FilePath& path); |
55 | 55 |
56 base::FilePath path_; | 56 base::FilePath path_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir); | 58 DISALLOW_COPY_AND_ASSIGN(ScopedTempDir); |
59 }; | 59 }; |
60 | 60 |
61 } // namespace test | 61 } // namespace test |
62 } // namespace crashpad | 62 } // namespace crashpad |
63 | 63 |
64 #endif // CRASHPAD_UTIL_TEST_SCOPED_TEMP_DIR_ | 64 #endif // CRASHPAD_UTIL_TEST_SCOPED_TEMP_DIR_ |
OLD | NEW |