OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
8 #include "chrome_frame/chrome_launcher.h" | 8 #include "chrome_frame/chrome_launcher.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 private: | 26 private: |
27 int initial_log_level_; | 27 int initial_log_level_; |
28 }; | 28 }; |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 TEST(ChromeLauncher, SanitizeCommandLine) { | 32 TEST(ChromeLauncher, SanitizeCommandLine) { |
33 CommandLine bad(L"dummy.exe"); | 33 CommandLine bad(L"dummy.exe"); |
34 bad.AppendSwitch(switches::kDisableMetrics); // in whitelist | 34 bad.AppendSwitch(switches::kDisableMetrics); // in whitelist |
35 bad.AppendSwitchWithValue(switches::kLoadExtension, L"foo"); // in whitelist | 35 bad.AppendSwitchWithValue(switches::kLoadExtension, L"foo"); // in whitelist |
36 bad.AppendSwitch(L"no-such-switch"); // does not exist | 36 bad.AppendSwitch("no-such-switch"); // does not exist |
37 bad.AppendSwitch(switches::kHomePage); // exists but not in whitelist | 37 bad.AppendSwitch(switches::kHomePage); // exists but not in whitelist |
38 | 38 |
39 LogDisabler no_dchecks; | 39 LogDisabler no_dchecks; |
40 | 40 |
41 CommandLine sanitized(L"dumbo.exe"); | 41 CommandLine sanitized(L"dumbo.exe"); |
42 chrome_launcher::SanitizeCommandLine(bad, &sanitized); | 42 chrome_launcher::SanitizeCommandLine(bad, &sanitized); |
43 EXPECT_TRUE(sanitized.HasSwitch(switches::kDisableMetrics)); | 43 EXPECT_TRUE(sanitized.HasSwitch(switches::kDisableMetrics)); |
44 EXPECT_TRUE(sanitized.HasSwitch(switches::kLoadExtension)); | 44 EXPECT_TRUE(sanitized.HasSwitch(switches::kLoadExtension)); |
45 EXPECT_FALSE(sanitized.HasSwitch(L"no-such-switch")); | 45 EXPECT_FALSE(sanitized.HasSwitch("no-such-switch")); |
46 EXPECT_FALSE(sanitized.HasSwitch(switches::kHomePage)); | 46 EXPECT_FALSE(sanitized.HasSwitch(switches::kHomePage)); |
47 | 47 |
48 EXPECT_EQ(sanitized.GetSwitchValue(switches::kLoadExtension), L"foo"); | 48 EXPECT_EQ(sanitized.GetSwitchValue(switches::kLoadExtension), L"foo"); |
49 } | 49 } |
OLD | NEW |