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

Unified Diff: chrome/install_static/install_util_unittest.cc

Issue 2053953002: Add chrome_crash_reporter_client_win.cc to the source file list for chrome_elf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 6 months 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 | « chrome/install_static/install_util.cc ('k') | chrome_elf/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..13131d11d024c2b9436f58ae9e15a7ee9a9138e4 100644
--- a/chrome/install_static/install_util_unittest.cc
+++ b/chrome/install_static/install_util_unittest.cc
@@ -130,4 +130,68 @@ 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("bar", value);
+
+ // Multiple switches with trailing spaces between them.
+ value = GetSwitchValueFromCommandLine(
+ "c:\\temp\\bleh.exe --type=bar --abc=def bleh", "abc");
+ EXPECT_EQ("def", value);
+
+ // 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("def", value);
+
+ // 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("bar", value);
+
+ // Multiple switches with trailing spaces and tabs between them.
+ value = GetSwitchValueFromCommandLine(
+ "c:\\temp\\bleh.exe --type=bar \t\t --foo=bleh", "foo");
+ EXPECT_EQ("bleh", value);
+
+ // Nothing after a switch.
+ value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type=", "type");
+ EXPECT_TRUE(value.empty());
+
+ // Whitespace after a switch.
+ value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type= ", "type");
+ EXPECT_TRUE(value.empty());
+
+ // Just tabs after a switch.
+ value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type=\t\t\t",
+ "type");
+ EXPECT_TRUE(value.empty());
+
+ // Whitespace after the "=" before the value.
+ value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type= bar",
+ "type");
+ EXPECT_EQ("bar", value);
+
+ // Tabs after the "=" before the value.
+ value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type=\t\t\tbar",
+ "type");
+ EXPECT_EQ(value, "bar");
+}
+
} // namespace install_static
« no previous file with comments | « chrome/install_static/install_util.cc ('k') | chrome_elf/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698