summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 16:39:07 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-15 16:39:07 +0000
commit562256a8a15993a689a5846ecd4be6fcf2ab4dc4 (patch)
tree2ae0f14d4d00d2e099cf79f7c533630c6234aae7
parent7f37dd931e8f0512d215ddbc16c4e1e714d39d9d (diff)
downloadchromium_src-562256a8a15993a689a5846ecd4be6fcf2ab4dc4.zip
chromium_src-562256a8a15993a689a5846ecd4be6fcf2ab4dc4.tar.gz
chromium_src-562256a8a15993a689a5846ecd4be6fcf2ab4dc4.tar.bz2
Replaces the windows function CreateDirectory with the CreateDirectory method from FileUtil API.
BUG=None TEST=ran installer_util_unittests.exe Review URL: http://codereview.chromium.org/202002 Patch from Thiago Farina <thiago.farina@gmail.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26225 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/installer/util/copy_tree_work_item_unittest.cc22
-rw-r--r--chrome/installer/util/create_dir_work_item_unittest.cc6
-rw-r--r--chrome/installer/util/delete_tree_work_item_unittest.cc18
-rw-r--r--chrome/installer/util/helper_unittest.cc20
-rw-r--r--chrome/installer/util/move_tree_work_item_unittest.cc24
5 files changed, 45 insertions, 45 deletions
diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc
index 4be5d33..c8cae21 100644
--- a/chrome/installer/util/copy_tree_work_item_unittest.cc
+++ b/chrome/installer/util/copy_tree_work_item_unittest.cc
@@ -100,7 +100,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFile) {
// Create destination path
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to);
@@ -139,7 +139,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) {
// Create destination file
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to);
@@ -207,7 +207,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) {
// Create destination file
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to);
@@ -285,7 +285,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileAndCleanup) {
// Create destination file
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to);
@@ -337,7 +337,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) {
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to);
@@ -414,7 +414,7 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) {
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to), alternate_to(dir_name_to);
@@ -523,7 +523,7 @@ TEST_F(CopyTreeWorkItemTest, IfNotPresentTest) {
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to);
file_name_to = file_name_to.AppendASCII("File_To");
@@ -601,7 +601,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUseAndCleanup) {
FilePath dir_name_to(test_dir_);
dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir");
- CreateDirectory(dir_name_to.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_to);
ASSERT_TRUE(file_util::PathExists(dir_name_to));
FilePath file_name_to(dir_name_to);
@@ -659,17 +659,17 @@ TEST_F(CopyTreeWorkItemTest, CopyTree) {
// Create source tree
FilePath dir_name_from(test_dir_);
dir_name_from = dir_name_from.AppendASCII("from");
- CreateDirectory(dir_name_from.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_from);
ASSERT_TRUE(file_util::PathExists(dir_name_from));
FilePath dir_name_from_1(dir_name_from);
dir_name_from_1 = dir_name_from_1.AppendASCII("1");
- CreateDirectory(dir_name_from_1.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_from_1);
ASSERT_TRUE(file_util::PathExists(dir_name_from_1));
FilePath dir_name_from_2(dir_name_from);
dir_name_from_2 = dir_name_from_2.AppendASCII("2");
- CreateDirectory(dir_name_from_2.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_from_2);
ASSERT_TRUE(file_util::PathExists(dir_name_from_2));
FilePath file_name_from_1(dir_name_from_1);
diff --git a/chrome/installer/util/create_dir_work_item_unittest.cc b/chrome/installer/util/create_dir_work_item_unittest.cc
index 05739f7..49f9460 100644
--- a/chrome/installer/util/create_dir_work_item_unittest.cc
+++ b/chrome/installer/util/create_dir_work_item_unittest.cc
@@ -39,7 +39,7 @@ namespace {
TEST_F(CreateDirWorkItemTest, CreatePath) {
FilePath parent_dir(test_dir_);
parent_dir = parent_dir.AppendASCII("a");
- CreateDirectory(parent_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(parent_dir);
ASSERT_TRUE(file_util::PathExists(parent_dir));
FilePath top_dir_to_create(parent_dir);
@@ -66,7 +66,7 @@ TEST_F(CreateDirWorkItemTest, CreatePath) {
TEST_F(CreateDirWorkItemTest, CreateExistingPath) {
FilePath dir_to_create(test_dir_);
dir_to_create = dir_to_create.AppendASCII("aa");
- CreateDirectory(dir_to_create.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_to_create);
ASSERT_TRUE(file_util::PathExists(dir_to_create));
scoped_ptr<CreateDirWorkItem> work_item(
@@ -103,7 +103,7 @@ TEST_F(CreateDirWorkItemTest, CreateSharedPath) {
// Create another directory under dir_to_create_2
FilePath dir_to_create_4(dir_to_create_2);
dir_to_create_4 = dir_to_create_4.AppendASCII("ddd");
- CreateDirectory(dir_to_create_4.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_to_create_4);
ASSERT_TRUE(file_util::PathExists(dir_to_create_4));
work_item->Rollback();
diff --git a/chrome/installer/util/delete_tree_work_item_unittest.cc b/chrome/installer/util/delete_tree_work_item_unittest.cc
index 9ec3c0b..02c2bb0 100644
--- a/chrome/installer/util/delete_tree_work_item_unittest.cc
+++ b/chrome/installer/util/delete_tree_work_item_unittest.cc
@@ -62,17 +62,17 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeNoKeyPath) {
// Create tree to be deleted
FilePath dir_name_delete(test_dir_);
dir_name_delete = dir_name_delete.AppendASCII("to_be_delete");
- CreateDirectory(dir_name_delete.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete);
ASSERT_TRUE(file_util::PathExists(dir_name_delete));
FilePath dir_name_delete_1(dir_name_delete);
dir_name_delete_1 = dir_name_delete_1.AppendASCII("1");
- CreateDirectory(dir_name_delete_1.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete_1);
ASSERT_TRUE(file_util::PathExists(dir_name_delete_1));
FilePath dir_name_delete_2(dir_name_delete);
dir_name_delete_2 = dir_name_delete_2.AppendASCII("2");
- CreateDirectory(dir_name_delete_2.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete_2);
ASSERT_TRUE(file_util::PathExists(dir_name_delete_2));
FilePath file_name_delete_1(dir_name_delete_1);
@@ -110,17 +110,17 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTree) {
// Create tree to be deleted
FilePath dir_name_delete(test_dir_);
dir_name_delete = dir_name_delete.AppendASCII("to_be_delete");
- CreateDirectory(dir_name_delete.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete);
ASSERT_TRUE(file_util::PathExists(dir_name_delete));
FilePath dir_name_delete_1(dir_name_delete);
dir_name_delete_1 = dir_name_delete_1.AppendASCII("1");
- CreateDirectory(dir_name_delete_1.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete_1);
ASSERT_TRUE(file_util::PathExists(dir_name_delete_1));
FilePath dir_name_delete_2(dir_name_delete);
dir_name_delete_2 = dir_name_delete_2.AppendASCII("2");
- CreateDirectory(dir_name_delete_2.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete_2);
ASSERT_TRUE(file_util::PathExists(dir_name_delete_2));
FilePath file_name_delete_1(dir_name_delete_1);
@@ -156,17 +156,17 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) {
// Create tree to be deleted
FilePath dir_name_delete(test_dir_);
dir_name_delete = dir_name_delete.AppendASCII("to_be_delete");
- CreateDirectory(dir_name_delete.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete);
ASSERT_TRUE(file_util::PathExists(dir_name_delete));
FilePath dir_name_delete_1(dir_name_delete);
dir_name_delete_1 = dir_name_delete_1.AppendASCII("1");
- CreateDirectory(dir_name_delete_1.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete_1);
ASSERT_TRUE(file_util::PathExists(dir_name_delete_1));
FilePath dir_name_delete_2(dir_name_delete);
dir_name_delete_2 = dir_name_delete_2.AppendASCII("2");
- CreateDirectory(dir_name_delete_2.value().c_str(), NULL);
+ file_util::CreateDirectory(dir_name_delete_2);
ASSERT_TRUE(file_util::PathExists(dir_name_delete_2));
FilePath file_name_delete_1(dir_name_delete_1);
diff --git a/chrome/installer/util/helper_unittest.cc b/chrome/installer/util/helper_unittest.cc
index e1d46c9..6ccbd29 100644
--- a/chrome/installer/util/helper_unittest.cc
+++ b/chrome/installer/util/helper_unittest.cc
@@ -61,27 +61,27 @@ TEST_F(SetupHelperTest, Delete) {
// Create a Chrome dir
FilePath chrome_dir(test_dir_);
chrome_dir = chrome_dir.AppendASCII("chrome");
- CreateDirectory(chrome_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir);
ASSERT_TRUE(file_util::PathExists(chrome_dir));
FilePath chrome_dir_1(chrome_dir);
chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0");
- CreateDirectory(chrome_dir_1.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_1);
ASSERT_TRUE(file_util::PathExists(chrome_dir_1));
FilePath chrome_dir_2(chrome_dir);
chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0");
- CreateDirectory(chrome_dir_2.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_2);
ASSERT_TRUE(file_util::PathExists(chrome_dir_2));
FilePath chrome_dir_3(chrome_dir);
chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0");
- CreateDirectory(chrome_dir_3.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_3);
ASSERT_TRUE(file_util::PathExists(chrome_dir_3));
FilePath chrome_dir_4(chrome_dir);
chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0");
- CreateDirectory(chrome_dir_4.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_4);
ASSERT_TRUE(file_util::PathExists(chrome_dir_4));
FilePath chrome_dll_1(chrome_dir_1);
@@ -120,27 +120,27 @@ TEST_F(SetupHelperTest, DeleteInUsed) {
// Create a Chrome dir
FilePath chrome_dir(test_dir_);
chrome_dir = chrome_dir.AppendASCII("chrome");
- CreateDirectory(chrome_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir);
ASSERT_TRUE(file_util::PathExists(chrome_dir));
FilePath chrome_dir_1(chrome_dir);
chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0");
- CreateDirectory(chrome_dir_1.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_1);
ASSERT_TRUE(file_util::PathExists(chrome_dir_1));
FilePath chrome_dir_2(chrome_dir);
chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0");
- CreateDirectory(chrome_dir_2.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_2);
ASSERT_TRUE(file_util::PathExists(chrome_dir_2));
FilePath chrome_dir_3(chrome_dir);
chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0");
- CreateDirectory(chrome_dir_3.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_3);
ASSERT_TRUE(file_util::PathExists(chrome_dir_3));
FilePath chrome_dir_4(chrome_dir);
chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0");
- CreateDirectory(chrome_dir_4.value().c_str(), NULL);
+ file_util::CreateDirectory(chrome_dir_4);
ASSERT_TRUE(file_util::PathExists(chrome_dir_4));
FilePath chrome_dll_1(chrome_dir_1);
diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc
index 182f5ab..9662b18 100644
--- a/chrome/installer/util/move_tree_work_item_unittest.cc
+++ b/chrome/installer/util/move_tree_work_item_unittest.cc
@@ -79,12 +79,12 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) {
// Create two level deep source dir
FilePath from_dir1(test_dir_);
from_dir1 = from_dir1.AppendASCII("From_Dir1");
- CreateDirectory(from_dir1.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir1);
ASSERT_TRUE(file_util::PathExists(from_dir1));
FilePath from_dir2(from_dir1);
from_dir2 = from_dir2.AppendASCII("From_Dir2");
- CreateDirectory(from_dir2.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir2);
ASSERT_TRUE(file_util::PathExists(from_dir2));
FilePath from_file(from_dir2);
@@ -126,12 +126,12 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) {
// Create two level deep source dir
FilePath from_dir1(test_dir_);
from_dir1 = from_dir1.AppendASCII("From_Dir1");
- CreateDirectory(from_dir1.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir1);
ASSERT_TRUE(file_util::PathExists(from_dir1));
FilePath from_dir2(from_dir1);
from_dir2 = from_dir2.AppendASCII("From_Dir2");
- CreateDirectory(from_dir2.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir2);
ASSERT_TRUE(file_util::PathExists(from_dir2));
FilePath from_file(from_dir2);
@@ -142,7 +142,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) {
// Create destination path
FilePath to_dir(test_dir_);
to_dir = to_dir.AppendASCII("To_Dir");
- CreateDirectory(to_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(to_dir);
ASSERT_TRUE(file_util::PathExists(to_dir));
FilePath orig_to_file(to_dir);
@@ -184,7 +184,7 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) {
// Create a file inside source dir
FilePath from_dir(test_dir_);
from_dir = from_dir.AppendASCII("From_Dir");
- CreateDirectory(from_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir);
ASSERT_TRUE(file_util::PathExists(from_dir));
FilePath from_file(from_dir);
@@ -223,7 +223,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) {
// Create a file inside source dir
FilePath from_dir(test_dir_);
from_dir = from_dir.AppendASCII("From_Dir");
- CreateDirectory(from_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir);
ASSERT_TRUE(file_util::PathExists(from_dir));
FilePath from_file(from_dir);
@@ -234,7 +234,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) {
// Create destination path
FilePath to_dir(test_dir_);
to_dir = to_dir.AppendASCII("To_Dir");
- CreateDirectory(to_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(to_dir);
ASSERT_TRUE(file_util::PathExists(to_dir));
FilePath to_file(to_dir);
@@ -269,7 +269,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
// Create a file inside source dir
FilePath from_dir(test_dir_);
from_dir = from_dir.AppendASCII("From_Dir");
- CreateDirectory(from_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir);
ASSERT_TRUE(file_util::PathExists(from_dir));
FilePath from_file(from_dir);
@@ -280,7 +280,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
// Create an executable in destination path by copying ourself to it.
FilePath to_dir(test_dir_);
to_dir = to_dir.AppendASCII("To_Dir");
- CreateDirectory(to_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(to_dir);
ASSERT_TRUE(file_util::PathExists(to_dir));
wchar_t exe_full_path_str[MAX_PATH];
@@ -330,7 +330,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
// Create an executable for source by copying ourself to a new source dir.
FilePath from_dir(test_dir_);
from_dir = from_dir.AppendASCII("From_Dir");
- CreateDirectory(from_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(from_dir);
ASSERT_TRUE(file_util::PathExists(from_dir));
wchar_t exe_full_path_str[MAX_PATH];
@@ -344,7 +344,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
// Create a destination source dir and generate destination file name.
FilePath to_dir(test_dir_);
to_dir = to_dir.AppendASCII("To_Dir");
- CreateDirectory(to_dir.value().c_str(), NULL);
+ file_util::CreateDirectory(to_dir);
ASSERT_TRUE(file_util::PathExists(to_dir));
FilePath to_file(to_dir);