Our existing unit tests for file_util::CopyDirectory() do not test its
behavior when the destination directory already exists.  The following CL:

http://codereview.chromium.org/271060/show

which adds unit tests for already-existing destination directories, shows
that Windows and POSIX behave differently for recursive copies when the
destination directory already exists.  Specifically:

On Windows, a call to file_util::CopyDirectory() with recursive copy enabled
will copy the directory name itself to ay(already-existing) destination
directory.  POSIX systems will copy the *contents* of the directory to the
destination.  That is, given a 'src' directory containing two files and a
call like:

    file_util::CopyDirectory('src', 'existing_dest_dir', true);

On Windows we create 'existing_dest_dir/src/{file1,file2}' while on POSIX we
create just 'existing_dest_dir/{file1,file2}'.

This has come up for memory_test, which uses CopyDirectory() to copy its
checked-in cached user data dir to a freshly-created temporary directory.
At some point the Windows version of memory_test.cc was broken by this
inconsistency.  We haven't noticed because the "breakage" fails to load the
(cached) pages, but still returns memory size data and doesn't cause the
test itself to fail.

Based on the fact that memory_test.cc originally worked on Windows, it seems
like the POSIX behavior is correct/intended (especially since it's
consistent with the behavior when the directory doesn't exist).  Any
disagreement?  If not, I'll fix Windows accordingly.

        --SK

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to