OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/install_static/install_util.h" | 5 #include "chrome/install_static/install_util.h" |
6 | 6 |
7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 using ::testing::ElementsAre; | 10 using ::testing::ElementsAre; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ASSERT_EQ(4u, results.size()); | 63 ASSERT_EQ(4u, results.size()); |
64 EXPECT_THAT(results, ElementsAre(" ", " ", " ", " ")); | 64 EXPECT_THAT(results, ElementsAre(" ", " ", " ", " ")); |
65 | 65 |
66 results = TokenizeString("one|two||four", '|', false); | 66 results = TokenizeString("one|two||four", '|', false); |
67 ASSERT_EQ(4u, results.size()); | 67 ASSERT_EQ(4u, results.size()); |
68 EXPECT_THAT(results, ElementsAre("one", "two", "", "four")); | 68 EXPECT_THAT(results, ElementsAre("one", "two", "", "four")); |
69 | 69 |
70 // TokenizeString16 tests. | 70 // TokenizeString16 tests. |
71 // Test if the string is tokenized correctly with all tokens stripped of | 71 // Test if the string is tokenized correctly with all tokens stripped of |
72 // leading and trailing spaces. | 72 // leading and trailing spaces. |
73 std::vector<base::string16> results16 = | 73 std::vector<std::wstring> results16 = |
74 TokenizeString16(L"un |deux\t|trois\n|quatre", L'|', true); | 74 TokenizeString16(L"un |deux\t|trois\n|quatre", L'|', true); |
75 ASSERT_EQ(4u, results16.size()); | 75 ASSERT_EQ(4u, results16.size()); |
76 EXPECT_THAT(results16, ElementsAre(L"un", L"deux", L"trois", L"quatre")); | 76 EXPECT_THAT(results16, ElementsAre(L"un", L"deux", L"trois", L"quatre")); |
77 | 77 |
78 // Test string with spaces separated by delimiters. | 78 // Test string with spaces separated by delimiters. |
79 results16 = TokenizeString16(L"one|two||four", L'|', false); | 79 results16 = TokenizeString16(L"one|two||four", L'|', false); |
80 ASSERT_EQ(4u, results16.size()); | 80 ASSERT_EQ(4u, results16.size()); |
81 EXPECT_THAT(results16, ElementsAre(L"one", L"two", L"", L"four")); | 81 EXPECT_THAT(results16, ElementsAre(L"one", L"two", L"", L"four")); |
82 } | 82 } |
83 | 83 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type= bar", | 187 value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type= bar", |
188 "type"); | 188 "type"); |
189 EXPECT_EQ("bar", value); | 189 EXPECT_EQ("bar", value); |
190 | 190 |
191 // Tabs after the "=" before the value. | 191 // Tabs after the "=" before the value. |
192 value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type=\t\t\tbar", | 192 value = GetSwitchValueFromCommandLine("c:\\temp\\bleh.exe --type=\t\t\tbar", |
193 "type"); | 193 "type"); |
194 EXPECT_EQ(value, "bar"); | 194 EXPECT_EQ(value, "bar"); |
195 } | 195 } |
196 | 196 |
197 } // namespace install_static | 197 } // namespace install_static |
OLD | NEW |