Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: base/files/scoped_temp_dir_unittest.cc

Issue 1446363003: Deleted OS_WIN and all Windows specific files from base. (Closed) Base URL: https://github.com/domokit/mojo.git@base_tests
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/files/memory_mapped_file_win.cc ('k') | base/guid_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 EXPECT_TRUE(dir.Delete()); 87 EXPECT_TRUE(dir.Delete());
88 EXPECT_TRUE(dir.CreateUniqueTempDir()); 88 EXPECT_TRUE(dir.CreateUniqueTempDir());
89 EXPECT_FALSE(dir.CreateUniqueTempDir()); 89 EXPECT_FALSE(dir.CreateUniqueTempDir());
90 ScopedTempDir other_dir; 90 ScopedTempDir other_dir;
91 EXPECT_TRUE(other_dir.Set(dir.Take())); 91 EXPECT_TRUE(other_dir.Set(dir.Take()));
92 EXPECT_TRUE(dir.CreateUniqueTempDir()); 92 EXPECT_TRUE(dir.CreateUniqueTempDir());
93 EXPECT_FALSE(dir.CreateUniqueTempDir()); 93 EXPECT_FALSE(dir.CreateUniqueTempDir());
94 EXPECT_FALSE(other_dir.CreateUniqueTempDir()); 94 EXPECT_FALSE(other_dir.CreateUniqueTempDir());
95 } 95 }
96 96
97 #if defined(OS_WIN)
98 TEST(ScopedTempDir, LockedTempDir) {
99 ScopedTempDir dir;
100 EXPECT_TRUE(dir.CreateUniqueTempDir());
101 base::File file(dir.path().Append(FILE_PATH_LITERAL("temp")),
102 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
103 EXPECT_TRUE(file.IsValid());
104 EXPECT_EQ(base::File::FILE_OK, file.error_details());
105 EXPECT_FALSE(dir.Delete()); // We should not be able to delete.
106 EXPECT_FALSE(dir.path().empty()); // We should still have a valid path.
107 file.Close();
108 // Now, we should be able to delete.
109 EXPECT_TRUE(dir.Delete());
110 }
111 #endif // defined(OS_WIN)
112
113 } // namespace base 97 } // namespace base
OLDNEW
« no previous file with comments | « base/files/memory_mapped_file_win.cc ('k') | base/guid_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698