summaryrefslogtreecommitdiffstats
path: root/base/command_line_unittest.cc
diff options
context:
space:
mode:
authormgiuca <mgiuca@chromium.org>2014-09-23 21:55:31 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-24 04:55:45 +0000
commitb937b24239d36fb4cdfeb98b2db818e4304dd8b4 (patch)
tree807c2e6e41a3ba1cb369ec934ed1c7d67d7a72b6 /base/command_line_unittest.cc
parentdf2931a70908043e07de24d3fa48c25cb68d7dc1 (diff)
downloadchromium_src-b937b24239d36fb4cdfeb98b2db818e4304dd8b4.zip
chromium_src-b937b24239d36fb4cdfeb98b2db818e4304dd8b4.tar.gz
chromium_src-b937b24239d36fb4cdfeb98b2db818e4304dd8b4.tar.bz2
CommandLineTest.ProgramQuotes: Fix crash-prone test.
Previously, this test would crash if the output wasn't quoted properly (since it assumes that cmd_string.length() >= program_string.length() + 2). Instead, directly compare the string with the expected output. This also guards against the possibility of mis-constructing the expected string. Review URL: https://codereview.chromium.org/589393002 Cr-Commit-Position: refs/heads/master@{#296350}
Diffstat (limited to 'base/command_line_unittest.cc')
-rw-r--r--base/command_line_unittest.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index 06c5006..8aed618 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -348,10 +348,7 @@ TEST(CommandLineTest, ProgramQuotes) {
// Check that quotes are added to command line string paths containing spaces.
CommandLine::StringType cmd_string(cl_program_path.GetCommandLineString());
- CommandLine::StringType program_string(cl_program_path.GetProgram().value());
- EXPECT_EQ('"', cmd_string[0]);
- EXPECT_EQ(program_string, cmd_string.substr(1, program_string.length()));
- EXPECT_EQ('"', cmd_string[program_string.length() + 1]);
+ EXPECT_EQ(L"\"Program Path\"", cmd_string);
}
#endif