Chromium Code Reviews| Index: base/scoped_temp_dir_unittest.cc |
| =================================================================== |
| --- base/scoped_temp_dir_unittest.cc (revision 67430) |
| +++ base/scoped_temp_dir_unittest.cc (working copy) |
| @@ -3,6 +3,7 @@ |
| // found in the LICENSE file. |
| #include "base/file_util.h" |
| +#include "base/platform_file.h" |
| #include "base/scoped_temp_dir.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -87,3 +88,25 @@ |
| EXPECT_FALSE(dir.CreateUniqueTempDir()); |
| EXPECT_FALSE(other_dir.CreateUniqueTempDir()); |
| } |
| + |
| +#if defined(OS_WIN) |
| + |
|
Paweł Hajdan Jr.
2010/11/27 14:57:07
nit: Remove empty line.
tommi (sloooow) - chröme
2010/11/28 02:37:03
Done.
|
| +TEST(ScopedTempDir, LockedTempDir) { |
| + ScopedTempDir dir; |
| + EXPECT_TRUE(dir.CreateUniqueTempDir()); |
| + int file_flags = base::PLATFORM_FILE_CREATE_ALWAYS | |
| + base::PLATFORM_FILE_WRITE; |
| + base::PlatformFileError error_code = base::PLATFORM_FILE_OK; |
| + FilePath file_path(dir.path().Append(FILE_PATH_LITERAL("temp"))); |
| + base::PlatformFile file = base::CreatePlatformFile(file_path, file_flags, |
| + NULL, &error_code); |
| + EXPECT_NE(base::kInvalidPlatformFileValue, file); |
| + EXPECT_EQ(base::PLATFORM_FILE_OK, error_code); |
| + EXPECT_FALSE(dir.Delete()); // We should not be able to delete. |
| + EXPECT_FALSE(dir.path().empty()); // We should still have a valid path. |
| + EXPECT_TRUE(base::ClosePlatformFile(file)); |
| + // Now, we should be able to delete. |
| + EXPECT_TRUE(dir.Delete()); |
| +} |
| + |
|
Paweł Hajdan Jr.
2010/11/27 14:57:07
nit: Remove empty line.
tommi (sloooow) - chröme
2010/11/28 02:37:03
Done.
|
| +#endif |
|
Paweł Hajdan Jr.
2010/11/27 14:57:07
nit: // defined(OS_WIN)
tommi (sloooow) - chröme
2010/11/28 02:37:03
Done.
|