Add -- as a command line switch parsing terminator.  This allows you to launch chrome to a given URL safely, without having to validate the URL and worry it might be interpreted as a dangerous command line argument.
Review URL: http://codereview.chromium.org/6480

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2876 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/base/command_line_unittest.cc b/base/command_line_unittest.cc
index f3d63cb2..4319b4da 100644
--- a/base/command_line_unittest.cc
+++ b/base/command_line_unittest.cc
@@ -21,6 +21,7 @@
                  L"--other-switches=\"--dog=canine --cat=feline\" "
                  L"-spaetzle=Crepe   -=loosevalue  flan "
                  L"--input-translation=\"45\"--output-rotation "
+                 L"-- -- --not-a-switch "
                  L"\"in the time of submarines...\"");
 #elif defined(OS_POSIX)
   const char* argv[] = {"program", "--foo=", "-bAr", 
@@ -28,6 +29,7 @@
                         "--other-switches=--dog=canine --cat=feline",
                         "-spaetzle=Crepe", "-=loosevalue", "flan",
                         "--input-translation=45--output-rotation",
+                        "--", "--", "--not-a-switch",
                         "in the time of submarines..."};
   CommandLine cl(arraysize(argv), argv);
 #endif
@@ -38,6 +40,8 @@
   EXPECT_FALSE(cl.HasSwitch(L"dog"));
   EXPECT_FALSE(cl.HasSwitch(L"cat"));
   EXPECT_FALSE(cl.HasSwitch(L"output-rotation"));
+  EXPECT_FALSE(cl.HasSwitch(L"not-a-switch"));
+  EXPECT_FALSE(cl.HasSwitch(L"--"));
 
   EXPECT_EQ(L"program", cl.program());
 
@@ -56,13 +60,17 @@
   EXPECT_EQ(L"--dog=canine --cat=feline", cl.GetSwitchValue(L"other-switches"));
   EXPECT_EQ(L"45--output-rotation", cl.GetSwitchValue(L"input-translation"));
 
-  EXPECT_EQ(3U, cl.GetLooseValueCount());
+  EXPECT_EQ(5U, cl.GetLooseValueCount());
 
   CommandLine::LooseValueIterator iter = cl.GetLooseValuesBegin();
   EXPECT_EQ(L"flim", *iter);
   ++iter;
   EXPECT_EQ(L"flan", *iter);
   ++iter;
+  EXPECT_EQ(L"--", *iter);
+  ++iter;
+  EXPECT_EQ(L"--not-a-switch", *iter);
+  ++iter;
   EXPECT_EQ(L"in the time of submarines...", *iter);
   ++iter;
   EXPECT_TRUE(iter == cl.GetLooseValuesEnd());
@@ -116,4 +124,3 @@
   EXPECT_EQ(value4.substr(1, value4.length() - 2), cl.GetSwitchValue(switch4));
 }
 #endif
-