OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/strings/string_number_conversions.h" | 5 #include "base/strings/string_number_conversions.h" |
6 #include "base/strings/string_util.h" | 6 #include "base/strings/string_util.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 }; | 197 }; |
198 | 198 |
199 TEST_F(EnumerateModulesTest, MatchFunction) { | 199 TEST_F(EnumerateModulesTest, MatchFunction) { |
200 for (size_t i = 0; i < arraysize(kMatchineEntryList); ++i) { | 200 for (size_t i = 0; i < arraysize(kMatchineEntryList); ++i) { |
201 ModuleEnumerator::Module test = kMatchineEntryList[i].test_case; | 201 ModuleEnumerator::Module test = kMatchineEntryList[i].test_case; |
202 ModuleEnumerator::NormalizeModule(&test); | 202 ModuleEnumerator::NormalizeModule(&test); |
203 ModuleEnumerator::BlacklistEntry blacklist = | 203 ModuleEnumerator::BlacklistEntry blacklist = |
204 kMatchineEntryList[i].blacklist; | 204 kMatchineEntryList[i].blacklist; |
205 | 205 |
206 SCOPED_TRACE("Test case no " + base::IntToString(i) + | 206 SCOPED_TRACE("Test case no " + base::IntToString(i) + |
207 ": '" + UTF16ToASCII(test.name) + "'"); | 207 ": '" + base::UTF16ToASCII(test.name) + "'"); |
208 EXPECT_EQ(kMatchineEntryList[i].expected_result, | 208 EXPECT_EQ(kMatchineEntryList[i].expected_result, |
209 ModuleEnumerator::Match(test, blacklist)); | 209 ModuleEnumerator::Match(test, blacklist)); |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 const struct CollapsePathList { | 213 const struct CollapsePathList { |
214 base::string16 expected_result; | 214 base::string16 expected_result; |
215 base::string16 test_case; | 215 base::string16 test_case; |
216 } kCollapsePathList[] = { | 216 } kCollapsePathList[] = { |
217 // Negative testing (should not collapse this path). | 217 // Negative testing (should not collapse this path). |
(...skipping 10 matching lines...) Expand all Loading... |
228 module_enumerator->path_mapping_.push_back( | 228 module_enumerator->path_mapping_.push_back( |
229 std::make_pair(L"c:\\foo\\", L"%foo%")); | 229 std::make_pair(L"c:\\foo\\", L"%foo%")); |
230 module_enumerator->path_mapping_.push_back( | 230 module_enumerator->path_mapping_.push_back( |
231 std::make_pair(L"c:\\foo\\bar\\", L"%x%")); | 231 std::make_pair(L"c:\\foo\\bar\\", L"%x%")); |
232 | 232 |
233 for (size_t i = 0; i < arraysize(kCollapsePathList); ++i) { | 233 for (size_t i = 0; i < arraysize(kCollapsePathList); ++i) { |
234 ModuleEnumerator::Module module; | 234 ModuleEnumerator::Module module; |
235 module.location = kCollapsePathList[i].test_case; | 235 module.location = kCollapsePathList[i].test_case; |
236 module_enumerator->CollapsePath(&module); | 236 module_enumerator->CollapsePath(&module); |
237 | 237 |
238 SCOPED_TRACE("Test case no " + base::IntToString(i) + | 238 SCOPED_TRACE("Test case no " + base::IntToString(i) + ": '" + |
239 ": '" + UTF16ToASCII(kCollapsePathList[i].expected_result) + | 239 base::UTF16ToASCII(kCollapsePathList[i].expected_result) + |
240 "'"); | 240 "'"); |
241 EXPECT_EQ(kCollapsePathList[i].expected_result, module.location); | 241 EXPECT_EQ(kCollapsePathList[i].expected_result, module.location); |
242 } | 242 } |
243 } | 243 } |
OLD | NEW |