Index: chrome/browser/about_flags_unittest.cc |
diff --git a/chrome/browser/about_flags_unittest.cc b/chrome/browser/about_flags_unittest.cc |
index 0cb9fa78835f36a552cf7fe0ffe1ed07170e7871..c8c426969ca89beee380cbd43187c547b3650480 100644 |
--- a/chrome/browser/about_flags_unittest.cc |
+++ b/chrome/browser/about_flags_unittest.cc |
@@ -233,22 +233,45 @@ TEST_F(AboutFlagsTest, ConvertFlagsToSwitches) { |
EXPECT_FALSE(command_line2.HasSwitch(switches::kFlagSwitchesEnd)); |
} |
+CommandLine::StringType CreateSwitch(const std::string& value) { |
+#if defined(OS_WIN) |
+ return ASCIIToUTF16(value); |
+#else |
+ return value; |
+#endif |
+} |
+ |
TEST_F(AboutFlagsTest, CompareSwitchesToCurrentCommandLine) { |
SetExperimentEnabled(&flags_storage_, kFlags1, true); |
+ const std::string kDoubleDash("--"); |
+ |
CommandLine command_line(CommandLine::NO_PROGRAM); |
command_line.AppendSwitch("foo"); |
CommandLine new_command_line(CommandLine::NO_PROGRAM); |
ConvertFlagsToSwitches(&flags_storage_, &new_command_line, kAddSentinels); |
- EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine(new_command_line, |
- command_line)); |
+ EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine( |
+ new_command_line, command_line, NULL)); |
+ { |
+ std::set<CommandLine::StringType> difference; |
+ EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine( |
+ new_command_line, command_line, &difference)); |
+ EXPECT_EQ(1U, difference.size()); |
+ EXPECT_EQ(1U, difference.count(CreateSwitch(kDoubleDash + kSwitch1))); |
+ } |
ConvertFlagsToSwitches(&flags_storage_, &command_line, kAddSentinels); |
- EXPECT_TRUE(AreSwitchesIdenticalToCurrentCommandLine(new_command_line, |
- command_line)); |
+ EXPECT_TRUE(AreSwitchesIdenticalToCurrentCommandLine( |
+ new_command_line, command_line, NULL)); |
+ { |
+ std::set<CommandLine::StringType> difference; |
+ EXPECT_TRUE(AreSwitchesIdenticalToCurrentCommandLine( |
+ new_command_line, command_line, &difference)); |
+ EXPECT_TRUE(difference.empty()); |
+ } |
// Now both have flags but different. |
SetExperimentEnabled(&flags_storage_, kFlags1, false); |
@@ -257,8 +280,18 @@ TEST_F(AboutFlagsTest, CompareSwitchesToCurrentCommandLine) { |
CommandLine another_command_line(CommandLine::NO_PROGRAM); |
ConvertFlagsToSwitches(&flags_storage_, &another_command_line, kAddSentinels); |
- EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine(new_command_line, |
- another_command_line)); |
+ EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine( |
+ new_command_line, another_command_line, NULL)); |
+ { |
+ std::set<CommandLine::StringType> difference; |
+ EXPECT_FALSE(AreSwitchesIdenticalToCurrentCommandLine( |
+ new_command_line, another_command_line, &difference)); |
+ EXPECT_EQ(2U, difference.size()); |
+ EXPECT_EQ(1U, difference.count(CreateSwitch(kDoubleDash + kSwitch1))); |
+ EXPECT_EQ(1U, |
+ difference.count(CreateSwitch(kDoubleDash + kSwitch2 + "=" + |
+ kValueForSwitch2))); |
+ } |
} |
TEST_F(AboutFlagsTest, RemoveFlagSwitches) { |