diff options
author | slightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 05:11:58 +0000 |
---|---|---|
committer | slightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 05:11:58 +0000 |
commit | f781782dd67077478e117c61dca4ea5eefce3544 (patch) | |
tree | 4801f724123cfdcbb69c4e7fe40a565b331723ae /chrome_frame/chrome_launcher_unittest.cc | |
parent | 63cf4759efa2373e33436fb5df6849f930081226 (diff) | |
download | chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.zip chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.gz chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.bz2 |
Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming in a separate CL.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/218019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/chrome_launcher_unittest.cc')
-rw-r--r-- | chrome_frame/chrome_launcher_unittest.cc | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/chrome_frame/chrome_launcher_unittest.cc b/chrome_frame/chrome_launcher_unittest.cc new file mode 100644 index 0000000..1181f09 --- /dev/null +++ b/chrome_frame/chrome_launcher_unittest.cc @@ -0,0 +1,49 @@ +// Copyright (c) 2009 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 "base/command_line.h"
+#include "base/logging.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome_frame/chrome_launcher.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+// Utility class to disable logging. Required to disable DCHECKs that some
+// of our tests would otherwise trigger.
+class LogDisabler {
+ public:
+ LogDisabler() {
+ initial_log_level_ = logging::GetMinLogLevel();
+ logging::SetMinLogLevel(logging::LOG_FATAL + 1);
+ }
+
+ ~LogDisabler() {
+ logging::SetMinLogLevel(initial_log_level_);
+ }
+
+ private:
+ int initial_log_level_;
+};
+
+} // namespace
+
+TEST(ChromeLauncher, SanitizeCommandLine) {
+ CommandLine bad(L"dummy.exe");
+ bad.AppendSwitch(switches::kDisableMetrics); // in whitelist
+ bad.AppendSwitchWithValue(switches::kLoadExtension, L"foo"); // in whitelist
+ bad.AppendSwitch(L"no-such-switch"); // does not exist
+ bad.AppendSwitch(switches::kHomePage); // exists but not in whitelist
+
+ LogDisabler no_dchecks;
+
+ CommandLine sanitized(L"dumbo.exe");
+ chrome_launcher::SanitizeCommandLine(bad, &sanitized);
+ EXPECT_TRUE(sanitized.HasSwitch(switches::kDisableMetrics));
+ EXPECT_TRUE(sanitized.HasSwitch(switches::kLoadExtension));
+ EXPECT_FALSE(sanitized.HasSwitch(L"no-such-switch"));
+ EXPECT_FALSE(sanitized.HasSwitch(switches::kHomePage));
+
+ EXPECT_EQ(sanitized.GetSwitchValue(switches::kLoadExtension), L"foo");
+}
|