Chromium Code Reviews| Index: base/files/file_unittest.cc |
| diff --git a/base/files/file_unittest.cc b/base/files/file_unittest.cc |
| index 66c312b60d4cff0d296384d829e529db94a74d28..8275bac769c04f133fce7a182e36bb0686560b08 100644 |
| --- a/base/files/file_unittest.cc |
| +++ b/base/files/file_unittest.cc |
| @@ -105,6 +105,16 @@ TEST(FileTest, Create) { |
| EXPECT_FALSE(base::PathExists(file_path)); |
| } |
| +TEST(FileTest, SelfSwap) { |
| + base::ScopedTempDir temp_dir; |
| + ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
| + FilePath file_path = temp_dir.GetPath().AppendASCII("create_file_1"); |
| + File file(file_path, |
| + base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_DELETE_ON_CLOSE); |
| + std::swap(file, file); |
|
dcheng
2017/04/05 21:01:19
Slight nit: the standard idiom is:
using std::swa
dyaroshev
2017/04/05 21:06:48
Done.
|
| + EXPECT_TRUE(file.IsValid()); |
| +} |
| + |
| TEST(FileTest, Async) { |
| base::ScopedTempDir temp_dir; |
| ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |