Index: chrome/common/switch_utils_unittest.cc |
diff --git a/chrome/common/switch_utils_unittest.cc b/chrome/common/switch_utils_unittest.cc |
index 20da818f816a9dd617d591811a56a0ebf29e3800..0b02bc3748f4e1bcfd3125e1f1e5604e3a70a29d 100644 |
--- a/chrome/common/switch_utils_unittest.cc |
+++ b/chrome/common/switch_utils_unittest.cc |
@@ -11,7 +11,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
TEST(SwitchUtilsTest, RemoveSwitches) { |
- const base::CommandLine::CharType* argv[] = { |
+ static const base::CommandLine::CharType* argv[] = { |
FILE_PATH_LITERAL("program"), |
FILE_PATH_LITERAL("--app=http://www.google.com/"), |
FILE_PATH_LITERAL("--force-first-run"), |
@@ -53,4 +53,43 @@ TEST(SwitchUtilsTest, RemoveSwitchesFromString) { |
EXPECT_TRUE(cmd_line.HasSwitch("foo")); |
EXPECT_TRUE(cmd_line.HasSwitch("bar")); |
} |
+ |
+TEST(SwitchUtilsTest, RemovePrefetchSwitch) { |
+ static const base::CommandLine::CharType* argv[] = { |
+ FILE_PATH_LITERAL("program"), |
+ FILE_PATH_LITERAL("--foo"), |
+ FILE_PATH_LITERAL("/prefetch:1"), |
+ FILE_PATH_LITERAL("--bar")}; |
+ base::CommandLine cmd_line(arraysize(argv), argv); |
+ EXPECT_FALSE(cmd_line.GetCommandLineString().empty()); |
+ |
+ std::map<std::string, base::CommandLine::StringType> switches = |
+ cmd_line.GetSwitches(); |
+ EXPECT_EQ(3U, switches.size()); |
+ |
+ switches::RemoveSwitchesForAutostart(&switches); |
+ EXPECT_EQ(2U, switches.size()); |
+ EXPECT_TRUE(cmd_line.HasSwitch("foo")); |
+ EXPECT_TRUE(cmd_line.HasSwitch("bar")); |
+} |
+ |
+TEST(SwitchUtilsTest, RemovePrefetchSwitchAndNormalSwitch) { |
+ static const base::CommandLine::CharType* argv[] = { |
+ FILE_PATH_LITERAL("program"), |
+ FILE_PATH_LITERAL("--foo"), |
+ FILE_PATH_LITERAL("/prefetch:1"), |
+ FILE_PATH_LITERAL("--force-first-run"), |
+ FILE_PATH_LITERAL("--bar")}; |
+ base::CommandLine cmd_line(arraysize(argv), argv); |
+ EXPECT_FALSE(cmd_line.GetCommandLineString().empty()); |
+ |
+ std::map<std::string, base::CommandLine::StringType> switches = |
+ cmd_line.GetSwitches(); |
+ EXPECT_EQ(4U, switches.size()); |
+ |
+ switches::RemoveSwitchesForAutostart(&switches); |
+ EXPECT_EQ(2U, switches.size()); |
+ EXPECT_TRUE(cmd_line.HasSwitch("foo")); |
+ EXPECT_TRUE(cmd_line.HasSwitch("bar")); |
+} |
#endif |