OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 static const char kThirdArgName[] = "arg with space"; | 191 static const char kThirdArgName[] = "arg with space"; |
192 static const char kFourthArgName[] = "nospace"; | 192 static const char kFourthArgName[] = "nospace"; |
193 | 193 |
194 CommandLine cl(CommandLine::NO_PROGRAM); | 194 CommandLine cl(CommandLine::NO_PROGRAM); |
195 cl.AppendSwitchPath(kFirstArgName, FilePath(kPath1)); | 195 cl.AppendSwitchPath(kFirstArgName, FilePath(kPath1)); |
196 cl.AppendSwitchPath(kSecondArgName, FilePath(kPath2)); | 196 cl.AppendSwitchPath(kSecondArgName, FilePath(kPath2)); |
197 cl.AppendArg(kThirdArgName); | 197 cl.AppendArg(kThirdArgName); |
198 cl.AppendArg(kFourthArgName); | 198 cl.AppendArg(kFourthArgName); |
199 | 199 |
200 #if defined(OS_WIN) | 200 #if defined(OS_WIN) |
201 CommandLine::StringType expected_first_arg(UTF8ToUTF16(kFirstArgName)); | 201 CommandLine::StringType expected_first_arg( |
202 CommandLine::StringType expected_second_arg(UTF8ToUTF16(kSecondArgName)); | 202 base::UTF8ToUTF16(kFirstArgName)); |
203 CommandLine::StringType expected_third_arg(UTF8ToUTF16(kThirdArgName)); | 203 CommandLine::StringType expected_second_arg( |
204 CommandLine::StringType expected_fourth_arg(UTF8ToUTF16(kFourthArgName)); | 204 base::UTF8ToUTF16(kSecondArgName)); |
| 205 CommandLine::StringType expected_third_arg( |
| 206 base::UTF8ToUTF16(kThirdArgName)); |
| 207 CommandLine::StringType expected_fourth_arg( |
| 208 base::UTF8ToUTF16(kFourthArgName)); |
205 #elif defined(OS_POSIX) | 209 #elif defined(OS_POSIX) |
206 CommandLine::StringType expected_first_arg(kFirstArgName); | 210 CommandLine::StringType expected_first_arg(kFirstArgName); |
207 CommandLine::StringType expected_second_arg(kSecondArgName); | 211 CommandLine::StringType expected_second_arg(kSecondArgName); |
208 CommandLine::StringType expected_third_arg(kThirdArgName); | 212 CommandLine::StringType expected_third_arg(kThirdArgName); |
209 CommandLine::StringType expected_fourth_arg(kFourthArgName); | 213 CommandLine::StringType expected_fourth_arg(kFourthArgName); |
210 #endif | 214 #endif |
211 | 215 |
212 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
213 #define QUOTE_ON_WIN FILE_PATH_LITERAL("\"") | 217 #define QUOTE_ON_WIN FILE_PATH_LITERAL("\"") |
214 #else | 218 #else |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 355 } |
352 #endif | 356 #endif |
353 | 357 |
354 // Calling Init multiple times should not modify the previous CommandLine. | 358 // Calling Init multiple times should not modify the previous CommandLine. |
355 TEST(CommandLineTest, Init) { | 359 TEST(CommandLineTest, Init) { |
356 CommandLine* initial = CommandLine::ForCurrentProcess(); | 360 CommandLine* initial = CommandLine::ForCurrentProcess(); |
357 EXPECT_FALSE(CommandLine::Init(0, NULL)); | 361 EXPECT_FALSE(CommandLine::Init(0, NULL)); |
358 CommandLine* current = CommandLine::ForCurrentProcess(); | 362 CommandLine* current = CommandLine::ForCurrentProcess(); |
359 EXPECT_EQ(initial, current); | 363 EXPECT_EQ(initial, current); |
360 } | 364 } |
OLD | NEW |