Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: base/command_line.cc

Issue 2078913005: Add a chrome_elf_unittest ChromeElfLoadSanityTest which validates that loading chrome_elf does not … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a static method InitFromArgvForTesting for Windows to honor passed in arguments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/command_line.h ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « base/command_line.h ('k') | base/message_loop/message_pump_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698