summaryrefslogtreecommitdiffstats
path: root/chrome/common/switch_utils_unittest.cc
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-10-19 14:37:37 +0100
committerIain Merrick <husky@google.com>2010-10-19 14:37:37 +0100
commit3345a6884c488ff3a535c2c9acdd33d74b37e311 (patch)
tree7784b988ef1698cb6967ea1bdf07616237716c6c /chrome/common/switch_utils_unittest.cc
parentefc8475837ec58186051f23bb03542620424f6ce (diff)
downloadexternal_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.zip
external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.gz
external_chromium-3345a6884c488ff3a535c2c9acdd33d74b37e311.tar.bz2
Merge Chromium at 7.0.540.0 : Initial merge by git
Not including third_party/icu as it contains huge data files that break Gerrit, and aren't actually used. Change-Id: I428a386e70f3b58cacd28677b8cfda282e891e15
Diffstat (limited to 'chrome/common/switch_utils_unittest.cc')
-rw-r--r--chrome/common/switch_utils_unittest.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/chrome/common/switch_utils_unittest.cc b/chrome/common/switch_utils_unittest.cc
new file mode 100644
index 0000000..2c73b17
--- /dev/null
+++ b/chrome/common/switch_utils_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/common/switch_utils.h"
+
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(SwitchUtilsTest, RemoveSwitches) {
+#if defined(OS_WIN)
+ // All these command line args (except foo and bar) will
+ // be removed after RemoveSwitchesForAutostart:
+ CommandLine cmd_line = CommandLine::FromString(
+ L"program"
+ L" --app=http://www.google.com/"
+ L" --first-run"
+ L" --import"
+ L" --import-from-file=c:\\test.html"
+ L" --make-default-browser"
+ L" --foo"
+ L" --bar");
+ EXPECT_FALSE(cmd_line.command_line_string().empty());
+#elif defined(OS_POSIX)
+ const char* argv[] = {
+ "program",
+ "--app=http://www.google.com/",
+ "--first-run",
+ "--import",
+ "--import-from-file=c:\\test.html",
+ "--make-default-browser",
+ "--foo",
+ "--bar"};
+ CommandLine cmd_line(arraysize(argv), argv);
+#endif
+
+ std::map<std::string, CommandLine::StringType> switches =
+ cmd_line.GetSwitches();
+ EXPECT_EQ(7U, switches.size());
+
+ switches::RemoveSwitchesForAutostart(&switches);
+ EXPECT_EQ(2U, switches.size());
+ EXPECT_TRUE(cmd_line.HasSwitch("foo"));
+ EXPECT_TRUE(cmd_line.HasSwitch("bar"));
+}