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

Unified Diff: extensions/common/test/scoped_command_line_switch.cc

Issue 1054813002: Refactor ScopedCommandLineSwitch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelisted
Patch Set: Created 5 years, 9 months 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
« no previous file with comments | « extensions/common/test/scoped_command_line_switch.h ('k') | extensions/extensions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/test/scoped_command_line_switch.cc
diff --git a/extensions/common/test/scoped_command_line_switch.cc b/extensions/common/test/scoped_command_line_switch.cc
new file mode 100644
index 0000000000000000000000000000000000000000..700a52d4cf8f46a525a3ab29fccb64119fcb1f01
--- /dev/null
+++ b/extensions/common/test/scoped_command_line_switch.cc
@@ -0,0 +1,23 @@
+// Copyright 2015 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 "extensions/common/test/scoped_command_line_switch.h"
+
+ScopedCommandLineSwitch::ScopedCommandLineSwitch(
+ const std::string& switch_string)
+ : original_command_line_(*base::CommandLine::ForCurrentProcess()) {
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(switch_string);
+}
+
+ScopedCommandLineSwitch::ScopedCommandLineSwitch(
+ const std::string& switch_string,
+ const std::string& value)
+ : original_command_line_(*base::CommandLine::ForCurrentProcess()) {
+ base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(switch_string,
+ value);
+}
+
+ScopedCommandLineSwitch::~ScopedCommandLineSwitch() {
+ *base::CommandLine::ForCurrentProcess() = original_command_line_;
+}
« no previous file with comments | « extensions/common/test/scoped_command_line_switch.h ('k') | extensions/extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698