Chromium Code Reviews

Side by Side Diff: chrome_frame/chrome_launcher_unittest.cc

Issue 218019: Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « chrome_frame/chrome_launcher_main.cc ('k') | chrome_frame/chrome_protocol.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "base/logging.h"
7 #include "chrome/common/chrome_switches.h"
8 #include "chrome_frame/chrome_launcher.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace {
12
13 // Utility class to disable logging. Required to disable DCHECKs that some
14 // of our tests would otherwise trigger.
15 class LogDisabler {
16 public:
17 LogDisabler() {
18 initial_log_level_ = logging::GetMinLogLevel();
19 logging::SetMinLogLevel(logging::LOG_FATAL + 1);
20 }
21
22 ~LogDisabler() {
23 logging::SetMinLogLevel(initial_log_level_);
24 }
25
26 private:
27 int initial_log_level_;
28 };
29
30 } // namespace
31
32 TEST(ChromeLauncher, SanitizeCommandLine) {
33 CommandLine bad(L"dummy.exe");
34 bad.AppendSwitch(switches::kDisableMetrics); // in whitelist
35 bad.AppendSwitchWithValue(switches::kLoadExtension, L"foo"); // in whitelist
36 bad.AppendSwitch(L"no-such-switch"); // does not exist
37 bad.AppendSwitch(switches::kHomePage); // exists but not in whitelist
38
39 LogDisabler no_dchecks;
40
41 CommandLine sanitized(L"dumbo.exe");
42 chrome_launcher::SanitizeCommandLine(bad, &sanitized);
43 EXPECT_TRUE(sanitized.HasSwitch(switches::kDisableMetrics));
44 EXPECT_TRUE(sanitized.HasSwitch(switches::kLoadExtension));
45 EXPECT_FALSE(sanitized.HasSwitch(L"no-such-switch"));
46 EXPECT_FALSE(sanitized.HasSwitch(switches::kHomePage));
47
48 EXPECT_EQ(sanitized.GetSwitchValue(switches::kLoadExtension), L"foo");
49 }
OLDNEW
« no previous file with comments | « chrome_frame/chrome_launcher_main.cc ('k') | chrome_frame/chrome_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine