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

Unified Diff: chrome/test/base/scoped_command_line_override.h

Issue 8429023: Add platform_app flag to manifest. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge conflict resolution. Created 9 years, 1 month 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
Index: chrome/test/base/scoped_command_line_override.h
diff --git a/chrome/test/base/scoped_command_line_override.h b/chrome/test/base/scoped_command_line_override.h
new file mode 100644
index 0000000000000000000000000000000000000000..33ebd8a1ff356616230089938aa20a4fbc252d3c
--- /dev/null
+++ b/chrome/test/base/scoped_command_line_override.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_TEST_BASE_SCOPED_COMMAND_LINE_OVERRIDE_H_
+#define CHROME_TEST_BASE_SCOPED_COMMAND_LINE_OVERRIDE_H_
+#pragma once
+
+#include <string>
+
+#include "base/command_line.h"
+
+// ScopedCommandLineOverride takes the CommandLine for the current
+// process, saves it, then alters it. When the instance of this class
+// goes out of scope, it restores CommandLine to its prior state. The
+// intended usage is to test something that requires a flag that's off
+// by default:
+//
+// ASSERT_TRUE(!Something::NotFullyBaked());
+// {
+// ScopedCommandLineOverride override(switches:kEnableSomethingHalfBaked);
+// ASSERT_TRUE(Something::NotFullyBaked());
+// }
+class ScopedCommandLineOverride {
+ public:
+ explicit ScopedCommandLineOverride(const std::string& new_switch);
+ virtual ~ScopedCommandLineOverride();
+ private:
+ CommandLine old_command_line_;
+};
+
+#endif // CHROME_TEST_BASE_SCOPED_COMMAND_LINE_OVERRIDE_H_
« no previous file with comments | « chrome/common/extensions/extension_manifests_unittest.cc ('k') | chrome/test/base/scoped_command_line_override.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698