summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-31 03:28:50 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-31 03:28:50 +0000
commitb474ef25d6fe1f2df2949dcdead2a8cf3462c4de (patch)
tree2f7c95923656d7fb1dde3a68b472f44aec0057b8 /chrome
parentbd883b833f20d010ba6682a2bf7e780240d909b3 (diff)
downloadchromium_src-b474ef25d6fe1f2df2949dcdead2a8cf3462c4de.zip
chromium_src-b474ef25d6fe1f2df2949dcdead2a8cf3462c4de.tar.gz
chromium_src-b474ef25d6fe1f2df2949dcdead2a8cf3462c4de.tar.bz2
Remove more occurrences of FromWStringHack from code base.
BUG=24672 TEST=trybots Review URL: http://codereview.chromium.org/2401001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48584 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/first_run_win.cc14
-rw-r--r--chrome/browser/tab_contents/navigation_controller_unittest.cc5
-rw-r--r--chrome/test/url_fetch_test/url_fetch_test.cc67
3 files changed, 42 insertions, 44 deletions
diff --git a/chrome/browser/first_run_win.cc b/chrome/browser/first_run_win.cc
index a93a16c..4858871 100644
--- a/chrome/browser/first_run_win.cc
+++ b/chrome/browser/first_run_win.cc
@@ -75,10 +75,10 @@
namespace {
-bool GetNewerChromeFile(std::wstring* path) {
+bool GetNewerChromeFile(FilePath* path) {
if (!PathService::Get(base::DIR_EXE, path))
return false;
- file_util::AppendToPath(path, installer_util::kChromeNewExe);
+ *path = path->Append(installer_util::kChromeNewExe);
return true;
}
@@ -422,10 +422,10 @@ void Upgrade::RelaunchChromeBrowserWithNewCommandLineIfNeeded() {
}
bool Upgrade::SwapNewChromeExeIfPresent() {
- std::wstring new_chrome_exe;
+ FilePath new_chrome_exe;
if (!GetNewerChromeFile(&new_chrome_exe))
return false;
- if (!file_util::PathExists(FilePath::FromWStringHack(new_chrome_exe)))
+ if (!file_util::PathExists(new_chrome_exe))
return false;
std::wstring curr_chrome_exe;
if (!PathService::Get(base::FILE_EXE, &curr_chrome_exe))
@@ -458,7 +458,7 @@ bool Upgrade::SwapNewChromeExeIfPresent() {
std::wstring backup_exe;
if (!GetBackupChromeFile(&backup_exe))
return false;
- if (::ReplaceFileW(curr_chrome_exe.c_str(), new_chrome_exe.c_str(),
+ if (::ReplaceFileW(curr_chrome_exe.c_str(), new_chrome_exe.value().c_str(),
backup_exe.c_str(), REPLACEFILE_IGNORE_MERGE_ERRORS,
NULL, NULL)) {
return true;
@@ -480,10 +480,10 @@ bool Upgrade::DoUpgradeTasks(const CommandLine& command_line) {
// static
bool Upgrade::IsUpdatePendingRestart() {
- std::wstring new_chrome_exe;
+ FilePath new_chrome_exe;
if (!GetNewerChromeFile(&new_chrome_exe))
return false;
- return file_util::PathExists(FilePath::FromWStringHack(new_chrome_exe));
+ return file_util::PathExists(new_chrome_exe);
}
bool OpenFirstRunDialog(Profile* profile,
diff --git a/chrome/browser/tab_contents/navigation_controller_unittest.cc b/chrome/browser/tab_contents/navigation_controller_unittest.cc
index 4c572e6..658cbee 100644
--- a/chrome/browser/tab_contents/navigation_controller_unittest.cc
+++ b/chrome/browser/tab_contents/navigation_controller_unittest.cc
@@ -89,7 +89,7 @@ class NavigationControllerHistoryTest : public NavigationControllerTest {
NavigationControllerTest::TearDown();
ASSERT_TRUE(file_util::Delete(test_dir_, true));
- ASSERT_FALSE(file_util::PathExists(FilePath::FromWStringHack(test_dir_)));
+ ASSERT_FALSE(file_util::PathExists(test_dir_));
}
// Deletes the current profile manager and creates a new one. Indirectly this
@@ -129,8 +129,7 @@ class NavigationControllerHistoryTest : public NavigationControllerTest {
private:
ProfileManager* profile_manager_;
- std::wstring test_dir_;
- std::wstring profile_path_;
+ FilePath test_dir_;
};
void RegisterForAllNavNotifications(TestNotificationTracker* tracker,
diff --git a/chrome/test/url_fetch_test/url_fetch_test.cc b/chrome/test/url_fetch_test/url_fetch_test.cc
index d4d3287..e2e1f32 100644
--- a/chrome/test/url_fetch_test/url_fetch_test.cc
+++ b/chrome/test/url_fetch_test/url_fetch_test.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -27,8 +27,8 @@ class UrlFetchTest : public UITest {
};
void SetUp() {
- const CommandLine *cmdLine = CommandLine::ForCurrentProcess();
- if (cmdLine->HasSwitch("reference_build")) {
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch("reference_build")) {
FilePath dir;
PathService::Get(chrome::DIR_TEST_TOOLS, &dir);
dir = dir.AppendASCII("reference_build");
@@ -44,27 +44,27 @@ class UrlFetchTest : public UITest {
UITest::SetUp();
}
- void RunTest(const GURL& url, const char *waitCookieName,
- const char *waitCookieValue, const wchar_t *varToFetch,
- UrlFetchTestResult *result) {
+ void RunTest(const GURL& url, const char* wait_cookie_name,
+ const char* wait_cookie_value, const wchar_t* var_to_fetch,
+ UrlFetchTestResult* result) {
scoped_refptr<TabProxy> tab(GetActiveTab());
ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(url));
- if (waitCookieName) {
- if (waitCookieValue) {
- bool completed = WaitUntilCookieValue(tab.get(), url, waitCookieName,
+ if (wait_cookie_name) {
+ if (wait_cookie_value) {
+ bool completed = WaitUntilCookieValue(tab.get(), url, wait_cookie_name,
UITest::test_timeout_ms(),
- waitCookieValue);
+ wait_cookie_value);
ASSERT_TRUE(completed);
} else {
result->cookie_value = WaitUntilCookieNonEmpty(
- tab.get(), url, waitCookieName, UITest::test_timeout_ms());
+ tab.get(), url, wait_cookie_name, UITest::test_timeout_ms());
ASSERT_TRUE(result->cookie_value.length());
}
}
- if (varToFetch) {
+ if (var_to_fetch) {
std::wstring script = StringPrintf(
- L"window.domAutomationController.send(%ls);", varToFetch);
+ L"window.domAutomationController.send(%ls);", var_to_fetch);
std::wstring value;
bool success = tab->ExecuteAndExtractString(L"", script, &value);
@@ -74,9 +74,8 @@ class UrlFetchTest : public UITest {
}
};
-bool writeValueToFile(std::string value, std::wstring filePath) {
- int retval = file_util::WriteFile(
- FilePath::FromWStringHack(filePath), value.c_str(), value.length());
+bool WriteValueToFile(std::string value, const FilePath& path) {
+ int retval = file_util::WriteFile(path, value.c_str(), value.length());
return retval == static_cast<int>(value.length());
}
@@ -108,37 +107,37 @@ bool writeValueToFile(std::string value, std::wstring filePath) {
// --reference_build
// Use the reference build of chrome for the test.
TEST_F(UrlFetchTest, UrlFetch) {
- const CommandLine *cmdLine = CommandLine::ForCurrentProcess();
+ const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
- if (!cmdLine->HasSwitch("url")) {
+ if (!cmd_line->HasSwitch("url"))
return;
- }
- std::string cookieName =
- cmdLine->GetSwitchValueASCII("wait_cookie_name");
- std::string cookieValue =
- cmdLine->GetSwitchValueASCII("wait_cookie_value");
+ std::string cookie_name =
+ cmd_line->GetSwitchValueASCII("wait_cookie_name");
+ std::string cookie_value =
+ cmd_line->GetSwitchValueASCII("wait_cookie_value");
- std::wstring jsvar = cmdLine->GetSwitchValue("jsvar");
+ std::wstring jsvar = cmd_line->GetSwitchValue("jsvar");
UrlFetchTestResult result;
- RunTest(GURL(WideToASCII(cmdLine->GetSwitchValue("url"))),
- cookieName.length() > 0 ? cookieName.c_str() : NULL,
- cookieValue.length() > 0 ? cookieValue.c_str() : NULL,
+ RunTest(GURL(WideToASCII(cmd_line->GetSwitchValue("url"))),
+ cookie_name.length() > 0 ? cookie_name.c_str() : NULL,
+ cookie_value.length() > 0 ? cookie_value.c_str() : NULL,
jsvar.length() > 0 ? jsvar.c_str() : NULL,
&result);
// Write out the cookie if requested
- std::wstring cookieOutputPath =
- cmdLine->GetSwitchValue("wait_cookie_output");
- if (cookieOutputPath.length() > 0) {
- ASSERT_TRUE(writeValueToFile(result.cookie_value, cookieOutputPath));
+ FilePath cookie_output_path =
+ cmd_line->GetSwitchValuePath("wait_cookie_output");
+ if (cookie_output_path.value().size() > 0) {
+ ASSERT_TRUE(WriteValueToFile(result.cookie_value, cookie_output_path));
}
// Write out the JS Variable if requested
- std::wstring jsvarOutputPath = cmdLine->GetSwitchValue("jsvar_output");
- if (jsvarOutputPath.length() > 0) {
- ASSERT_TRUE(writeValueToFile(result.javascript_variable, jsvarOutputPath));
+ FilePath jsvar_output_path = cmd_line->GetSwitchValuePath("jsvar_output");
+ if (jsvar_output_path.value().size() > 0) {
+ ASSERT_TRUE(WriteValueToFile(result.javascript_variable,
+ jsvar_output_path));
}
}