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

Unified Diff: chrome/test/automation/proxy_launcher.cc

Issue 13646016: Delete CopyRecursiveDirNoCache from test_file_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/test/test_file_util_win.cc ('k') | chrome/test/perf/startup_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/automation/proxy_launcher.cc
diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc
index 98ba947f1d3ee46a37973075255e28857e0f7c45..27abf398e01ad5e918f683ee002e0ef40694a624 100644
--- a/chrome/test/automation/proxy_launcher.cc
+++ b/chrome/test/automation/proxy_launcher.cc
@@ -39,6 +39,29 @@ namespace {
// Passed as value of kTestType.
const char kUITestType[] = "ui";
+// Copies the contents of the given source directory to the given dest
+// directory. This is somewhat different than CopyDirectory in base which will
+// copies "source/" to "dest/source/". This version will copy "source/*" to
+// "dest/*", overwriting existing files as necessary.
+bool CopyDirectoryContents(const base::FilePath& source,
+ const base::FilePath& dest) {
+ file_util::FileEnumerator en(source, false,
+ file_util::FileEnumerator::FILES |
+ file_util::FileEnumerator::DIRECTORIES);
+ for (base::FilePath cur = en.Next(); !cur.empty(); cur = en.Next()) {
+ file_util::FileEnumerator::FindInfo info;
+ en.GetFindInfo(&info);
+ if (file_util::FileEnumerator::IsDirectory(info)) {
+ if (!file_util::CopyDirectory(cur, dest, true))
+ return false;
+ } else {
+ if (!file_util::CopyFile(cur, dest.Append(cur.BaseName())))
+ return false;
+ }
+ }
+ return true;
+}
+
// We want to have a current history database when we start the browser so
// things like the NTP will have thumbnails. This method updates the dates
// in the history to be more recent.
@@ -186,8 +209,7 @@ bool ProxyLauncher::LaunchBrowser(const LaunchState& state) {
if (!state.template_user_data.empty()) {
// Recursively copy the template directory to the user_data_dir.
- if (!file_util::CopyRecursiveDirNoCache(
- state.template_user_data, user_data_dir())) {
+ if (!CopyDirectoryContents(state.template_user_data, user_data_dir())) {
LOG(ERROR) << "Failed to copy user data directory template.";
return false;
}
« no previous file with comments | « base/test/test_file_util_win.cc ('k') | chrome/test/perf/startup_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698