| Index: chrome/install_static/install_util_unittest.cc
|
| diff --git a/chrome/install_static/install_util_unittest.cc b/chrome/install_static/install_util_unittest.cc
|
| index 59b5749f83bd8686c5bec494c40c4d0781d8d8ad..0e3619250a1b08ec0d9ab74979a2c636a9378079 100644
|
| --- a/chrome/install_static/install_util_unittest.cc
|
| +++ b/chrome/install_static/install_util_unittest.cc
|
| @@ -90,16 +90,72 @@ TEST(InstallStaticTest, GetSwitchValueFromCommandLineTest) {
|
| value = GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe --type=\t\t\t",
|
| L"type");
|
| EXPECT_TRUE(value.empty());
|
| +}
|
|
|
| - // Whitespace after the "=" before the value.
|
| - value =
|
| - GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe --type= bar", L"type");
|
| - EXPECT_EQ(L"bar", value);
|
| -
|
| - // Tabs after the "=" before the value.
|
| - value = GetSwitchValueFromCommandLine(L"c:\\temp\\bleh.exe --type=\t\t\tbar",
|
| - L"type");
|
| - EXPECT_EQ(value, L"bar");
|
| +TEST(InstallStaticTest, SpacesAndQuotesInCommandLineArguments) {
|
| + std::vector<std::wstring> tokenized;
|
| +
|
| + tokenized = TokenizeCommandLineToArray(L"\"C:\\a\\b.exe\"");
|
| + ASSERT_EQ(1, tokenized.size());
|
| + EXPECT_EQ(L"C:\\a\\b.exe", tokenized[0]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(L"x.exe");
|
| + ASSERT_EQ(1, tokenized.size());
|
| + EXPECT_EQ(L"x.exe", tokenized[0]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(L"\"c:\\with space\\something.exe\"");
|
| + ASSERT_EQ(1, tokenized.size());
|
| + EXPECT_EQ(L"c:\\with space\\something.exe", tokenized[0]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(L"\"C:\\a\\b.exe\" arg");
|
| + ASSERT_EQ(2, tokenized.size());
|
| + EXPECT_EQ(L"C:\\a\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"arg", tokenized[1]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(L"\"C:\\with space\\b.exe\" \"arg\"");
|
| + ASSERT_EQ(2, tokenized.size());
|
| + EXPECT_EQ(L"C:\\with space\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"arg", tokenized[1]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(L"\"C:\\a\\b.exe\" c:\\tmp\\");
|
| + ASSERT_EQ(2, tokenized.size());
|
| + EXPECT_EQ(L"C:\\a\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"c:\\tmp\\", tokenized[1]);
|
| +
|
| + tokenized =
|
| + TokenizeCommandLineToArray(L"\"C:\\a\\b.exe\" \"c:\\some file path\\\"");
|
| + ASSERT_EQ(2, tokenized.size());
|
| + EXPECT_EQ(L"C:\\a\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"c:\\some file path\"", tokenized[1]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(
|
| + L"\"C:\\with space\\b.exe\" \\\\x\\\\ \\\\y\\\\");
|
| + ASSERT_EQ(3, tokenized.size());
|
| + EXPECT_EQ(L"C:\\with space\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"\\\\x\\\\", tokenized[1]);
|
| + EXPECT_EQ(L"\\\\y\\\\", tokenized[2]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(
|
| + L"\"C:\\with space\\b.exe\" \"\\\\space quoted\\\\\"");
|
| + ASSERT_EQ(2, tokenized.size());
|
| + EXPECT_EQ(L"C:\\with space\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"\\\\space quoted\\", tokenized[1]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(
|
| + L"\"C:\\with space\\b.exe\" --stuff -x -Y \"c:\\some thing\\\" "
|
| + L"weewaa ");
|
| + EXPECT_EQ(5, tokenized.size());
|
| + EXPECT_EQ(L"C:\\with space\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"--stuff", tokenized[1]);
|
| + EXPECT_EQ(L"-x", tokenized[2]);
|
| + EXPECT_EQ(L"-Y", tokenized[3]);
|
| + EXPECT_EQ(L"c:\\some thing\" weewaa ", tokenized[4]);
|
| +
|
| + tokenized = TokenizeCommandLineToArray(
|
| + L"\"C:\\with space\\b.exe\" --stuff=\"d:\\stuff and things\"");
|
| + EXPECT_EQ(2, tokenized.size());
|
| + EXPECT_EQ(L"C:\\with space\\b.exe", tokenized[0]);
|
| + EXPECT_EQ(L"--stuff=d:\\stuff and things", tokenized[1]);
|
| }
|
|
|
| TEST(InstallStaticTest, BrowserProcessTest) {
|
|
|