Chromium Code Reviews| Index: base/command_line.cc |
| diff --git a/base/command_line.cc b/base/command_line.cc |
| index c991959d6911bf545f994b3e6d0833f793cc7cf0..a6baf4c5d47798bcdb3ef326b7e48cbaae27d12e 100644 |
| --- a/base/command_line.cc |
| +++ b/base/command_line.cc |
| @@ -197,6 +197,17 @@ void CommandLine::set_slash_is_not_a_switch() { |
| DCHECK_EQ(wcscmp(kSwitchPrefixes[arraysize(kSwitchPrefixes) - 1], L"/"), 0); |
| switch_prefix_count = arraysize(kSwitchPrefixes) - 1; |
| } |
| + |
| +// static |
| +void CommandLine::InitUsingArgvForTesting(int argc, const char* const* argv) { |
| + DCHECK(current_process_commandline_); |
|
Lei Zhang
2016/06/21 21:57:45
missing '!'
ananta
2016/06/21 22:05:16
Thanks. Fixed
|
| + current_process_commandline_ = new CommandLine(NO_PROGRAM); |
| + // On Windows we need to convert the command line arguments to string16. |
| + base::CommandLine::StringVector argv_vector; |
| + for (int i = 0; i < argc; ++i) |
| + argv_vector.push_back(UTF8ToUTF16(argv[i])); |
| + current_process_commandline_->InitFromArgv(argv_vector); |
| +} |
| #endif |
| // static |
| @@ -209,12 +220,12 @@ bool CommandLine::Init(int argc, const char* const* argv) { |
| } |
| current_process_commandline_ = new CommandLine(NO_PROGRAM); |
| + |
| #if defined(OS_WIN) |
| current_process_commandline_->ParseFromString(::GetCommandLineW()); |
| #elif defined(OS_POSIX) |
| current_process_commandline_->InitFromArgv(argc, argv); |
| #endif |
| - |
| return true; |
| } |