diff options
Diffstat (limited to 'base/scoped_temp_dir_unittest.cc')
-rw-r--r-- | base/scoped_temp_dir_unittest.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/scoped_temp_dir_unittest.cc b/base/scoped_temp_dir_unittest.cc index 72f4d8c..4be0d07 100644 --- a/base/scoped_temp_dir_unittest.cc +++ b/base/scoped_temp_dir_unittest.cc @@ -55,3 +55,21 @@ TEST(ScopedTempDir, TempDir) { } EXPECT_FALSE(file_util::DirectoryExists(test_path)); } + +TEST(ScopedTempDir, UniqueTempDirUnderPath) { + // Create a path which will contain a unique temp path. + FilePath base_path; + file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("base_dir"), + &base_path); + + FilePath test_path; + { + ScopedTempDir dir; + EXPECT_TRUE(dir.CreateUniqueTempDirUnderPath(base_path)); + test_path = dir.path(); + EXPECT_TRUE(file_util::DirectoryExists(test_path)); + EXPECT_TRUE(base_path.IsParent(test_path)); + EXPECT_TRUE(test_path.value().find(base_path.value()) != std::string::npos); + } + EXPECT_FALSE(file_util::DirectoryExists(test_path)); +} |