| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 ModuleEnumerator::NONE }; | 83 ModuleEnumerator::NONE }; |
| 84 const ModuleEnumerator::Module kStandardModuleNoDescription = | 84 const ModuleEnumerator::Module kStandardModuleNoDescription = |
| 85 { kType, kStatus, L"c:\\foo\\bar.dll", L"", L"Prod", L"", L"1.0", L"Sig", | 85 { kType, kStatus, L"c:\\foo\\bar.dll", L"", L"Prod", L"", L"1.0", L"Sig", |
| 86 ModuleEnumerator::NONE }; | 86 ModuleEnumerator::NONE }; |
| 87 const ModuleEnumerator::Module kStandardModuleNoSignature = | 87 const ModuleEnumerator::Module kStandardModuleNoSignature = |
| 88 { kType, kStatus, L"c:\\foo\\bar.dll", L"", L"Prod", L"Desc", L"1.0", L"", | 88 { kType, kStatus, L"c:\\foo\\bar.dll", L"", L"Prod", L"Desc", L"1.0", L"", |
| 89 ModuleEnumerator::NONE }; | 89 ModuleEnumerator::NONE }; |
| 90 | 90 |
| 91 // Name, location, description and signature are compared by hashing. | 91 // Name, location, description and signature are compared by hashing. |
| 92 static const char kMatchName[] = "88e8c9e0"; // "bar.dll". | 92 static const char kMatchName[] = "88e8c9e0"; // "bar.dll". |
| 93 static const char kNoMatchName[] = "barfoo.dll"; | |
| 94 static const char kMatchLocation[] = "e6ca7b1c"; // "c:\\foo\\". | 93 static const char kMatchLocation[] = "e6ca7b1c"; // "c:\\foo\\". |
| 95 static const char kNoMatchLocation[] = "c:\\foobar\\"; | 94 static const char kNoMatchLocation[] = "c:\\foobar\\"; |
| 96 static const char kMatchDesc[] = "5c4419a6"; // "Desc". | 95 static const char kMatchDesc[] = "5c4419a6"; // "Desc". |
| 97 static const char kNoMatchDesc[] = "NoDesc"; | |
| 98 static const char kVersionHigh[] = "2.0"; | 96 static const char kVersionHigh[] = "2.0"; |
| 99 static const char kVersionLow[] = "0.5"; | 97 static const char kVersionLow[] = "0.5"; |
| 100 static const char kMatchSignature[] = "7bfd87e1"; // "Sig". | 98 static const char kMatchSignature[] = "7bfd87e1"; // "Sig". |
| 101 static const char kNoMatchSignature[] = "giS"; | |
| 102 static const char kEmpty[] = ""; | 99 static const char kEmpty[] = ""; |
| 103 | 100 |
| 104 const struct MatchingEntryList { | 101 const struct MatchingEntryList { |
| 105 ModuleEnumerator::ModuleStatus expected_result; | 102 ModuleEnumerator::ModuleStatus expected_result; |
| 106 ModuleEnumerator::Module test_case; | 103 ModuleEnumerator::Module test_case; |
| 107 ModuleEnumerator::BlacklistEntry blacklist; | 104 ModuleEnumerator::BlacklistEntry blacklist; |
| 108 } kMatchineEntryList[] = { | 105 } kMatchineEntryList[] = { |
| 109 // Each BlacklistEntry is: | 106 // Each BlacklistEntry is: |
| 110 // Filename, location, desc_or_signer, version from, version to, help_tip. | 107 // Filename, location, desc_or_signer, version from, version to, help_tip. |
| 111 | 108 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 ModuleEnumerator::Module module; | 231 ModuleEnumerator::Module module; |
| 235 module.location = kCollapsePathList[i].test_case; | 232 module.location = kCollapsePathList[i].test_case; |
| 236 module_enumerator->CollapsePath(&module); | 233 module_enumerator->CollapsePath(&module); |
| 237 | 234 |
| 238 SCOPED_TRACE("Test case no " + base::IntToString(i) + ": '" + | 235 SCOPED_TRACE("Test case no " + base::IntToString(i) + ": '" + |
| 239 base::UTF16ToASCII(kCollapsePathList[i].expected_result) + | 236 base::UTF16ToASCII(kCollapsePathList[i].expected_result) + |
| 240 "'"); | 237 "'"); |
| 241 EXPECT_EQ(kCollapsePathList[i].expected_result, module.location); | 238 EXPECT_EQ(kCollapsePathList[i].expected_result, module.location); |
| 242 } | 239 } |
| 243 } | 240 } |
| OLD | NEW |