Index: base/command_line.cc |
diff --git a/base/command_line.cc b/base/command_line.cc |
index c991959d6911bf545f994b3e6d0833f793cc7cf0..99ea2b000324b87ea4ab11bae1f7c5374586331c 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_); |
+ 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 |