summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/command_line.cc3
-rw-r--r--base/command_line.h2
-rw-r--r--base/command_line_unittest.cc10
3 files changed, 7 insertions, 8 deletions
diff --git a/base/command_line.cc b/base/command_line.cc
index 61ff5c1..3e143cc 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -263,8 +263,7 @@ void CommandLine::SetProgram(const FilePath& program) {
}
bool CommandLine::HasSwitch(const std::string& switch_string) const {
- DCHECK_EQ(StringToLowerASCII(switch_string), switch_string);
- return switches_.find(switch_string) != switches_.end();
+ return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end();
}
bool CommandLine::HasSwitch(const char string_constant[]) const {
diff --git a/base/command_line.h b/base/command_line.h
index 439921e..19df40c 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -142,7 +142,7 @@ class BASE_EXPORT CommandLine {
void SetProgram(const FilePath& program);
// Returns true if this command line contains the given switch.
- // Switch names should only be lowercase.
+ // (Switch names are case-insensitive).
// The second override provides an optimized version to avoid inlining the
// codegen for the string allocation.
bool HasSwitch(const std::string& switch_string) const;
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index db1a0b2..e395c856 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -60,13 +60,12 @@ TEST(CommandLineTest, CommandLineConstructor) {
cl.GetProgram().value());
EXPECT_TRUE(cl.HasSwitch("foo"));
-#if defined(OS_WIN)
- EXPECT_TRUE(cl.HasSwitch("bar"));
-#else
- EXPECT_FALSE(cl.HasSwitch("bar"));
-#endif
+ EXPECT_TRUE(cl.HasSwitch("bAr"));
EXPECT_TRUE(cl.HasSwitch("baz"));
EXPECT_TRUE(cl.HasSwitch("spaetzle"));
+#if defined(OS_WIN)
+ EXPECT_TRUE(cl.HasSwitch("SPAETZLE"));
+#endif
EXPECT_TRUE(cl.HasSwitch("other-switches"));
EXPECT_TRUE(cl.HasSwitch("input-translation"));
@@ -129,6 +128,7 @@ TEST(CommandLineTest, CommandLineFromString) {
EXPECT_TRUE(cl.HasSwitch("bar"));
EXPECT_TRUE(cl.HasSwitch("baz"));
EXPECT_TRUE(cl.HasSwitch("spaetzle"));
+ EXPECT_TRUE(cl.HasSwitch("SPAETZLE"));
EXPECT_TRUE(cl.HasSwitch("other-switches"));
EXPECT_TRUE(cl.HasSwitch("input-translation"));
EXPECT_TRUE(cl.HasSwitch("quotes"));