Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9074)

Unified Diff: chrome/common/switch_utils_unittest.cc

Issue 3307024: Remove one-time flags when restarting after update.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/switch_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/switch_utils_unittest.cc
===================================================================
--- chrome/common/switch_utils_unittest.cc (revision 0)
+++ chrome/common/switch_utils_unittest.cc (revision 0)
@@ -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"));
+}
Property changes on: chrome\common\switch_utils_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/common/switch_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698