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

Side by Side Diff: base/file_util_unittest.cc

Issue 3077: posix copydirectory implementation (Closed)
Patch Set: rebased Created 12 years, 3 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
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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 392
393 EXPECT_TRUE(file_util::Move(dir_name_from, dir_name_to)); 393 EXPECT_TRUE(file_util::Move(dir_name_from, dir_name_to));
394 394
395 // Check everything has been moved. 395 // Check everything has been moved.
396 EXPECT_FALSE(file_util::PathExists(dir_name_from)); 396 EXPECT_FALSE(file_util::PathExists(dir_name_from));
397 EXPECT_FALSE(file_util::PathExists(file_name_from)); 397 EXPECT_FALSE(file_util::PathExists(file_name_from));
398 EXPECT_TRUE(file_util::PathExists(dir_name_to)); 398 EXPECT_TRUE(file_util::PathExists(dir_name_to));
399 EXPECT_TRUE(file_util::PathExists(file_name_to)); 399 EXPECT_TRUE(file_util::PathExists(file_name_to));
400 } 400 }
401 401
402 // TODO(erikkay): implement
403 #if defined(OS_WIN)
404 TEST_F(FileUtilTest, CopyDirectoryRecursively) { 402 TEST_F(FileUtilTest, CopyDirectoryRecursively) {
405 // Create a directory. 403 // Create a directory.
406 std::wstring dir_name_from(test_dir_); 404 std::wstring dir_name_from(test_dir_);
407 file_util::AppendToPath(&dir_name_from, L"Copy_From_Subdir"); 405 file_util::AppendToPath(&dir_name_from, L"Copy_From_Subdir");
408 file_util::CreateDirectory(dir_name_from.c_str()); 406 file_util::CreateDirectory(dir_name_from.c_str());
409 ASSERT_TRUE(file_util::PathExists(dir_name_from)); 407 ASSERT_TRUE(file_util::PathExists(dir_name_from));
410 408
411 // Create a file under the directory. 409 // Create a file under the directory.
412 std::wstring file_name_from(dir_name_from); 410 std::wstring file_name_from(dir_name_from);
413 file_util::AppendToPath(&file_name_from, L"Copy_Test_File.txt"); 411 file_util::AppendToPath(&file_name_from, L"Copy_Test_File.txt");
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 488
491 // Check everything has been copied. 489 // Check everything has been copied.
492 EXPECT_TRUE(file_util::PathExists(dir_name_from)); 490 EXPECT_TRUE(file_util::PathExists(dir_name_from));
493 EXPECT_TRUE(file_util::PathExists(file_name_from)); 491 EXPECT_TRUE(file_util::PathExists(file_name_from));
494 EXPECT_TRUE(file_util::PathExists(subdir_name_from)); 492 EXPECT_TRUE(file_util::PathExists(subdir_name_from));
495 EXPECT_TRUE(file_util::PathExists(file_name2_from)); 493 EXPECT_TRUE(file_util::PathExists(file_name2_from));
496 EXPECT_TRUE(file_util::PathExists(dir_name_to)); 494 EXPECT_TRUE(file_util::PathExists(dir_name_to));
497 EXPECT_TRUE(file_util::PathExists(file_name_to)); 495 EXPECT_TRUE(file_util::PathExists(file_name_to));
498 EXPECT_FALSE(file_util::PathExists(subdir_name_to)); 496 EXPECT_FALSE(file_util::PathExists(subdir_name_to));
499 } 497 }
500 #endif
501 498
502 TEST_F(FileUtilTest, CopyFile) { 499 TEST_F(FileUtilTest, CopyFile) {
503 // Create a directory 500 // Create a directory
504 std::wstring dir_name_from(test_dir_); 501 std::wstring dir_name_from(test_dir_);
505 file_util::AppendToPath(&dir_name_from, L"Copy_From_Subdir"); 502 file_util::AppendToPath(&dir_name_from, L"Copy_From_Subdir");
506 file_util::CreateDirectory(dir_name_from.c_str()); 503 file_util::CreateDirectory(dir_name_from.c_str());
507 ASSERT_TRUE(file_util::PathExists(dir_name_from)); 504 ASSERT_TRUE(file_util::PathExists(dir_name_from));
508 505
509 // Create a file under the directory 506 // Create a file under the directory
510 std::wstring file_name_from(dir_name_from); 507 std::wstring file_name_from(dir_name_from);
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 909
913 // Make sure the destructor closes the find handle while in the middle of a 910 // Make sure the destructor closes the find handle while in the middle of a
914 // query to allow TearDown to delete the directory. 911 // query to allow TearDown to delete the directory.
915 file_util::FileEnumerator f6(test_dir_, true, 912 file_util::FileEnumerator f6(test_dir_, true,
916 file_util::FileEnumerator::FILES_AND_DIRECTORIES); 913 file_util::FileEnumerator::FILES_AND_DIRECTORIES);
917 EXPECT_FALSE(f6.Next().empty()); // Should have found something 914 EXPECT_FALSE(f6.Next().empty()); // Should have found something
918 // (we don't care what). 915 // (we don't care what).
919 } 916 }
920 917
921 } // namespace 918 } // namespace
OLDNEW
« base/file_util_posix.cc ('K') | « base/file_util_posix.cc ('k') | net/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698