diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 21:28:56 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-04 21:28:56 +0000 |
commit | 461f028ab0acdd69a5af64cf45c84e91eb41396c (patch) | |
tree | d1b89cf6e6dff544ecfff0424f4f0b728b540f49 | |
parent | dee7c0509d0e98d1210725aad2ce6e5153780592 (diff) | |
download | chromium_src-461f028ab0acdd69a5af64cf45c84e91eb41396c.zip chromium_src-461f028ab0acdd69a5af64cf45c84e91eb41396c.tar.gz chromium_src-461f028ab0acdd69a5af64cf45c84e91eb41396c.tar.bz2 |
Revert "Remove GetSwitchValue() from chrome/* where easy."
This reverts commit r54966.
Meant to try it, not commit it, sorry everyone. :(
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54969 0039d316-1c4b-4281-b951-d872f2087c98
25 files changed, 111 insertions, 131 deletions
diff --git a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc index f763b51c..9cc1b53 100644 --- a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc +++ b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc @@ -345,9 +345,8 @@ TEST(SafeBrowsingBloomFilter, HashTime) { int num_checks = kNumHashChecks; if (cmd_line.HasSwitch(kFilterNumChecks)) { - ASSERT_TRUE( - base::StringToInt(cmd_line.GetSwitchValueASCII(kFilterNumChecks), - &num_checks)); + ASSERT_TRUE(base::StringToInt(cmd_line.GetSwitchValue(kFilterNumChecks), + &num_checks)); } // Populate the bloom filter and measure the time. diff --git a/chrome/common/chrome_plugin_util.cc b/chrome/common/chrome_plugin_util.cc index 649975f..33b8345 100644 --- a/chrome/common/chrome_plugin_util.cc +++ b/chrome/common/chrome_plugin_util.cc @@ -141,11 +141,11 @@ CPError CPB_GetCommandLineArgumentsCommon(const char* url, } } -#if defined(OS_CHROMEOS) - FilePath profile = cmd.GetSwitchValuePath(switches::kLoginProfile); +#if defined (OS_CHROMEOS) + std::wstring profile = cmd.GetSwitchValue(switches::kLoginProfile); if (!profile.empty()) { arguments_w += std::wstring(L"--") + ASCIIToWide(switches::kLoginProfile) + - L"=\"" + profile.ToWStringHack() + L"\" "; + L"=\"" + profile + L"\" "; } #endif diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc index 7ce41d7..dcc8074 100644 --- a/chrome/common/pepper_plugin_registry.cc +++ b/chrome/common/pepper_plugin_registry.cc @@ -54,9 +54,8 @@ void PepperPluginRegistry::PreloadModules() { // static void PepperPluginRegistry::GetPluginInfoFromSwitch( std::vector<PepperPluginInfo>* plugins) { - const std::string value = - CommandLine::ForCurrentProcess()->GetSwitchValueASCII( - switches::kRegisterPepperPlugins); + const std::wstring& value = CommandLine::ForCurrentProcess()->GetSwitchValue( + switches::kRegisterPepperPlugins); if (value.empty()) return; @@ -65,31 +64,27 @@ void PepperPluginRegistry::GetPluginInfoFromSwitch( // plugin-entry = <file-path> + ["#" + <name> + ["#" + <description>]] + // *1( LWS + ";" + LWS + <mime-type> ) - std::vector<std::string> modules; + std::vector<std::wstring> modules; SplitString(value, ',', &modules); for (size_t i = 0; i < modules.size(); ++i) { - std::vector<std::string> parts; + std::vector<std::wstring> parts; SplitString(modules[i], ';', &parts); if (parts.size() < 2) { DLOG(ERROR) << "Required mime-type not found"; continue; } - std::vector<std::string> name_parts; + std::vector<std::wstring> name_parts; SplitString(parts[0], '#', &name_parts); PepperPluginInfo plugin; -#if defined(OS_WIN) - plugin.path = FilePath(ASCIIToUTF16(name_parts[0])); -#else - plugin.path = FilePath(name_parts[0]); -#endif + plugin.path = FilePath::FromWStringHack(name_parts[0]); if (name_parts.size() > 1) - plugin.name = name_parts[1]; + plugin.name = WideToUTF8(name_parts[1]); if (name_parts.size() > 2) - plugin.type_descriptions = name_parts[2]; + plugin.type_descriptions = WideToUTF8(name_parts[2]); for (size_t j = 1; j < parts.size(); ++j) - plugin.mime_types.push_back(parts[j]); + plugin.mime_types.push_back(WideToASCII(parts[j])); plugins->push_back(plugin); } diff --git a/chrome/common/sandbox_init_wrapper_mac.cc b/chrome/common/sandbox_init_wrapper_mac.cc index 79cf08f..1b8e2d9 100644 --- a/chrome/common/sandbox_init_wrapper_mac.cc +++ b/chrome/common/sandbox_init_wrapper_mac.cc @@ -41,8 +41,8 @@ bool SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line, } else if (process_type == switches::kUtilityProcess) { // Utility process sandbox. sandbox_process_type = sandbox::SANDBOX_TYPE_UTILITY; - allowed_dir = - command_line.GetSwitchValuePath(switches::kUtilityProcessAllowedDir); + allowed_dir = FilePath::FromWStringHack( + command_line.GetSwitchValue(switches::kUtilityProcessAllowedDir)); } else if (process_type == switches::kWorkerProcess) { // Worker process sandbox. sandbox_process_type = sandbox::SANDBOX_TYPE_WORKER; diff --git a/chrome/common/sandbox_policy.cc b/chrome/common/sandbox_policy.cc index b5b2404a..bef0478 100644 --- a/chrome/common/sandbox_policy.cc +++ b/chrome/common/sandbox_policy.cc @@ -341,9 +341,9 @@ bool ApplyPolicyForBuiltInFlashPlugin(sandbox::TargetPolicy* policy) { bool AddPolicyForPlugin(const CommandLine* cmd_line, sandbox::TargetPolicy* policy) { std::wstring plugin_dll = cmd_line-> - GetSwitchValueNative(switches::kPluginPath); + GetSwitchValue(switches::kPluginPath); std::wstring trusted_plugins = CommandLine::ForCurrentProcess()-> - GetSwitchValueNative(switches::kTrustedPlugins); + GetSwitchValue(switches::kTrustedPlugins); // Add the policy for the pipes. sandbox::ResultCode result = sandbox::SBOX_ALL_OK; result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index b2e66a3..08e9ae5 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -232,7 +232,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, // If --install-archive is given, get the user specified value if (cmd_line.HasSwitch(installer_util::switches::kInstallArchive)) { - archive = cmd_line.GetSwitchValueNative( + archive = cmd_line.GetSwitchValue( installer_util::switches::kInstallArchive); } LOG(INFO) << "Archive found to install Chrome " << archive; @@ -288,7 +288,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, // uncompressing and binary patching. Get the location for this file. std::wstring archive_to_copy(temp_path.ToWStringHack()); file_util::AppendToPath(&archive_to_copy, installer::kChromeArchive); - std::wstring prefs_source_path = cmd_line.GetSwitchValueNative( + std::wstring prefs_source_path = cmd_line.GetSwitchValue( installer_util::switches::kInstallerData); install_status = installer::InstallOrUpdateChrome( cmd_line.program(), archive_to_copy, temp_path.ToWStringHack(), @@ -355,7 +355,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, LOG(INFO) << "Deleting temporary directory " << temp_path.value(); bool cleanup_success = file_util::Delete(temp_path, true); if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { - std::wstring prefs_path = cmd_line.GetSwitchValueNative( + std::wstring prefs_path = cmd_line.GetSwitchValue( installer_util::switches::kInstallerData); cleanup_success = file_util::Delete(prefs_path, true) && cleanup_success; } @@ -369,7 +369,7 @@ installer_util::InstallStatus InstallChrome(const CommandLine& cmd_line, if (!cleanup_success) { ScheduleDirectoryForDeletion(temp_path.ToWStringHack().c_str()); if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { - std::wstring prefs_path = cmd_line.GetSwitchValueNative( + std::wstring prefs_path = cmd_line.GetSwitchValue( installer_util::switches::kInstallerData); ScheduleDirectoryForDeletion(prefs_path.c_str()); } @@ -447,14 +447,14 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, if (!file_util::CreateNewTempDirectory(L"chrome_", &temp_path)) { LOG(ERROR) << "Could not create temporary path."; } else { - std::wstring setup_patch = cmd_line.GetSwitchValueNative( + std::wstring setup_patch = cmd_line.GetSwitchValue( installer_util::switches::kUpdateSetupExe); LOG(INFO) << "Opening archive " << setup_patch; std::wstring uncompressed_patch; if (LzmaUtil::UnPackArchive(setup_patch, temp_path.ToWStringHack(), &uncompressed_patch) == NO_ERROR) { std::wstring old_setup_exe = cmd_line.program(); - std::wstring new_setup_exe = cmd_line.GetSwitchValueNative( + std::wstring new_setup_exe = cmd_line.GetSwitchValue( installer_util::switches::kNewSetupExe); if (!setup_util::ApplyDiffPatch(old_setup_exe, uncompressed_patch, new_setup_exe)) @@ -474,7 +474,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, // Check if we need to show the EULA. If it is passed as a command line // then the dialog is shown and regardless of the outcome setup exits here. std::wstring inner_frame = - cmd_line.GetSwitchValueNative(installer_util::switches::kShowEula); + cmd_line.GetSwitchValue(installer_util::switches::kShowEula); exit_code = ShowEULADialog(inner_frame); if (installer_util::EULA_REJECTED != exit_code) GoogleUpdateSettings::SetEULAConsent(true); @@ -486,12 +486,12 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, // browser for Start Menu->Internet shortcut. This option should only // be used when setup.exe is launched with admin rights. We do not // make any user specific changes in this option. - std::wstring chrome_exe(cmd_line.GetSwitchValueNative( + std::wstring chrome_exe(cmd_line.GetSwitchValue( installer_util::switches::kRegisterChromeBrowser)); std::wstring suffix; if (cmd_line.HasSwitch( installer_util::switches::kRegisterChromeBrowserSuffix)) { - suffix = cmd_line.GetSwitchValueNative( + suffix = cmd_line.GetSwitchValue( installer_util::switches::kRegisterChromeBrowserSuffix); } exit_code = ShellUtil::RegisterChromeBrowser(chrome_exe, suffix, false); @@ -510,7 +510,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, std::wstring suffix; if (cmd_line.HasSwitch( installer_util::switches::kRegisterChromeBrowserSuffix)) { - suffix = cmd_line.GetSwitchValueNative( + suffix = cmd_line.GetSwitchValue( installer_util::switches::kRegisterChromeBrowserSuffix); } installer_util::InstallStatus tmp = installer_util::UNKNOWN_STATUS; @@ -521,8 +521,7 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { // Launch the inactive user toast experiment. std::wstring flavor = - cmd_line.GetSwitchValueNative( - installer_util::switches::kInactiveUserToast); + cmd_line.GetSwitchValue(installer_util::switches::kInactiveUserToast); int flavor_int; base::StringToInt(flavor, &flavor_int); dist->InactiveUserToastExperiment(flavor_int, diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 9dfda73..3f11eb5 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -29,7 +29,7 @@ void InitInstallerLogging(const CommandLine& command_line) { return; } - logging::InitLogging(GetLogFilePath(command_line).value().c_str(), + logging::InitLogging(GetLogFilePath(command_line).c_str(), logging::LOG_ONLY_TO_FILE, logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE); @@ -50,10 +50,10 @@ void EndInstallerLogging() { installer_logging_ = false; } -FilePath GetLogFilePath(const CommandLine& command_line) { +std::wstring GetLogFilePath(const CommandLine& command_line) { if (command_line.HasSwitch( WideToASCII(installer_util::switches::kLogFile))) { - return command_line.GetSwitchValuePath( + return command_line.GetSwitchValue( WideToASCII(installer_util::switches::kLogFile)); } @@ -65,11 +65,12 @@ FilePath GetLogFilePath(const CommandLine& command_line) { } FilePath log_path; + if (PathService::Get(base::DIR_TEMP, &log_path)) { log_path = log_path.Append(log_filename); - return log_path; + return log_path.ToWStringHack(); } else { - return FilePath(log_filename); + return log_filename; } } diff --git a/chrome/installer/util/logging_installer.h b/chrome/installer/util/logging_installer.h index 50882dc..c2b0a96 100644 --- a/chrome/installer/util/logging_installer.h +++ b/chrome/installer/util/logging_installer.h @@ -11,7 +11,6 @@ #include "base/logging.h" class CommandLine; -class FilePath; namespace installer { @@ -22,7 +21,7 @@ void InitInstallerLogging(const CommandLine& command_line); void EndInstallerLogging(); // Returns the full path of the log file. -FilePath GetLogFilePath(const CommandLine& command_line); +std::wstring GetLogFilePath(const CommandLine& command_line); } // namespace installer diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 63967d0..053dc45 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -5,7 +5,6 @@ #include "chrome/installer/util/master_preferences.h" #include "base/file_util.h" -#include "base/string_util.h" #include "base/logging.h" #include "base/path_service.h" #include "chrome/common/json_value_serializer.h" @@ -106,10 +105,9 @@ bool GetDistroIntegerPreference(const DictionaryValue* prefs, DictionaryValue* GetInstallPreferences(const CommandLine& cmd_line) { DictionaryValue* prefs = NULL; #if defined(OS_WIN) - std::string installer_data = - WideToASCII(installer_util::switches::kInstallerData); - if (cmd_line.HasSwitch(installer_data)) { - FilePath prefs_path = cmd_line.GetSwitchValuePath(installer_data); + if (cmd_line.HasSwitch(installer_util::switches::kInstallerData)) { + FilePath prefs_path( + cmd_line.GetSwitchValue(installer_util::switches::kInstallerData)); prefs = installer_util::ParseDistributionPreferences(prefs_path); } diff --git a/chrome/nacl/nacl_main_platform_delegate_win.cc b/chrome/nacl/nacl_main_platform_delegate_win.cc index 3cf140ca..df01489 100644 --- a/chrome/nacl/nacl_main_platform_delegate_win.cc +++ b/chrome/nacl/nacl_main_platform_delegate_win.cc @@ -34,7 +34,7 @@ void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { if (target_services && !no_sandbox) { std::wstring test_dll_name = - command_line.GetSwitchValueNative(switches::kTestNaClSandbox); + command_line.GetSwitchValue(switches::kTestNaClSandbox); if (!test_dll_name.empty()) { // At this point, hack on the suffix according to with bitness // of your windows process. diff --git a/chrome/plugin/plugin_main.cc b/chrome/plugin/plugin_main.cc index 8313b68..2f16e63 100644 --- a/chrome/plugin/plugin_main.cc +++ b/chrome/plugin/plugin_main.cc @@ -94,7 +94,7 @@ int PluginMain(const MainFunctionParams& parameters) { // The command line might specify a test plugin to load. if (parsed_command_line.HasSwitch(switches::kTestSandbox)) { std::wstring test_plugin_name = - parsed_command_line.GetSwitchValueNative(switches::kTestSandbox); + parsed_command_line.GetSwitchValue(switches::kTestSandbox); sandbox_test_module = LoadLibrary(test_plugin_name.c_str()); DCHECK(sandbox_test_module); } diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc index 00c42fe..9bc8561 100644 --- a/chrome/plugin/webplugin_delegate_stub.cc +++ b/chrome/plugin/webplugin_delegate_stub.cc @@ -165,9 +165,9 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, } const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - FilePath path = - command_line.GetSwitchValuePath(switches::kPluginPath) -; + FilePath path = FilePath::FromWStringHack( + command_line.GetSwitchValue(switches::kPluginPath)); + gfx::PluginWindowHandle parent = gfx::kNullPluginWindow; #if defined(OS_WIN) diff --git a/chrome/renderer/devtools_client.cc b/chrome/renderer/devtools_client.cc index 3e3a47e..81b6f73 100644 --- a/chrome/renderer/devtools_client.cc +++ b/chrome/renderer/devtools_client.cc @@ -24,7 +24,7 @@ DevToolsClient::DevToolsClient(RenderView* view) WebDevToolsFrontend::create( view->webview(), this, - ASCIIToUTF16(command_line.GetSwitchValueASCII(switches::kLang)))); + WideToUTF16Hack(command_line.GetSwitchValue(switches::kLang)))); } DevToolsClient::~DevToolsClient() { diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc index 5339708..daf873a 100644 --- a/chrome/renderer/renderer_main.cc +++ b/chrome/renderer/renderer_main.cc @@ -255,8 +255,8 @@ int RendererMain(const MainFunctionParams& parameters) { FieldTrialList field_trial; // Ensure any field trials in browser are reflected into renderer. if (parsed_command_line.HasSwitch(switches::kForceFieldTestNameAndValue)) { - std::string persistent = parsed_command_line.GetSwitchValueASCII( - switches::kForceFieldTestNameAndValue); + std::string persistent(WideToASCII(parsed_command_line.GetSwitchValue( + switches::kForceFieldTestNameAndValue))); bool ret = field_trial.StringAugmentsState(persistent); DCHECK(ret); } diff --git a/chrome/renderer/renderer_main_platform_delegate_win.cc b/chrome/renderer/renderer_main_platform_delegate_win.cc index 104eba5..d5cca59 100644 --- a/chrome/renderer/renderer_main_platform_delegate_win.cc +++ b/chrome/renderer/renderer_main_platform_delegate_win.cc @@ -102,7 +102,7 @@ bool RendererMainPlatformDelegate::InitSandboxTests(bool no_sandbox) { if (target_services && !no_sandbox) { std::wstring test_dll_name = - command_line.GetSwitchValueNative(switches::kTestSandbox); + command_line.GetSwitchValue(switches::kTestSandbox); if (!test_dll_name.empty()) { sandbox_test_module_ = LoadLibrary(test_dll_name.c_str()); DCHECK(sandbox_test_module_); diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc index 8903517..6d877dc 100644 --- a/chrome/test/mini_installer_test/test.cc +++ b/chrome/test/mini_installer_test/test.cc @@ -53,8 +53,7 @@ class MiniInstallTest : public testing::Test { virtual void SetUp() { // Parse test command-line arguments. const CommandLine* cmd = CommandLine::ForCurrentProcess(); - std::wstring build = - cmd->GetSwitchValueNative(switches::kInstallerTestBuild); + std::wstring build = cmd->GetSwitchValue(switches::kInstallerTestBuild); if (build.empty()) build = L"latest"; force_tests_ = cmd->HasSwitch(switches::kInstallerTestForce); diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index 4c77378..abf83ca 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -628,13 +628,11 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kStartPageSwitch)) { ASSERT_TRUE(parsed_command_line.HasSwitch(kEndPageSwitch)); ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValueASCII( - kStartPageSwitch), - &g_start_page)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kStartPageSwitch)), &g_start_page)); ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValueASCII( - kEndPageSwitch), - &g_end_page)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kEndPageSwitch)), &g_end_page)); ASSERT_TRUE(g_start_page > 0 && g_end_page > 0); ASSERT_TRUE(g_start_page < g_end_page); g_append_page_id = true; @@ -643,22 +641,20 @@ void SetPageRange(const CommandLine& parsed_command_line) { } if (parsed_command_line.HasSwitch(kSiteSwitch)) { - g_server_url = parsed_command_line.GetSwitchValueASCII(kSiteSwitch); + g_server_url = WideToUTF8(parsed_command_line.GetSwitchValue(kSiteSwitch)); } if (parsed_command_line.HasSwitch(kStartIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValueASCII( - kStartIndexSwitch), - &g_start_index)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kStartIndexSwitch)), &g_start_index)); ASSERT_GT(g_start_index, 0); } if (parsed_command_line.HasSwitch(kEndIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValueASCII( - kEndIndexSwitch), - &g_end_index)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kEndIndexSwitch)), &g_end_index)); ASSERT_GT(g_end_index, 0); } @@ -669,9 +665,8 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kIterationSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValueASCII( - kIterationSwitch), - &g_iterations)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kIterationSwitch)), &g_iterations)); ASSERT_GT(g_iterations, 0); } @@ -681,17 +676,18 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kContinuousLoadSwitch)) g_continuous_load = true; - if (parsed_command_line.HasSwitch(kEndURLSwitch)) - g_end_url = parsed_command_line.GetSwitchValueASCII(kEndURLSwitch); + if (parsed_command_line.HasSwitch(kEndURLSwitch)) { + g_end_url = WideToUTF8( + parsed_command_line.GetSwitchValue(kEndURLSwitch)); + } if (parsed_command_line.HasSwitch(kLogFileSwitch)) g_log_file_path = parsed_command_line.GetSwitchValuePath(kLogFileSwitch); if (parsed_command_line.HasSwitch(kTimeoutSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValueASCII( - kTimeoutSwitch), - &g_timeout_ms)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kTimeoutSwitch)), &g_timeout_ms)); ASSERT_GT(g_timeout_ms, 0); } diff --git a/chrome/test/test_launcher/out_of_proc_test_runner.cc b/chrome/test/test_launcher/out_of_proc_test_runner.cc index eb4e172..2401a36 100644 --- a/chrome/test/test_launcher/out_of_proc_test_runner.cc +++ b/chrome/test/test_launcher/out_of_proc_test_runner.cc @@ -86,10 +86,10 @@ class OutOfProcTestRunner : public tests::TestRunner { int test_terminate_timeout_ms = kDefaultTestTimeoutMs; if (cmd_line->HasSwitch(kTestTerminateTimeoutFlag)) { - std::string timeout_str = - cmd_line->GetSwitchValueASCII(kTestTerminateTimeoutFlag); + std::wstring timeout_str( + cmd_line->GetSwitchValue(kTestTerminateTimeoutFlag)); int timeout; - base::StringToInt(timeout_str, &timeout); + base::StringToInt(WideToUTF8(timeout_str), &timeout); test_terminate_timeout_ms = std::max(test_terminate_timeout_ms, timeout); } diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc index a80718f..bef3801 100644 --- a/chrome/test/ui/ui_test.cc +++ b/chrome/test/ui/ui_test.cc @@ -214,41 +214,41 @@ void UITestBase::TearDown() { void UITestBase::InitializeTimeouts() { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(kUiTestTimeout)) { - std::string timeout_str = command_line.GetSwitchValueASCII(kUiTestTimeout); + std::wstring timeout_str = command_line.GetSwitchValue(kUiTestTimeout); int timeout; - base::StringToInt(timeout_str, &timeout); + base::StringToInt(WideToUTF8(timeout_str), &timeout); command_execution_timeout_ms_ = std::max(kCommandExecutionTimeout, timeout); } if (command_line.HasSwitch(kUiTestActionTimeout)) { - std::string act_str = - command_line.GetSwitchValueASCII(kUiTestActionTimeout); + std::wstring act_str = command_line.GetSwitchValue(kUiTestActionTimeout); int act_timeout; - base::StringToInt(act_str, &act_timeout); + base::StringToInt(WideToUTF8(act_str), &act_timeout); action_timeout_ms_ = std::max(kWaitForActionMsec, act_timeout); } if (command_line.HasSwitch(kUiTestActionMaxTimeout)) { - std::string action_max_str = - command_line.GetSwitchValueASCII(kUiTestActionMaxTimeout); + std::wstring action_max_str = + command_line.GetSwitchValue(kUiTestActionMaxTimeout); int max_timeout; - base::StringToInt(action_max_str, &max_timeout); + base::StringToInt(WideToUTF8(action_max_str), &max_timeout); action_max_timeout_ms_ = std::max(kWaitForActionMaxMsec, max_timeout); } if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestSleepTimeout)) { - std::string sleep_timeout_str = - command_line.GetSwitchValueASCII(kUiTestSleepTimeout); + std::wstring sleep_timeout_str = + CommandLine::ForCurrentProcess()->GetSwitchValue(kUiTestSleepTimeout); int sleep_timeout; - base::StringToInt(sleep_timeout_str, &sleep_timeout); + base::StringToInt(WideToUTF8(sleep_timeout_str), &sleep_timeout); sleep_timeout_ms_ = std::max(kWaitForActionMsec, sleep_timeout); } if (CommandLine::ForCurrentProcess()->HasSwitch(kUiTestTerminateTimeout)) { - std::string terminate_timeout_str = - command_line.GetSwitchValueASCII(kUiTestTerminateTimeout); + std::wstring terminate_timeout_str = + CommandLine::ForCurrentProcess()->GetSwitchValue( + kUiTestTerminateTimeout); int terminate_timeout; - base::StringToInt(terminate_timeout_str, &terminate_timeout); + base::StringToInt(WideToUTF8(terminate_timeout_str), &terminate_timeout); terminate_timeout_ms_ = std::max(kWaitForActionMsec, terminate_timeout); } } diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc index 3d6d068..5ba7f1f 100644 --- a/chrome/test/ui/ui_test_suite.cc +++ b/chrome/test/ui/ui_test_suite.cc @@ -49,26 +49,26 @@ void UITestSuite::Initialize() { parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK)); UITest::set_disable_breakpad( parsed_command_line.HasSwitch(switches::kDisableBreakpad)); - std::string test_timeout = - parsed_command_line.GetSwitchValueASCII(UITestSuite::kTestTimeout); + std::wstring test_timeout = + parsed_command_line.GetSwitchValue(UITestSuite::kTestTimeout); if (!test_timeout.empty()) { int timeout; - base::StringToInt(test_timeout, &timeout); + base::StringToInt(WideToUTF8(test_timeout), &timeout); UITest::set_test_timeout_ms(timeout); } #if defined(OS_WIN) int batch_count = 0; int batch_index = 0; - std::string batch_count_str = - parsed_command_line.GetSwitchValueASCII(UITestSuite::kBatchCount); + std::wstring batch_count_str = + parsed_command_line.GetSwitchValue(UITestSuite::kBatchCount); if (!batch_count_str.empty()) { - base::StringToInt(batch_count_str, &batch_count); + base::StringToInt(WideToUTF16Hack(batch_count_str), &batch_count); } - std::string batch_index_str = - parsed_command_line.GetSwitchValueASCII(UITestSuite::kBatchIndex); + std::wstring batch_index_str = + parsed_command_line.GetSwitchValue(UITestSuite::kBatchIndex); if (!batch_index_str.empty()) { - base::StringToInt(batch_index_str, &batch_index); + base::StringToInt(WideToUTF16Hack(batch_index_str), &batch_index); } if (batch_count > 0 && batch_index >= 0 && batch_index < batch_count) { // Running UI test in parallel. Gtest supports running tests in shards, diff --git a/chrome/test/url_fetch_test/url_fetch_test.cc b/chrome/test/url_fetch_test/url_fetch_test.cc index 5729785..ec87c76 100644 --- a/chrome/test/url_fetch_test/url_fetch_test.cc +++ b/chrome/test/url_fetch_test/url_fetch_test.cc @@ -49,7 +49,7 @@ class UrlFetchTest : public UITest { } void RunTest(const GURL& url, const char* wait_cookie_name, - const char* wait_cookie_value, const char* var_to_fetch, + 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)); @@ -67,12 +67,11 @@ class UrlFetchTest : public UITest { } } if (var_to_fetch) { - std::string script = StringPrintf( - "window.domAutomationController.send(%s);", var_to_fetch); + std::wstring script = StringPrintf( + L"window.domAutomationController.send(%ls);", var_to_fetch); std::wstring value; - bool success = tab->ExecuteAndExtractString(L"", ASCIIToWide(script), - &value); + bool success = tab->ExecuteAndExtractString(L"", script, &value); ASSERT_TRUE(success); result->javascript_variable = WideToUTF8(value); } @@ -122,10 +121,10 @@ TEST_F(UrlFetchTest, UrlFetch) { std::string cookie_value = cmd_line->GetSwitchValueASCII("wait_cookie_value"); - std::string jsvar = cmd_line->GetSwitchValueASCII("jsvar"); + std::wstring jsvar = cmd_line->GetSwitchValue("jsvar"); UrlFetchTestResult result; - RunTest(GURL(cmd_line->GetSwitchValueASCII("url")), + 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, diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc index 09768fa..c062c04 100644 --- a/chrome/tools/crash_service/crash_service.cc +++ b/chrome/tools/crash_service/crash_service.cc @@ -200,7 +200,7 @@ bool CrashService::Initialize(const std::wstring& command_line) { // We can override the send reports quota with a command line switch. if (cmd_line.HasSwitch(kMaxReports)) - max_reports = _wtoi(cmd_line.GetSwitchValueNative(kMaxReports).c_str()); + max_reports = _wtoi(cmd_line.GetSwitchValue(kMaxReports).c_str()); if (max_reports > 0) { // Create the http sender object. @@ -252,7 +252,7 @@ bool CrashService::Initialize(const std::wstring& command_line) { reporter_tag_ = L"crash svc"; if (cmd_line.HasSwitch(kReporterTag)) - reporter_tag_ = cmd_line.GetSwitchValueNative(kReporterTag); + reporter_tag_ = cmd_line.GetSwitchValue(kReporterTag); // Log basic information. LOG(INFO) << "pipe name is " << pipe_name; diff --git a/chrome_frame/test/net/process_singleton_subclass.cc b/chrome_frame/test/net/process_singleton_subclass.cc index 89ddeb9..2046e0b 100644 --- a/chrome_frame/test/net/process_singleton_subclass.cc +++ b/chrome_frame/test/net/process_singleton_subclass.cc @@ -100,9 +100,8 @@ LRESULT ProcessSingletonSubclass::OnCopyData(HWND hwnd, HWND from_hwnd, std::wstring cmd_line(begin, static_cast<size_t>(end - begin)); CommandLine parsed_command_line = CommandLine::FromString(cmd_line); - std::string channel_id = - parsed_command_line.GetSwitchValueASCII( - switches::kAutomationClientChannelID)); + std::string channel_id(WideToASCII(parsed_command_line.GetSwitchValue( + switches::kAutomationClientChannelID))); EXPECT_FALSE(channel_id.empty()); delegate_->OnConnectAutomationProviderToChannel(channel_id); diff --git a/chrome_frame/test/reliability/page_load_test.cc b/chrome_frame/test/reliability/page_load_test.cc index 61268fc..f784bcf 100644 --- a/chrome_frame/test/reliability/page_load_test.cc +++ b/chrome_frame/test/reliability/page_load_test.cc @@ -562,17 +562,15 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kStartIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( - kStartIndexSwitch), - &g_start_index)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kStartIndexSwitch)), &g_start_index)); ASSERT_GT(g_start_index, 0); } if (parsed_command_line.HasSwitch(kEndIndexSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( - kEndIndexSwitch), - &g_end_index)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kEndIndexSwitch)), &g_end_index)); ASSERT_GT(g_end_index, 0); } @@ -583,9 +581,8 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kIterationSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( - kIterationSwitch), - &g_iterations)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kIterationSwitch)), &g_iterations)); ASSERT_GT(g_iterations, 0); } @@ -600,9 +597,8 @@ void SetPageRange(const CommandLine& parsed_command_line) { if (parsed_command_line.HasSwitch(kTimeoutSwitch)) { ASSERT_TRUE( - base::StringToInt(parsed_command_line.GetSwitchValue( - kTimeoutSwitch), - &g_timeout_ms)); + base::StringToInt(WideToUTF16(parsed_command_line.GetSwitchValue( + kTimeoutSwitch)), &g_timeout_ms)); ASSERT_GT(g_timeout_ms, 0); } diff --git a/chrome_frame/test/reliability/run_all_unittests.cc b/chrome_frame/test/reliability/run_all_unittests.cc index d153d68..3b2604d 100644 --- a/chrome_frame/test/reliability/run_all_unittests.cc +++ b/chrome_frame/test/reliability/run_all_unittests.cc @@ -29,7 +29,7 @@ int main(int argc, char **argv) { int result = -1; if (cmd_line->HasSwitch(kRegisterDllFlag)) { - std::wstring dll_path = cmd_line->GetSwitchValueNative(kRegisterDllFlag); + std::wstring dll_path = cmd_line->GetSwitchValue(kRegisterDllFlag); // Run() must be called within the scope of the ScopedChromeFrameRegistrar // to ensure that the correct DLL remains registered during the tests. |