Index: chrome/test/base/scoped_command_line_override.cc |
diff --git a/chrome/test/base/scoped_command_line_override.cc b/chrome/test/base/scoped_command_line_override.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bd4cb30a2ccb8f32aad22be81e42eda94a695957 |
--- /dev/null |
+++ b/chrome/test/base/scoped_command_line_override.cc |
@@ -0,0 +1,15 @@ |
+// 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. |
+ |
+#include "chrome/test/base/scoped_command_line_override.h" |
+ |
+ScopedCommandLineOverride::ScopedCommandLineOverride( |
+ const std::string& new_switch) |
+ : old_command_line_(*CommandLine::ForCurrentProcess()) { |
+ CommandLine::ForCurrentProcess()->AppendSwitch(new_switch); |
+} |
+ |
+ScopedCommandLineOverride::~ScopedCommandLineOverride() { |
+ *CommandLine::ForCurrentProcess() = old_command_line_; |
+} |