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

Unified Diff: base/command_line_unittest.cc

Issue 4949004: Add a unit test for CommandLine that makes sure that GetProgram will not retu... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/command_line_unittest.cc
===================================================================
--- base/command_line_unittest.cc (revision 67576)
+++ base/command_line_unittest.cc (working copy)
@@ -179,3 +179,22 @@
EXPECT_TRUE(c1.HasSwitch("switch2"));
}
+#if defined(OS_WIN)
+// Make sure that the program part of a command line is always quoted.
+// This only makes sense on Windows and the test is basically here to guard
+// against regressions.
+TEST(CommandLineTest, ProgramQuotes) {
+ const FilePath kProgram(FILE_PATH_LITERAL("Program"));
Evan Martin 2010/11/29 20:39:55 Since you're in a Windows-specific branch, L"Progr
tommi (sloooow) - chröme 2010/11/29 20:45:01 Done.
+
+ // Check that quotes are not returned from GetProgram().
+ CommandLine cl(kProgram);
+ EXPECT_EQ(kProgram.value(), cl.GetProgram().value());
+
+ // Verify that in the command line string, the program part is always quoted.
+ CommandLine::StringType cmd(cl.command_line_string());
+ CommandLine::StringType program(cl.GetProgram().value());
+ EXPECT_EQ('"', cmd[0]);
+ EXPECT_EQ(program, cmd.substr(1, program.length()));
+ EXPECT_EQ('"', cmd[program.length() + 1]);
+}
+#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698