Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/install_static/install_util_unittest.cc

Issue 2031833002: Remove FilePath usage from the CrashReporterClient interface on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused constant to fix clang Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 EXPECT_THAT(results, ElementsAre("", "", "", "")); 59 EXPECT_THAT(results, ElementsAre("", "", "", ""));
60 60
61 // Test string with spaces separated by delimiters. 61 // Test string with spaces separated by delimiters.
62 results = TokenizeString(" | | | |", '|', false); 62 results = TokenizeString(" | | | |", '|', false);
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
70 // TokenizeString16 tests.
71 // Test if the string is tokenized correctly with all tokens stripped of
72 // leading and trailing spaces.
73 std::vector<base::string16> results16 =
74 TokenizeString16(L"un |deux\t|trois\n|quatre", L'|', true);
75 ASSERT_EQ(4u, results16.size());
76 EXPECT_THAT(results16, ElementsAre(L"un", L"deux", L"trois", L"quatre"));
77
78 // Test string with spaces separated by delimiters.
79 results16 = TokenizeString16(L"one|two||four", L'|', false);
80 ASSERT_EQ(4u, results16.size());
81 EXPECT_THAT(results16, ElementsAre(L"one", L"two", L"", L"four"));
69 } 82 }
70 83
71 // Tests the CompareVersionString function in the install_static library. 84 // Tests the CompareVersionString function in the install_static library.
72 TEST(InstallStaticTest, CompareVersions) { 85 TEST(InstallStaticTest, CompareVersions) {
73 // Case 1. Invalid versions. 86 // Case 1. Invalid versions.
74 int result = 0; 87 int result = 0;
75 EXPECT_FALSE(CompareVersionStrings("", "", &result)); 88 EXPECT_FALSE(CompareVersionStrings("", "", &result));
76 EXPECT_FALSE(CompareVersionStrings("0.0.0.0", "A.B.C.D", &result)); 89 EXPECT_FALSE(CompareVersionStrings("0.0.0.0", "A.B.C.D", &result));
77 EXPECT_FALSE(CompareVersionStrings("A.0.0.0", "0.0.0.0", &result)); 90 EXPECT_FALSE(CompareVersionStrings("A.0.0.0", "0.0.0.0", &result));
78 91
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Case 10. Version1 > Version2. Multiple digit numbers. 124 // Case 10. Version1 > Version2. Multiple digit numbers.
112 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));
113 EXPECT_EQ(1, result); 126 EXPECT_EQ(1, result);
114 127
115 // Case 11. Version1 < Version2. Multiple digit number. 128 // Case 11. Version1 < Version2. Multiple digit number.
116 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));
117 EXPECT_EQ(-1, result); 130 EXPECT_EQ(-1, result);
118 } 131 }
119 132
120 } // namespace install_static 133 } // namespace install_static
OLDNEW
« no previous file with comments | « chrome/install_static/install_util.cc ('k') | chrome/installer/setup/installer_crash_reporter_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698