OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/enumerate_modules_model_win.h" | 8 #include "chrome/browser/enumerate_modules_model_win.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 }, { // Matches: Name, location, signature, version (lower) => Confirmed. | 153 }, { // Matches: Name, location, signature, version (lower) => Confirmed. |
154 ModuleEnumerator::CONFIRMED_BAD, | 154 ModuleEnumerator::CONFIRMED_BAD, |
155 kStandardModule, | 155 kStandardModule, |
156 { kMatchName, kMatchLocation, kMatchSignature, | 156 { kMatchName, kMatchLocation, kMatchSignature, |
157 kVersionLow, kEmpty, ModuleEnumerator::SEE_LINK } | 157 kVersionLow, kEmpty, ModuleEnumerator::SEE_LINK } |
158 }, { // Matches: Name, location, signature, version (upper) => Confirmed. | 158 }, { // Matches: Name, location, signature, version (upper) => Confirmed. |
159 ModuleEnumerator::CONFIRMED_BAD, | 159 ModuleEnumerator::CONFIRMED_BAD, |
160 kStandardModule, | 160 kStandardModule, |
161 { kMatchName, kMatchLocation, kMatchSignature, | 161 { kMatchName, kMatchLocation, kMatchSignature, |
162 kEmpty, kVersionHigh, ModuleEnumerator::SEE_LINK } | 162 kEmpty, kVersionHigh, ModuleEnumerator::SEE_LINK } |
| 163 }, { // Matches: Name, Location, Version lower is inclusive => Confirmed. |
| 164 ModuleEnumerator::CONFIRMED_BAD, |
| 165 kStandardModule, |
| 166 { kMatchName, kMatchLocation, kMatchSignature, |
| 167 "1.0", "2.0", ModuleEnumerator::SEE_LINK } |
| 168 }, { // Matches: Name, Location, Version higher is exclusive => No match. |
| 169 ModuleEnumerator::NOT_MATCHED, |
| 170 kStandardModule, |
| 171 { kMatchName, kMatchLocation, kEmpty, |
| 172 "0.0", "1.0", ModuleEnumerator::SEE_LINK } |
163 }, { // All empty fields doesn't produce a match. | 173 }, { // All empty fields doesn't produce a match. |
164 ModuleEnumerator::NOT_MATCHED, | 174 ModuleEnumerator::NOT_MATCHED, |
165 {kType, kStatus, L"", L"", L"", L"", L""}, | 175 { kType, kStatus, L"", L"", L"", L"", L""}, |
166 { "a.dll", "", "", "", "", ModuleEnumerator::SEE_LINK } | 176 { "a.dll", "", "", "", "", ModuleEnumerator::SEE_LINK } |
167 }, | 177 }, |
168 }; | 178 }; |
169 | 179 |
170 TEST_F(EnumerateModulesTest, MatchFunction) { | 180 TEST_F(EnumerateModulesTest, MatchFunction) { |
171 for (size_t i = 0; i < arraysize(kMatchineEntryList); ++i) { | 181 for (size_t i = 0; i < arraysize(kMatchineEntryList); ++i) { |
172 ModuleEnumerator::Module test = kMatchineEntryList[i].test_case; | 182 ModuleEnumerator::Module test = kMatchineEntryList[i].test_case; |
173 ModuleEnumerator::NormalizeModule(&test); | 183 ModuleEnumerator::NormalizeModule(&test); |
174 ModuleEnumerator::BlacklistEntry blacklist = | 184 ModuleEnumerator::BlacklistEntry blacklist = |
175 kMatchineEntryList[i].blacklist; | 185 kMatchineEntryList[i].blacklist; |
176 | 186 |
177 SCOPED_TRACE("Test case no " + base::IntToString(i) + | 187 SCOPED_TRACE("Test case no " + base::IntToString(i) + |
178 ": '" + UTF16ToASCII(test.name) + "'"); | 188 ": '" + UTF16ToASCII(test.name) + "'"); |
179 EXPECT_EQ(kMatchineEntryList[i].expected_result, | 189 EXPECT_EQ(kMatchineEntryList[i].expected_result, |
180 ModuleEnumerator::Match(test, blacklist)); | 190 ModuleEnumerator::Match(test, blacklist)); |
181 } | 191 } |
182 } | 192 } |
OLD | NEW |