diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 10:43:00 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 10:43:00 +0000 |
commit | bcd840cdc6c8f30782048cebafee9cc5f4a96883 (patch) | |
tree | 77b1b5d109ec6938b76b8c029e1a27f04426a4f9 /chrome_frame | |
parent | 98efd9a924ec054f953c0798b9208c887c47646d (diff) | |
download | chromium_src-bcd840cdc6c8f30782048cebafee9cc5f4a96883.zip chromium_src-bcd840cdc6c8f30782048cebafee9cc5f4a96883.tar.gz chromium_src-bcd840cdc6c8f30782048cebafee9cc5f4a96883.tar.bz2 |
chrome_frame: Remove several instances of the deprecated wstrings functions
and use their FilePath equivalents.
BUG=24874
TEST=included
Review URL: http://codereview.chromium.org/2125021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.cc | 9 | ||||
-rw-r--r-- | chrome_frame/test/chrome_frame_test_utils.h | 2 | ||||
-rw-r--r-- | chrome_frame/test/html_util_unittests.cc | 26 | ||||
-rw-r--r-- | chrome_frame/test/test_with_web_server.cc | 13 | ||||
-rw-r--r-- | chrome_frame/test_utils.cc | 31 | ||||
-rw-r--r-- | chrome_frame/test_utils.h | 4 |
6 files changed, 43 insertions, 42 deletions
diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index 80f2786..4c6874e 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -35,7 +35,7 @@ const wchar_t kIEBrokerImageName[] = L"ieuser.exe"; const wchar_t kFirefoxImageName[] = L"firefox.exe"; const wchar_t kOperaImageName[] = L"opera.exe"; const wchar_t kSafariImageName[] = L"safari.exe"; -const wchar_t kChromeImageName[] = L"chrome.exe"; +const char kChromeImageName[] = "chrome.exe"; const wchar_t kIEProfileName[] = L"iexplore"; const wchar_t kChromeLauncher[] = L"chrome_launcher.exe"; const int kChromeFrameLongNavigationTimeoutInSeconds = 10; @@ -165,12 +165,11 @@ base::ProcessHandle LaunchSafari(const std::wstring& url) { } base::ProcessHandle LaunchChrome(const std::wstring& url) { - std::wstring path; + FilePath path; PathService::Get(base::DIR_MODULE, &path); - file_util::AppendToPath(&path, kChromeImageName); + path = path.AppendASCII(kChromeImageName); - FilePath exe_path(path); - CommandLine cmd(exe_path); + CommandLine cmd(path); std::wstring args = L"--"; args += ASCIIToWide(switches::kNoFirstRun); args += L" "; diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h index 717b204..022b057 100644 --- a/chrome_frame/test/chrome_frame_test_utils.h +++ b/chrome_frame/test/chrome_frame_test_utils.h @@ -51,7 +51,7 @@ extern const wchar_t kIEBrokerImageName[]; extern const wchar_t kFirefoxImageName[]; extern const wchar_t kOperaImageName[]; extern const wchar_t kSafariImageName[]; -extern const wchar_t kChromeImageName[]; +extern const char kChromeImageName[]; extern const wchar_t kChromeLauncher[]; extern const int kChromeFrameLongNavigationTimeoutInSeconds; diff --git a/chrome_frame/test/html_util_unittests.cc b/chrome_frame/test/html_util_unittests.cc index 1188482..bcd73e9 100644 --- a/chrome_frame/test/html_util_unittests.cc +++ b/chrome_frame/test/html_util_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-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. @@ -33,34 +33,34 @@ class HtmlUtilUnittest : public testing::Test { HtmlUtilUnittest() {} // Returns the test path given a test case. - virtual bool GetTestPath(const std::wstring& test_case, std::wstring* path) { + virtual bool GetTestPath(const std::string& test_case, FilePath* path) { if (!path) { NOTREACHED(); return false; } - std::wstring test_path; + FilePath test_path; if (!PathService::Get(base::DIR_SOURCE_ROOT, &test_path)) { NOTREACHED(); return false; } - file_util::AppendToPath(&test_path, L"chrome_frame"); - file_util::AppendToPath(&test_path, L"test"); - file_util::AppendToPath(&test_path, L"html_util_test_data"); - file_util::AppendToPath(&test_path, test_case); + test_path = test_path.AppendASCII("chrome_frame"); + test_path = test_path.AppendASCII("test"); + test_path = test_path.AppendASCII("html_util_test_data"); + test_path = test_path.AppendASCII(test_case); *path = test_path; return true; } - virtual bool GetTestData(const std::wstring& test_case, std::wstring* data) { + virtual bool GetTestData(const std::string& test_case, std::wstring* data) { if (!data) { NOTREACHED(); return false; } - std::wstring path; + FilePath path; if (!GetTestPath(test_case, &path)) { NOTREACHED(); return false; @@ -78,7 +78,7 @@ class HtmlUtilUnittest : public testing::Test { TEST_F(HtmlUtilUnittest, BasicTest) { std::wstring test_data; - GetTestData(L"basic_test.html", &test_data); + GetTestData("basic_test.html", &test_data); HTMLScanner scanner(test_data.c_str()); @@ -99,7 +99,7 @@ TEST_F(HtmlUtilUnittest, BasicTest) { TEST_F(HtmlUtilUnittest, QuotesTest) { std::wstring test_data; - GetTestData(L"quotes_test.html", &test_data); + GetTestData("quotes_test.html", &test_data); HTMLScanner scanner(test_data.c_str()); @@ -120,7 +120,7 @@ TEST_F(HtmlUtilUnittest, QuotesTest) { TEST_F(HtmlUtilUnittest, DegenerateCasesTest) { std::wstring test_data; - GetTestData(L"degenerate_cases_test.html", &test_data); + GetTestData("degenerate_cases_test.html", &test_data); HTMLScanner scanner(test_data.c_str()); @@ -133,7 +133,7 @@ TEST_F(HtmlUtilUnittest, DegenerateCasesTest) { TEST_F(HtmlUtilUnittest, MultipleTagsTest) { std::wstring test_data; - GetTestData(L"multiple_tags.html", &test_data); + GetTestData("multiple_tags.html", &test_data); HTMLScanner scanner(test_data.c_str()); diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc index 2c95f13..5893716 100644 --- a/chrome_frame/test/test_with_web_server.cc +++ b/chrome_frame/test/test_with_web_server.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 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. #include "chrome_frame/test/test_with_web_server.h" @@ -39,8 +39,9 @@ void ChromeFrameTestWithWebServer::CloseAllBrowsers() { base::KillProcesses(chrome_frame_test::kSafariImageName, 0, NULL); // Endeavour to only kill off Chrome Frame derived Chrome processes. - KillAllNamedProcessesWithArgument(chrome_frame_test::kChromeImageName, - UTF8ToWide(switches::kChromeFrame)); + KillAllNamedProcessesWithArgument( + UTF8ToWide(chrome_frame_test::kChromeImageName), + UTF8ToWide(switches::kChromeFrame)); base::KillProcesses(chrome_frame_test::kChromeLauncher, 0, NULL); } @@ -198,10 +199,10 @@ void ChromeFrameTestWithWebServer::OptionalBrowserTest(BrowserKind browser, void ChromeFrameTestWithWebServer::VersionTest(BrowserKind browser, const wchar_t* page, const wchar_t* result_file_to_check) { - std::wstring plugin_path; + FilePath plugin_path; PathService::Get(base::DIR_MODULE, &plugin_path); - file_util::AppendToPath(&plugin_path, L"servers"); - file_util::AppendToPath(&plugin_path, kChromeFrameDllName); + plugin_path = plugin_path.AppendASCII("servers"); + plugin_path = plugin_path.Append(kChromeFrameDllName); static FileVersionInfo* version_info = FileVersionInfo::CreateFileVersionInfo(plugin_path); diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc index 7f8161a..6e9f6bf 100644 --- a/chrome_frame/test_utils.cc +++ b/chrome_frame/test_utils.cc @@ -21,7 +21,7 @@ const wchar_t kChromeFrameDllName[] = L"npchrome_frame.dll"; const wchar_t kChromeLauncherExeName[] = L"chrome_launcher.exe"; -const wchar_t kReferenceChromeFrameDllName[] = L"npchrome_tab.dll"; +const char kReferenceChromeFrameDllName[] = "npchrome_tab.dll"; // Statics FilePath ScopedChromeFrameRegistrar::GetChromeFrameBuildPath() { @@ -99,20 +99,21 @@ void ScopedChromeFrameRegistrar::UnregisterAtPath( ASSERT_TRUE(FreeLibrary(dll_handle)); } -std::wstring ScopedChromeFrameRegistrar::GetReferenceChromeFrameDllPath() { - std::wstring reference_build_dir; +FilePath ScopedChromeFrameRegistrar::GetReferenceChromeFrameDllPath() { + FilePath reference_build_dir; PathService::Get(chrome::DIR_APP, &reference_build_dir); - file_util::UpOneDirectory(&reference_build_dir); - file_util::UpOneDirectory(&reference_build_dir); - - file_util::AppendToPath(&reference_build_dir, L"chrome_frame"); - file_util::AppendToPath(&reference_build_dir, L"tools"); - file_util::AppendToPath(&reference_build_dir, L"test"); - file_util::AppendToPath(&reference_build_dir, L"reference_build"); - file_util::AppendToPath(&reference_build_dir, L"chrome"); - file_util::AppendToPath(&reference_build_dir, L"servers"); - file_util::AppendToPath(&reference_build_dir, kReferenceChromeFrameDllName); + reference_build_dir = reference_build_dir.DirName(); + reference_build_dir = reference_build_dir.DirName(); + + reference_build_dir = reference_build_dir.AppendASCII("chrome_frame"); + reference_build_dir = reference_build_dir.AppendASCII("tools"); + reference_build_dir = reference_build_dir.AppendASCII("test"); + reference_build_dir = reference_build_dir.AppendASCII("reference_build"); + reference_build_dir = reference_build_dir.AppendASCII("chrome"); + reference_build_dir = reference_build_dir.AppendASCII("servers"); + reference_build_dir = reference_build_dir.AppendASCII( + kReferenceChromeFrameDllName); return reference_build_dir; } @@ -125,7 +126,7 @@ ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar( } ScopedChromeFrameRegistrar::ScopedChromeFrameRegistrar() { - original_dll_path_ = GetChromeFrameBuildPath().ToWStringHack(); + original_dll_path_ = GetChromeFrameBuildPath().value(); RegisterChromeFrameAtPath(original_dll_path_); } @@ -142,7 +143,7 @@ void ScopedChromeFrameRegistrar::RegisterChromeFrameAtPath( } void ScopedChromeFrameRegistrar::RegisterReferenceChromeFrameBuild() { - RegisterChromeFrameAtPath(GetReferenceChromeFrameDllPath()); + RegisterChromeFrameAtPath(GetReferenceChromeFrameDllPath().value()); } std::wstring ScopedChromeFrameRegistrar::GetChromeFrameDllPath() const { diff --git a/chrome_frame/test_utils.h b/chrome_frame/test_utils.h index ab8b03e..741d541 100644 --- a/chrome_frame/test_utils.h +++ b/chrome_frame/test_utils.h @@ -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. @@ -39,7 +39,7 @@ class ScopedChromeFrameRegistrar { static void RegisterAtPath(const std::wstring& path); static void UnregisterAtPath(const std::wstring& path); static void RegisterDefaults(); - static std::wstring GetReferenceChromeFrameDllPath(); + static FilePath GetReferenceChromeFrameDllPath(); private: // Contains the path of the most recently registered Chrome Frame DLL. |