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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/googletest/include/gtest/gtest.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 | 16 |
17 // To test Windows quoting behavior, we use a string that has some backslashes | 17 // To test Windows quoting behavior, we use a string that has some backslashes |
18 // and quotes. | 18 // and quotes. |
19 // Consider the command-line argument: q\"bs1\bs2\\bs3q\\\" | 19 // Consider the command-line argument: q\"bs1\bs2\\bs3q\\\" |
20 // Here it is with C-style escapes. | 20 // Here it is with C-style escapes. |
21 static const CommandLine::StringType kTrickyQuoted = | 21 static const CommandLine::StringType kTrickyQuoted = |
22 FILE_PATH_LITERAL("q\\\"bs1\\bs2\\\\bs3q\\\\\\\""); | 22 FILE_PATH_LITERAL("q\\\"bs1\\bs2\\\\bs3q\\\\\\\""); |
23 // It should be parsed by Windows as: q"bs1\bs2\\bs3q\" | 23 // It should be parsed by Windows as: q"bs1\bs2\\bs3q\" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 CommandLine assigned = *initial; | 397 CommandLine assigned = *initial; |
398 CommandLine::SwitchMap switch_map = initial->GetSwitches(); | 398 CommandLine::SwitchMap switch_map = initial->GetSwitches(); |
399 initial.reset(); | 399 initial.reset(); |
400 for (const auto& pair : switch_map) | 400 for (const auto& pair : switch_map) |
401 EXPECT_TRUE(copy_constructed.HasSwitch(pair.first)); | 401 EXPECT_TRUE(copy_constructed.HasSwitch(pair.first)); |
402 for (const auto& pair : switch_map) | 402 for (const auto& pair : switch_map) |
403 EXPECT_TRUE(assigned.HasSwitch(pair.first)); | 403 EXPECT_TRUE(assigned.HasSwitch(pair.first)); |
404 } | 404 } |
405 | 405 |
406 } // namespace base | 406 } // namespace base |
OLD | NEW |