summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-09 13:15:47 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-09 13:15:47 +0000
commitad44ddb7598b1864f12861fd95fa4be2c8563a03 (patch)
treec1b3c0ce23d8f80d4a9ae69ae16545ed79082847
parent029e76c402c7e86939afbf81ca6c805bdc342438 (diff)
downloadchromium_src-ad44ddb7598b1864f12861fd95fa4be2c8563a03.zip
chromium_src-ad44ddb7598b1864f12861fd95fa4be2c8563a03.tar.gz
chromium_src-ad44ddb7598b1864f12861fd95fa4be2c8563a03.tar.bz2
file_util: Get rid of most uses of UpOneDirectory.
(Remaining one usage to be fixed, until we can remove it completly.) BUG=24672 TEST=trybots Review URL: http://codereview.chromium.org/2841039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51952 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/base_paths_win.cc6
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.cc26
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.h4
-rw-r--r--chrome/test/selenium/selenium_test.cc15
-rw-r--r--webkit/tools/test_shell/test_shell_win.cc17
5 files changed, 33 insertions, 35 deletions
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc
index 2b4912e..9b5c150 100644
--- a/base/base_paths_win.cc
+++ b/base/base_paths_win.cc
@@ -28,7 +28,6 @@ bool PathProviderWin(int key, FilePath* result) {
system_buffer[0] = 0;
FilePath cur;
- std::wstring wstring_path;
switch (key) {
case base::FILE_EXE:
GetModuleFileName(NULL, system_buffer, MAX_PATH);
@@ -94,10 +93,7 @@ bool PathProviderWin(int key, FilePath* result) {
if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT,
system_buffer)))
return false;
- wstring_path = system_buffer;
- file_util::UpOneDirectory(&wstring_path);
- file_util::AppendToPath(&wstring_path, L"LocalLow");
- cur = FilePath(wstring_path);
+ cur = FilePath(system_buffer).DirName().AppendASCII("LocalLow");
break;
case base::DIR_LOCAL_APP_DATA:
if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL,
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc
index 4ab172d..23fc0d6 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.cc
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc
@@ -409,26 +409,26 @@ void ChromeMiniInstaller::DeleteFolder(const wchar_t* folder_name) {
// Will delete user data profile.
void ChromeMiniInstaller::DeleteUserDataFolder() {
- std::wstring path = GetUserDataDirPath();
- if (file_util::PathExists(FilePath::FromWStringHack(path.c_str())))
- ASSERT_TRUE(file_util::Delete(path.c_str(), true));
+ FilePath path = GetUserDataDirPath();
+ if (file_util::PathExists(path))
+ ASSERT_TRUE(file_util::Delete(path, true));
}
// Gets user data directory path
-std::wstring ChromeMiniInstaller::GetUserDataDirPath() {
+FilePath ChromeMiniInstaller::GetUserDataDirPath() {
FilePath path;
PathService::Get(base::DIR_LOCAL_APP_DATA, &path);
- std::wstring profile_path = path.ToWStringHack();
+ FilePath profile_path = path;
if (is_chrome_frame_) {
- file_util::AppendToPath(&profile_path,
+ profile_path = profile_path.Append(
mini_installer_constants::kChromeFrameAppDir);
} else {
- file_util::AppendToPath(&profile_path,
+ profile_path = profile_path.Append(
mini_installer_constants::kChromeAppDir);
}
- file_util::UpOneDirectory(&profile_path);
- file_util::AppendToPath(&profile_path,
- mini_installer_constants::kChromeUserDataDir);
+ profile_path = profile_path.DirName();
+ profile_path = profile_path.Append(
+ mini_installer_constants::kChromeUserDataDir);
return profile_path;
}
@@ -620,9 +620,9 @@ void ChromeMiniInstaller::VerifyChromeFrameInstall() {
PlatformThread::Sleep(1500);
// Verify if IExplore folder got created
- std::wstring path = GetUserDataDirPath();
- file_util::AppendToPath(&path, L"IEXPLORE");
- ASSERT_TRUE(file_util::PathExists(FilePath::FromWStringHack(path.c_str())));
+ FilePath path = GetUserDataDirPath();
+ path = path.AppendASCII("IEXPLORE");
+ ASSERT_TRUE(file_util::PathExists(path));
}
// This method will launch any requested browser.
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.h b/chrome/test/mini_installer_test/chrome_mini_installer.h
index a5c1a9c..95adcba 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.h
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.h
@@ -11,6 +11,8 @@
#include "base/basictypes.h"
#include "base/string_util.h"
+class FilePath;
+
// This class has methods to install and uninstall Chrome mini installer.
class ChromeMiniInstaller {
public:
@@ -125,7 +127,7 @@ class ChromeMiniInstaller {
std::wstring GetUninstallPath();
// Get user data directory path.
- std::wstring GetUserDataDirPath();
+ FilePath GetUserDataDirPath();
// Gets the path to launch Chrome.
bool GetChromeLaunchPath(std::wstring* launch_path);
diff --git a/chrome/test/selenium/selenium_test.cc b/chrome/test/selenium/selenium_test.cc
index 4811167..0f688cd 100644
--- a/chrome/test/selenium/selenium_test.cc
+++ b/chrome/test/selenium/selenium_test.cc
@@ -31,7 +31,7 @@
namespace {
// This file is a comma separated list of tests that are currently failing.
-const wchar_t kExpectedFailuresFileName[] = L"expected_failures.txt";
+const char kExpectedFailuresFileName[] = "expected_failures.txt";
class SeleniumTest : public UITest {
public:
@@ -66,18 +66,17 @@ class SeleniumTest : public UITest {
}
// The results file is in trunk/chrome/test/selenium/
- std::wstring GetResultsFilePath() {
- std::wstring results_path;
+ FilePath GetResultsFilePath() {
+ FilePath results_path;
PathService::Get(chrome::DIR_TEST_DATA, &results_path);
- file_util::UpOneDirectory(&results_path);
- file_util::AppendToPath(&results_path, L"selenium");
-
- file_util::AppendToPath(&results_path, kExpectedFailuresFileName);
+ results_path = results_path.DirName();
+ results_path = results_path.AppendASCII("selenium");
+ results_path = results_path.AppendASCII(kExpectedFailuresFileName);
return results_path;
}
bool ReadExpectedResults(std::string* results) {
- std::wstring results_path = GetResultsFilePath();
+ FilePath results_path = GetResultsFilePath();
return file_util::ReadFileToString(results_path, results);
}
diff --git a/webkit/tools/test_shell/test_shell_win.cc b/webkit/tools/test_shell/test_shell_win.cc
index 07b9859..0b2a0f8 100644
--- a/webkit/tools/test_shell/test_shell_win.cc
+++ b/webkit/tools/test_shell/test_shell_win.cc
@@ -303,16 +303,17 @@ std::string TestShell::RewriteLocalUrl(const std::string& url) {
std::string new_url(url);
if (url.compare(0, kPrefixLen, kPrefix, kPrefixLen) == 0) {
- std::wstring replace_url;
+ FilePath replace_url;
PathService::Get(base::DIR_EXE, &replace_url);
- file_util::UpOneDirectory(&replace_url);
- file_util::UpOneDirectory(&replace_url);
- file_util::AppendToPath(&replace_url, L"third_party");
- file_util::AppendToPath(&replace_url, L"WebKit");
- file_util::AppendToPath(&replace_url, L"LayoutTests");
- replace_url.push_back(FilePath::kSeparators[0]);
+ replace_url = replace_url.DirName();
+ replace_url = replace_url.DirName();
+ replace_url = replace_url.AppendASCII("third_party");
+ replace_url = replace_url.AppendASCII("WebKit");
+ replace_url = replace_url.AppendASCII("LayoutTests");
+ std::wstring replace_url_str = replace_url.value();
+ replace_url_str.push_back(L'/');
new_url = std::string("file:///") +
- WideToUTF8(replace_url).append(url.substr(kPrefixLen));
+ WideToUTF8(replace_url_str).append(url.substr(kPrefixLen));
}
return new_url;
}