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

Unified Diff: chrome/installer/util/installer_util_test_common.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
Index: chrome/installer/util/installer_util_test_common.cc
diff --git a/chrome/installer/util/installer_util_test_common.cc b/chrome/installer/util/installer_util_test_common.cc
new file mode 100644
index 0000000000000000000000000000000000000000..708d6c3d8dc0f9a26fb19bf622a616445f8e5455
--- /dev/null
+++ b/chrome/installer/util/installer_util_test_common.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/installer/util/installer_util_test_common.h"
+
+#include <windows.h>
+#include <shellapi.h>
+
+#include "base/file_path.h"
+#include "base/string16.h"
+
+namespace installer {
+
+namespace test {
+
+bool 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;
+
+ return (SHFileOperation(&file_op) == 0 && !file_op.fAnyOperationsAborted);
+}
+
+} // namespace test
+
+} // namespace installer
« no previous file with comments | « chrome/installer/util/installer_util_test_common.h ('k') | chrome/installer/util/move_tree_work_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698