Index: base/scoped_temp_dir_unittest.cc |
diff --git a/base/scoped_temp_dir_unittest.cc b/base/scoped_temp_dir_unittest.cc |
index 72f4d8ce81169db94062deb15d09a2db8b51c9fa..4be0d076c5ff44f03f1c2bf0554aad0a911c4da3 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)); |
+} |