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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 EXPECT_EQ(kProgramPath.value(), cl_program_path.GetProgram().value()); | 277 EXPECT_EQ(kProgramPath.value(), cl_program_path.GetProgram().value()); |
278 | 278 |
279 // Check that quotes are added to command line string paths containing spaces. | 279 // Check that quotes are added to command line string paths containing spaces. |
280 CommandLine::StringType cmd_string(cl_program_path.command_line_string()); | 280 CommandLine::StringType cmd_string(cl_program_path.command_line_string()); |
281 CommandLine::StringType program_string(cl_program_path.GetProgram().value()); | 281 CommandLine::StringType program_string(cl_program_path.GetProgram().value()); |
282 EXPECT_EQ('"', cmd_string[0]); | 282 EXPECT_EQ('"', cmd_string[0]); |
283 EXPECT_EQ(program_string, cmd_string.substr(1, program_string.length())); | 283 EXPECT_EQ(program_string, cmd_string.substr(1, program_string.length())); |
284 EXPECT_EQ('"', cmd_string[program_string.length() + 1]); | 284 EXPECT_EQ('"', cmd_string[program_string.length() + 1]); |
285 } | 285 } |
286 #endif | 286 #endif |
| 287 |
| 288 // Calling Init multiple times should not modify the previous CommandLine. |
| 289 TEST(CommandLineTest, Init) { |
| 290 CommandLine* initial = CommandLine::ForCurrentProcess(); |
| 291 CommandLine::Init(0, NULL); |
| 292 CommandLine* current = CommandLine::ForCurrentProcess(); |
| 293 EXPECT_EQ(initial, current); |
| 294 } |
OLD | NEW |