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

Side by Side Diff: base/file_util_unittest.cc

Issue 164537: Renames the function CreateTemporaryFilename to CreateTemporaryFile and track... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: CommandLine fix Created 11 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util_posix.cc ('k') | base/file_util_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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 EXPECT_TRUE(file_util::CopyAndDeleteDirectory(dir_name_from, dir_name_to)); 770 EXPECT_TRUE(file_util::CopyAndDeleteDirectory(dir_name_from, dir_name_to));
771 771
772 // Check everything has been moved. 772 // Check everything has been moved.
773 EXPECT_FALSE(file_util::PathExists(dir_name_from)); 773 EXPECT_FALSE(file_util::PathExists(dir_name_from));
774 EXPECT_FALSE(file_util::PathExists(file_name_from)); 774 EXPECT_FALSE(file_util::PathExists(file_name_from));
775 EXPECT_TRUE(file_util::PathExists(dir_name_to)); 775 EXPECT_TRUE(file_util::PathExists(dir_name_to));
776 EXPECT_TRUE(file_util::PathExists(file_name_to)); 776 EXPECT_TRUE(file_util::PathExists(file_name_to));
777 } 777 }
778 #endif 778 #endif
779 779
780 TEST_F(FileUtilTest, CreateTemporaryFileNameTest) { 780 TEST_F(FileUtilTest, CreateTemporaryFileTest) {
781 std::wstring temp_files[3]; 781 FilePath temp_files[3];
782 for (int i = 0; i < 3; i++) { 782 for (int i = 0; i < 3; i++) {
783 ASSERT_TRUE(file_util::CreateTemporaryFileName(&(temp_files[i]))); 783 ASSERT_TRUE(file_util::CreateTemporaryFile(&(temp_files[i])));
784 EXPECT_TRUE(file_util::PathExists(temp_files[i])); 784 EXPECT_TRUE(file_util::PathExists(temp_files[i]));
785 EXPECT_FALSE(file_util::DirectoryExists(temp_files[i])); 785 EXPECT_FALSE(file_util::DirectoryExists(temp_files[i]));
786 } 786 }
787 for (int i = 0; i < 3; i++) 787 for (int i = 0; i < 3; i++)
788 EXPECT_FALSE(temp_files[i] == temp_files[(i+1)%3]); 788 EXPECT_FALSE(temp_files[i] == temp_files[(i+1)%3]);
789 for (int i = 0; i < 3; i++) 789 for (int i = 0; i < 3; i++)
790 EXPECT_TRUE(file_util::Delete(temp_files[i], false)); 790 EXPECT_TRUE(file_util::Delete(temp_files[i], false));
791 } 791 }
792 792
793 TEST_F(FileUtilTest, CreateAndOpenTemporaryFileNameTest) { 793 TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) {
794 FilePath names[3]; 794 FilePath names[3];
795 FILE *fps[3]; 795 FILE *fps[3];
796 int i; 796 int i;
797 797
798 // Create; make sure they are open and exist. 798 // Create; make sure they are open and exist.
799 for (i = 0; i < 3; ++i) { 799 for (i = 0; i < 3; ++i) {
800 fps[i] = file_util::CreateAndOpenTemporaryFile(&(names[i])); 800 fps[i] = file_util::CreateAndOpenTemporaryFile(&(names[i]));
801 ASSERT_TRUE(fps[i]); 801 ASSERT_TRUE(fps[i]);
802 EXPECT_TRUE(file_util::PathExists(names[i])); 802 EXPECT_TRUE(file_util::PathExists(names[i]));
803 } 803 }
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 #elif defined(OS_LINUX) 1159 #elif defined(OS_LINUX)
1160 EXPECT_FALSE(file_util::ContainsPath(foo, 1160 EXPECT_FALSE(file_util::ContainsPath(foo,
1161 foo_caps.Append(FILE_PATH_LITERAL("bar.txt")))); 1161 foo_caps.Append(FILE_PATH_LITERAL("bar.txt"))));
1162 #else 1162 #else
1163 // We can't really do this test on osx since the case-sensitivity of the 1163 // We can't really do this test on osx since the case-sensitivity of the
1164 // filesystem is configurable. 1164 // filesystem is configurable.
1165 #endif 1165 #endif
1166 } 1166 }
1167 1167
1168 } // namespace 1168 } // namespace
OLDNEW
« no previous file with comments | « base/file_util_posix.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698