diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-01 04:31:22 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-01 04:31:22 +0000 |
commit | 4f09393e0d9f357a271353b727246864378fdf17 (patch) | |
tree | c3b561d3384c9287cb11f545fa6adcae9b8d5a55 /webkit/tools | |
parent | e0291ec704fd21a4e99e99c60766c768f58ebcb3 (diff) | |
download | chromium_src-4f09393e0d9f357a271353b727246864378fdf17.zip chromium_src-4f09393e0d9f357a271353b727246864378fdf17.tar.gz chromium_src-4f09393e0d9f357a271353b727246864378fdf17.tar.bz2 |
Deprecate wstring version of PathService::Get() in webkit.
Review URL: http://codereview.chromium.org/99266
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15032 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/test_shell/image_decoder_unittest.cc | 5 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/node_leak_test.cc | 10 | ||||
-rwxr-xr-x | webkit/tools/test_shell/test_shell.cc | 19 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_main.cc | 32 |
5 files changed, 41 insertions, 33 deletions
diff --git a/webkit/tools/test_shell/image_decoder_unittest.cc b/webkit/tools/test_shell/image_decoder_unittest.cc index 6db9de6..f4c9b72 100644 --- a/webkit/tools/test_shell/image_decoder_unittest.cc +++ b/webkit/tools/test_shell/image_decoder_unittest.cc @@ -6,6 +6,7 @@ #include "webkit/tools/test_shell/image_decoder_unittest.h" +#include "base/file_path.h" #include "base/file_util.h" #include "base/md5.h" #include "base/path_service.h" @@ -78,7 +79,9 @@ void VerifyImage(WebCore::ImageDecoder* decoder, #endif void ImageDecoderTest::SetUp() { - ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir_)); + FilePath data_dir; + ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &data_dir)); + data_dir_ = data_dir.ToWStringHack(); file_util::AppendToPath(&data_dir_, L"webkit"); file_util::AppendToPath(&data_dir_, L"data"); file_util::AppendToPath(&data_dir_, format_ + L"_decoder"); diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc index 70d6163..77192d5 100644 --- a/webkit/tools/test_shell/layout_test_controller.cc +++ b/webkit/tools/test_shell/layout_test_controller.cc @@ -9,7 +9,7 @@ #include "webkit/tools/test_shell/layout_test_controller.h" #include "base/basictypes.h" -#include "base/file_util.h" +#include "base/file_path.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/path_service.h" @@ -596,10 +596,10 @@ void LayoutTestController::pathToLocalResource( std::string url = args[0].ToString(); if (StartsWithASCII(url, "/tmp/", true)) { // We want a temp file. - std::wstring path; + FilePath path; PathService::Get(base::DIR_TEMP, &path); - file_util::AppendToPath(&path, UTF8ToWide(url.substr(5))); - result->Set(WideToUTF8(path)); + path = path.AppendASCII(url.substr(5)); + result->Set(WideToUTF8(path.ToWStringHack())); return; } diff --git a/webkit/tools/test_shell/node_leak_test.cc b/webkit/tools/test_shell/node_leak_test.cc index 91ee6e8..dd87bef 100644 --- a/webkit/tools/test_shell/node_leak_test.cc +++ b/webkit/tools/test_shell/node_leak_test.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "base/command_line.h" -#include "base/file_util.h" +#include "base/file_path.h" #include "base/path_service.h" #include "base/string_util.h" #include "net/http/http_cache.h" @@ -37,11 +37,11 @@ class NodeLeakTest : public TestShellTest { js_flags += L" --expose-gc"; webkit_glue::SetJavaScriptFlags(js_flags); - std::wstring cache_path = - parsed_command_line.GetSwitchValue(test_shell::kCacheDir); + FilePath cache_path = FilePath::FromWStringHack( + parsed_command_line.GetSwitchValue(test_shell::kCacheDir)); if (cache_path.empty()) { PathService::Get(base::DIR_EXE, &cache_path); - file_util::AppendToPath(&cache_path, L"cache"); + cache_path = cache_path.AppendASCII("cache"); } if (parsed_command_line.HasSwitch(test_shell::kTestShellTimeOut)) { @@ -58,7 +58,7 @@ class NodeLeakTest : public TestShellTest { parsed_command_line.HasSwitch(test_shell::kPlaybackMode) ? net::HttpCache::PLAYBACK : net::HttpCache::NORMAL; SimpleResourceLoaderBridge::Init( - new TestShellRequestContext(cache_path, mode, false)); + new TestShellRequestContext(cache_path.ToWStringHack(), mode, false)); TestShellTest::SetUp(); } diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index 3bef466..96a5ca5 100755 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -66,13 +66,12 @@ class URLRequestTestShellFileJob : public URLRequestFileJob { static URLRequestJob* InspectorFactory(URLRequest* request, const std::string& scheme) { - std::wstring path; + FilePath path; PathService::Get(base::DIR_EXE, &path); - file_util::AppendToPath(&path, L"resources"); - file_util::AppendToPath(&path, L"inspector"); - file_util::AppendToPath(&path, UTF8ToWide(request->url().path())); - return new URLRequestTestShellFileJob(request, - FilePath::FromWStringHack(path)); + path = path.AppendASCII("resources"); + path = path.AppendASCII("inspector"); + path = path.AppendASCII(request->url().path()); + return new URLRequestTestShellFileJob(request, path); } private: @@ -583,7 +582,11 @@ void AppendToLog(const char* file, int line, const char* msg) { } bool GetApplicationDirectory(std::wstring *path) { - return PathService::Get(base::DIR_EXE, path); + bool r; + FilePath fp; + r = PathService::Get(base::DIR_EXE, &fp); + *path = fp.ToWStringHack(); + return r; } GURL GetInspectorURL() { @@ -595,7 +598,7 @@ std::string GetUIResourceProtocol() { } bool GetExeDirectory(std::wstring *path) { - return PathService::Get(base::DIR_EXE, path); + return GetApplicationDirectory(path); } bool SpellCheckWord(const wchar_t* word, int word_len, diff --git a/webkit/tools/test_shell/test_shell_main.cc b/webkit/tools/test_shell/test_shell_main.cc index 2e21b1b..6e8a385 100644 --- a/webkit/tools/test_shell/test_shell_main.cc +++ b/webkit/tools/test_shell/test_shell_main.cc @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/command_line.h" #include "base/event_recorder.h" +#include "base/file_path.h" #include "base/file_util.h" #include "base/icu_util.h" #include "base/memory_debug.h" @@ -122,20 +123,21 @@ int main(int argc, char* argv[]) { parsed_command_line.HasSwitch(test_shell::kEnableFileCookies)) net::CookieMonster::EnableFileScheme(); - std::wstring cache_path = - parsed_command_line.GetSwitchValue(test_shell::kCacheDir); + FilePath cache_path = FilePath::FromWStringHack( + parsed_command_line.GetSwitchValue(test_shell::kCacheDir)); // If the cache_path is empty and it's layout_test_mode, leave it empty // so we use an in-memory cache. This makes running multiple test_shells // in parallel less flaky. if (cache_path.empty() && !layout_test_mode) { PathService::Get(base::DIR_EXE, &cache_path); - file_util::AppendToPath(&cache_path, L"cache"); + cache_path = cache_path.AppendASCII("cache"); } // Initializing with a default context, which means no on-disk cookie DB, // and no support for directory listings. SimpleResourceLoaderBridge::Init( - new TestShellRequestContext(cache_path, cache_mode, layout_test_mode)); + new TestShellRequestContext(cache_path.ToWStringHack(), + cache_mode, layout_test_mode)); // Load ICU data tables icu_util::Initialize(); @@ -169,20 +171,20 @@ int main(int argc, char* argv[]) { } // Treat the first loose value as the initial URL to open. - std::wstring uri; + FilePath uri; // Default to a homepage if we're interactive. if (!layout_test_mode) { PathService::Get(base::DIR_SOURCE_ROOT, &uri); - file_util::AppendToPath(&uri, L"webkit"); - file_util::AppendToPath(&uri, L"data"); - file_util::AppendToPath(&uri, L"test_shell"); - file_util::AppendToPath(&uri, L"index.html"); + uri = uri.AppendASCII("webkit"); + uri = uri.AppendASCII("data"); + uri = uri.AppendASCII("test_shell"); + uri = uri.AppendASCII("index.html"); } std::vector<std::wstring> loose_values = parsed_command_line.GetLooseValues(); if (loose_values.size() > 0) - uri = loose_values[0]; + uri = FilePath::FromWStringHack(loose_values[0]); std::wstring js_flags = parsed_command_line.GetSwitchValue(test_shell::kJavaScriptFlags); @@ -207,7 +209,7 @@ int main(int argc, char* argv[]) { StatsTable::set_current(table); TestShell* shell; - if (TestShell::CreateNewWindow(uri, &shell)) { + if (TestShell::CreateNewWindow(uri.ToWStringHack(), &shell)) { if (record_mode || playback_mode) { platform.SetWindowPositionForRecording(shell); WebKit::registerExtension(extensions_v8::PlaybackExtension::Get()); @@ -220,10 +222,10 @@ int main(int argc, char* argv[]) { bool no_events = parsed_command_line.HasSwitch(test_shell::kNoEvents); if ((record_mode || playback_mode) && !no_events) { - std::wstring script_path = cache_path; + FilePath script_path = cache_path; // Create the cache directory in case it doesn't exist. file_util::CreateDirectory(cache_path); - file_util::AppendToPath(&script_path, L"script.log"); + script_path = script_path.AppendASCII("script.log"); if (record_mode) base::EventRecorder::current()->StartRecording(script_path); if (playback_mode) @@ -259,7 +261,7 @@ int main(int argc, char* argv[]) { params.dump_tree = false; } - if (uri.length() == 0) { + if (uri.empty()) { // Watch stdin for URLs. char filenameBuffer[kPathBufSize]; while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { @@ -293,7 +295,7 @@ int main(int argc, char* argv[]) { } else { // TODO(ojan): Provide a way for run-singly tests to pass // in a hash and then set params.pixel_hash here. - params.test_url = WideToUTF8(uri).c_str(); + params.test_url = WideToUTF8(uri.ToWStringHack()).c_str(); TestShell::RunFileTest(params); } |