| 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 0af8488d2651d598c7bb37b94658c2f45a1a711a..0e8c70d3e892011f0856c545c521956c0e152273 100644
|
| --- a/chrome/install_static/install_util_unittest.cc
|
| +++ b/chrome/install_static/install_util_unittest.cc
|
| @@ -130,4 +130,45 @@ TEST(InstallStaticTest, CompareVersions) {
|
| EXPECT_EQ(-1, result);
|
| }
|
|
|
| +// Tests the install_static::GetSwitchValueFromCommandLine function.
|
| +TEST(InstallStaticTest, GetSwitchValueFromCommandLineTest) {
|
| + // Simple case with one switch.
|
| + std::string value =
|
| + GetSwitchValueFromCommandLine("c:\\temp\bleh.exe --type=bar", "type");
|
| + EXPECT_EQ(value, "bar");
|
| +
|
| + // Multiple switches with trailing spaces between them.
|
| + value = GetSwitchValueFromCommandLine(
|
| + "c:\\temp\bleh.exe --type=bar --abc=def bleh", "abc");
|
| + EXPECT_EQ(value, "def");
|
| +
|
| + // Multiple switches with trailing spaces and tabs between them.
|
| + value = GetSwitchValueFromCommandLine(
|
| + "c:\\temp\bleh.exe --type=bar \t\t\t --abc=def bleh", "abc");
|
| + EXPECT_EQ(value, "def");
|
| +
|
| + // Non existent switch.
|
| + value = GetSwitchValueFromCommandLine(
|
| + "c:\\temp\bleh.exe --foo=bar --abc=def bleh", "type");
|
| + EXPECT_EQ(value, "");
|
| +
|
| + // Non existent switch.
|
| + value = GetSwitchValueFromCommandLine("c:\\temp\bleh.exe", "type");
|
| + EXPECT_EQ(value, "");
|
| +
|
| + // Non existent switch.
|
| + value = GetSwitchValueFromCommandLine("c:\\temp\bleh.exe type=bar", "type");
|
| + EXPECT_EQ(value, "");
|
| +
|
| + // Trailing spaces after the switch.
|
| + value = GetSwitchValueFromCommandLine(
|
| + "c:\\temp\bleh.exe --type=bar \t\t", "type");
|
| + EXPECT_EQ(value, "bar");
|
| +
|
| + // Multiple switches with trailing spaces and tabs between them.
|
| + value = GetSwitchValueFromCommandLine(
|
| + "c:\\temp\bleh.exe --type=bar \t\t --foo=bleh", "foo");
|
| + EXPECT_EQ(value, "bleh");
|
| +}
|
| +
|
| } // namespace install_static
|
|
|