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

Unified Diff: chrome/installer/util/duplicate_tree_detector_unittest.cc

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
Patch Set: shellapi.h needs windows.h Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/chrome_installer.gypi ('k') | chrome/installer/util/installer_util_test_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/duplicate_tree_detector_unittest.cc
diff --git a/chrome/installer/util/duplicate_tree_detector_unittest.cc b/chrome/installer/util/duplicate_tree_detector_unittest.cc
index 163c91b24d42d96d9f13280391facd9a43b80a9c..d1445dcdf1cfcff4017b12a3f5e0f23cf55d6dbc 100644
--- a/chrome/installer/util/duplicate_tree_detector_unittest.cc
+++ b/chrome/installer/util/duplicate_tree_detector_unittest.cc
@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include <windows.h>
-#include <shellapi.h>
#include <fstream>
@@ -12,6 +11,7 @@
#include "base/string16.h"
#include "base/string_util.h"
#include "chrome/installer/util/duplicate_tree_detector.h"
+#include "chrome/installer/util/installer_util_test_common.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -57,27 +57,7 @@ class DuplicateTreeDetectorTest : public testing::Test {
CreateTextFile(f2.MaybeAsASCII(), text_content_2_);
ASSERT_TRUE(file_util::PathExists(f2));
- CopyFileHierarchy(d1, second_root);
- }
-
- // Copies the hierarcy in |from| to |to|.
- void CopyFileHierarchy(const FilePath& from, const FilePath& to) {
- // In SHFILEOPSTRUCT below, |pFrom| and |pTo| have to be double-null
- // terminated: http://msdn.microsoft.com/library/bb759795.aspx
- string16 double_null_from(from.value());
- double_null_from.push_back(L'\0');
- string16 double_null_to(to.value());
- double_null_to.push_back(L'\0');
-
- SHFILEOPSTRUCT file_op = {};
- file_op.wFunc = FO_COPY;
- file_op.pFrom = double_null_from.c_str();
- file_op.pTo = double_null_to.c_str();
- file_op.fFlags = FOF_NO_UI;
-
- ASSERT_EQ(0, SHFileOperation(&file_op));
-
- ASSERT_FALSE(file_op.fAnyOperationsAborted);
+ ASSERT_TRUE(installer::test::CopyFileHierarchy(d1, second_root));
}
ScopedTempDir temp_source_dir_;
@@ -164,7 +144,7 @@ TEST_F(DuplicateTreeDetectorTest, TestSingleFiles) {
// This file should be the same.
FilePath dest_file(temp_dest_dir_.path());
dest_file = dest_file.AppendASCII("F1");
- CopyFileHierarchy(source_file, dest_file);
+ ASSERT_TRUE(installer::test::CopyFileHierarchy(source_file, dest_file));
// This file should be different.
FilePath other_file(temp_dest_dir_.path());
« no previous file with comments | « chrome/chrome_installer.gypi ('k') | chrome/installer/util/installer_util_test_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698