summaryrefslogtreecommitdiff
path: root/base/command_line_unittest.cc
diff options
context:
space:
mode:
authorCronet Mainline Eng <cronet-mainline-eng+copybara@google.com>2023-03-22 02:58:49 -0800
committerPatrick Rohr <prohr@google.com>2023-03-22 04:40:18 -0700
commitc175721cfcc03e339122be17d569239df9762b2b (patch)
tree64fed42a909067904ef77b573e554a172241bdfe /base/command_line_unittest.cc
parent26b17131b27be4b84fc089d96dcc1998e686ecf9 (diff)
downloadcronet-c175721cfcc03e339122be17d569239df9762b2b.tar.gz
Import Cronet version 110.0.5481.154
Project import generated by Copybara. FolderOrigin-RevId: /tmp/copybara-origin/src Test: none Change-Id: I534a69efa61b40fdc95613bce5bc5dd9a432f646
Diffstat (limited to 'base/command_line_unittest.cc')
-rw-r--r--base/command_line_unittest.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index f900a90f5..04d2201ee 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -338,6 +338,20 @@ TEST(CommandLineTest, HasSingleArgument) {
EXPECT_TRUE(cl_for_shell.HasSingleArgumentSwitch());
}
+// Test that creating a new command line from the string version of a single
+// argument command line maintains the single argument switch, and the
+// argument.
+TEST(CommandLineTest, MaintainSingleArgument) {
+ // Putting a space in the file name will force escaping of the argument.
+ static const CommandLine::StringType kCommandLine =
+ FILE_PATH_LITERAL("program --switch --single-argument foo bar.html");
+ CommandLine cl = CommandLine::FromString(kCommandLine);
+ CommandLine cl_for_shell = CommandLine::FromString(cl.GetCommandLineString());
+ EXPECT_TRUE(cl_for_shell.HasSingleArgumentSwitch());
+ // Verify that we command line survives the round trip with an escaped arg.
+ EXPECT_EQ(kCommandLine, cl_for_shell.GetCommandLineString());
+}
+
#endif // BUILDFLAG(IS_WIN)
// Tests that when AppendArguments is called that the program is set correctly