Viet-Trung Luu | c049435 | 2015-09-17 13:31:29 -0700 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Viet-Trung Luu | d892e47 | 2015-10-29 09:16:40 -0700 | [diff] [blame] | 5 | #ifndef MOJO_EDK_SYSTEM_TEST_SCOPED_TEST_DIR_H_ |
| 6 | #define MOJO_EDK_SYSTEM_TEST_SCOPED_TEST_DIR_H_ |
Viet-Trung Luu | c049435 | 2015-09-17 13:31:29 -0700 | [diff] [blame] | 7 | |
| 8 | #include "base/files/scoped_temp_dir.h" |
| 9 | #include "mojo/edk/util/scoped_file.h" |
| 10 | #include "mojo/public/cpp/system/macros.h" |
| 11 | |
| 12 | namespace mojo { |
Viet-Trung Luu | d892e47 | 2015-10-29 09:16:40 -0700 | [diff] [blame] | 13 | namespace system { |
Viet-Trung Luu | c049435 | 2015-09-17 13:31:29 -0700 | [diff] [blame] | 14 | namespace test { |
| 15 | |
| 16 | // Creates/destroyes a temporary directory for test purposes. (Unlike |
| 17 | // |base::ScopedTempDir|, this automatically creates the temporary directory.) |
Viet-Trung Luu | 49824cb | 2015-11-11 12:47:10 -0800 | [diff] [blame] | 18 | class ScopedTestDir final { |
Viet-Trung Luu | c049435 | 2015-09-17 13:31:29 -0700 | [diff] [blame] | 19 | public: |
| 20 | ScopedTestDir(); |
| 21 | ~ScopedTestDir(); |
| 22 | |
| 23 | util::ScopedFILE CreateFile(); |
| 24 | |
| 25 | private: |
| 26 | base::ScopedTempDir temp_dir_; |
| 27 | |
| 28 | MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedTestDir); |
| 29 | }; |
| 30 | |
| 31 | } // namespace test |
Viet-Trung Luu | d892e47 | 2015-10-29 09:16:40 -0700 | [diff] [blame] | 32 | } // namespace system |
Viet-Trung Luu | c049435 | 2015-09-17 13:31:29 -0700 | [diff] [blame] | 33 | } // namespace mojo |
| 34 | |
Viet-Trung Luu | d892e47 | 2015-10-29 09:16:40 -0700 | [diff] [blame] | 35 | #endif // MOJO_EDK_SYSTEM_TEST_SCOPED_TEST_DIR_H_ |