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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // Case 10. Version1 > Version2. Multiple digit numbers. | 124 // Case 10. Version1 > Version2. Multiple digit numbers. |
125 EXPECT_TRUE(CompareVersionStrings("0.0.12.1", "0.0.10.3", &result)); | 125 EXPECT_TRUE(CompareVersionStrings("0.0.12.1", "0.0.10.3", &result)); |
126 EXPECT_EQ(1, result); | 126 EXPECT_EQ(1, result); |
127 | 127 |
128 // Case 11. Version1 < Version2. Multiple digit number. | 128 // Case 11. Version1 < Version2. Multiple digit number. |
129 EXPECT_TRUE(CompareVersionStrings("10.11.12.13", "12.11.12.13", &result)); | 129 EXPECT_TRUE(CompareVersionStrings("10.11.12.13", "12.11.12.13", &result)); |
130 EXPECT_EQ(-1, result); | 130 EXPECT_EQ(-1, result); |
131 } | 131 } |
132 | 132 |
133 } // namespace install_static | 133 } // namespace install_static |
OLD | NEW |