 Chromium Code Reviews
 Chromium Code Reviews Issue 11340049:
  Move CopyFileHierarchy to a common test namespace and also use it in MoveTreeWorkItemTest.MoveDirec…  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 11340049:
  Move CopyFileHierarchy to a common test namespace and also use it in MoveTreeWorkItemTest.MoveDirec…  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/installer/util/move_tree_work_item_unittest.cc | 
| diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc | 
| index 5d5018d862642b435f6f92f025f8d6ada559e82d..71f563b36116cf975918db86374ddfff14026d97 100644 | 
| --- a/chrome/installer/util/move_tree_work_item_unittest.cc | 
| +++ b/chrome/installer/util/move_tree_work_item_unittest.cc | 
| @@ -12,8 +12,9 @@ | 
| #include "base/path_service.h" | 
| #include "base/process_util.h" | 
| #include "base/string_util.h" | 
| -#include "chrome/installer/util/work_item.h" | 
| +#include "chrome/installer/util/installer_util_test_common.h" | 
| #include "chrome/installer/util/move_tree_work_item.h" | 
| +#include "chrome/installer/util/work_item.h" | 
| #include "testing/gtest/include/gtest/gtest.h" | 
| namespace { | 
| @@ -386,8 +387,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { | 
| // Move one directory from source to destination when destination already | 
| // exists. | 
| -TEST_F(MoveTreeWorkItemTest, | 
| - FLAKY_MoveDirectoryDestExistsCheckForDuplicatesFull) { | 
| +TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) { | 
| // Create two level deep source dir | 
| FilePath from_dir1(temp_from_dir_.path()); | 
| from_dir1 = from_dir1.AppendASCII("From_Dir1"); | 
| @@ -410,19 +410,12 @@ TEST_F(MoveTreeWorkItemTest, | 
| file_util::CreateDirectory(to_dir); | 
| 
grt (UTC plus 2)
2012/10/31 17:33:06
is it equivalent to replace 410-414 with:
  // Cre
 
gab
2012/11/01 15:52:05
Yep, done.
 | 
| ASSERT_TRUE(file_util::PathExists(to_dir)); | 
| - // Create a sub-directory of the same name as in the source directory. | 
| - FilePath to_dir2(to_dir); | 
| - to_dir2 = to_dir2.AppendASCII("From_Dir2"); | 
| - file_util::CreateDirectory(to_dir2); | 
| - ASSERT_TRUE(file_util::PathExists(to_dir2)); | 
| - | 
| - // Create an identical file in the to sub-directory. | 
| - FilePath orig_to_file(to_dir2); | 
| - orig_to_file = orig_to_file.AppendASCII("From_File"); | 
| - CreateTextFile(orig_to_file.value(), kTextContent1); | 
| - ASSERT_TRUE(file_util::PathExists(orig_to_file)); | 
| + // Create a sub-directory identical to the one in the source directory. | 
| + installer::test::CopyFileHierarchy(from_dir2, to_dir); | 
| - // Lock one of the files in the to sub-directory to prevent moves. | 
| + // Lock one of the files in the to destination directory to prevent moves. | 
| + FilePath orig_to_file( | 
| + to_dir.AppendASCII("From_Dir2").AppendASCII("From_File")); | 
| file_util::MemoryMappedFile mapped_file; | 
| EXPECT_TRUE(mapped_file.Initialize(orig_to_file)); |