OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/switch_utils.h" | 5 #include "chrome/common/switch_utils.h" |
6 | 6 |
| 7 #include "base/basictypes.h" |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 TEST(SwitchUtilsTest, RemoveSwitches) { | 11 TEST(SwitchUtilsTest, RemoveSwitches) { |
11 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
12 // All these command line args (except foo and bar) will | 13 // All these command line args (except foo and bar) will |
13 // be removed after RemoveSwitchesForAutostart: | 14 // be removed after RemoveSwitchesForAutostart: |
14 CommandLine cmd_line = CommandLine::FromString( | 15 CommandLine cmd_line = CommandLine::FromString( |
15 L"program" | 16 L"program" |
16 L" --app=http://www.google.com/" | 17 L" --app=http://www.google.com/" |
(...skipping 19 matching lines...) Expand all Loading... |
36 | 37 |
37 std::map<std::string, CommandLine::StringType> switches = | 38 std::map<std::string, CommandLine::StringType> switches = |
38 cmd_line.GetSwitches(); | 39 cmd_line.GetSwitches(); |
39 EXPECT_EQ(7U, switches.size()); | 40 EXPECT_EQ(7U, switches.size()); |
40 | 41 |
41 switches::RemoveSwitchesForAutostart(&switches); | 42 switches::RemoveSwitchesForAutostart(&switches); |
42 EXPECT_EQ(2U, switches.size()); | 43 EXPECT_EQ(2U, switches.size()); |
43 EXPECT_TRUE(cmd_line.HasSwitch("foo")); | 44 EXPECT_TRUE(cmd_line.HasSwitch("foo")); |
44 EXPECT_TRUE(cmd_line.HasSwitch("bar")); | 45 EXPECT_TRUE(cmd_line.HasSwitch("bar")); |
45 } | 46 } |
OLD | NEW |