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

Unified Diff: base/files/file_unittest.cc

Issue 2797283002: Fixing std::swap(x, x) in base. (Closed)
Patch Set: Rebase. Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/files/file.cc ('k') | base/pickle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_unittest.cc
diff --git a/base/files/file_unittest.cc b/base/files/file_unittest.cc
index 66c312b60d4cff0d296384d829e529db94a74d28..e179bbba55ef5c4535bdc4c6fbfd469c1776118f 100644
--- a/base/files/file_unittest.cc
+++ b/base/files/file_unittest.cc
@@ -105,6 +105,17 @@ 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);
+ using namespace std;
+ swap(file, file);
+ EXPECT_TRUE(file.IsValid());
+}
+
TEST(FileTest, Async) {
base::ScopedTempDir temp_dir;
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
« no previous file with comments | « base/files/file.cc ('k') | base/pickle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698