OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/test/base/scoped_command_line_override.h" | 5 #include "chrome/test/base/scoped_command_line_override.h" |
6 | 6 |
7 ScopedCommandLineOverride::ScopedCommandLineOverride( | 7 ScopedCommandLineOverride::ScopedCommandLineOverride( |
8 const std::string& new_switch) | 8 const std::string& new_switch) |
9 : old_command_line_(*CommandLine::ForCurrentProcess()) { | 9 : old_command_line_(*CommandLine::ForCurrentProcess()) { |
10 CommandLine::ForCurrentProcess()->AppendSwitch(new_switch); | 10 CommandLine::ForCurrentProcess()->AppendSwitch(new_switch); |
11 } | 11 } |
12 | 12 |
| 13 ScopedCommandLineOverride::ScopedCommandLineOverride( |
| 14 CommandLine& old_command_line) |
| 15 : old_command_line_(old_command_line) {} |
| 16 |
| 17 ScopedCommandLineOverride::ScopedCommandLineOverride( |
| 18 const std::string& switch1, |
| 19 const std::string& switch2) |
| 20 : old_command_line_(*CommandLine::ForCurrentProcess()) { |
| 21 CommandLine::ForCurrentProcess()->AppendSwitch(switch1); |
| 22 CommandLine::ForCurrentProcess()->AppendSwitch(switch2); |
| 23 } |
| 24 |
| 25 ScopedCommandLineOverride::ScopedCommandLineOverride( |
| 26 const std::string& switch1, |
| 27 const std::string& switch2, |
| 28 const std::string& switch3) |
| 29 : old_command_line_(*CommandLine::ForCurrentProcess()) { |
| 30 CommandLine::ForCurrentProcess()->AppendSwitch(switch1); |
| 31 CommandLine::ForCurrentProcess()->AppendSwitch(switch2); |
| 32 CommandLine::ForCurrentProcess()->AppendSwitch(switch3); |
| 33 } |
| 34 |
13 ScopedCommandLineOverride::~ScopedCommandLineOverride() { | 35 ScopedCommandLineOverride::~ScopedCommandLineOverride() { |
14 *CommandLine::ForCurrentProcess() = old_command_line_; | 36 *CommandLine::ForCurrentProcess() = old_command_line_; |
15 } | 37 } |
OLD | NEW |