Fixed copying read-only directories

While directory copying, the original code creates top-level directory
with the same permissions as source one. So if source directory is
read-only, the newly created directory is also read-only, and neither files
nor subdirectories can't be created in it

R=rvargas@chromium.org

TEST=Unit test was updated to check such a use case

Review URL: https://codereview.chromium.org/659303002

Cr-Commit-Position: refs/heads/master@{#301332}


CrOS-Libchrome-Original-Commit: da4b0f2ba723c28734781887f759a969eea9191a
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc
index 5a94cef..d86d9bc 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -322,7 +322,9 @@
     }
 
     if (S_ISDIR(from_stat.st_mode)) {
-      if (mkdir(target_path.value().c_str(), from_stat.st_mode & 01777) != 0 &&
+      if (mkdir(target_path.value().c_str(),
+                (from_stat.st_mode & 01777) | S_IRUSR | S_IXUSR | S_IWUSR) !=
+              0 &&
           errno != EEXIST) {
         DLOG(ERROR) << "CopyDirectory() couldn't create directory: "
                     << target_path.value() << " errno = " << errno;