| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/conflicts/module_info_util_win.h" |
| 6 |
| 7 #include <memory> |
| 8 |
| 9 #include "base/base_paths.h" |
| 10 #include "base/environment.h" |
| 11 #include "base/files/file_path.h" |
| 12 #include "base/path_service.h" |
| 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 |
| 16 TEST(ModuleInfoUtil, GetCertificateInfoUnsigned) { |
| 17 base::FilePath path; |
| 18 ASSERT_TRUE(base::PathService::Get(base::FILE_EXE, &path)); |
| 19 ModuleDatabase::CertificateInfo cert_info; |
| 20 GetCertificateInfo(path, &cert_info); |
| 21 EXPECT_EQ(ModuleDatabase::NO_CERTIFICATE, cert_info.type); |
| 22 EXPECT_TRUE(cert_info.path.empty()); |
| 23 EXPECT_TRUE(cert_info.subject.empty()); |
| 24 } |
| 25 |
| 26 TEST(ModuleInfoUtil, GetCertificateInfoSigned) { |
| 27 std::unique_ptr<base::Environment> env = base::Environment::Create(); |
| 28 std::string sysroot; |
| 29 ASSERT_TRUE(env->GetVar("SYSTEMROOT", &sysroot)); |
| 30 |
| 31 base::FilePath path = |
| 32 base::FilePath::FromUTF8Unsafe(sysroot).Append(L"system32\\kernel32.dll"); |
| 33 |
| 34 ModuleDatabase::CertificateInfo cert_info; |
| 35 GetCertificateInfo(path, &cert_info); |
| 36 EXPECT_NE(ModuleDatabase::NO_CERTIFICATE, cert_info.type); |
| 37 EXPECT_FALSE(cert_info.path.empty()); |
| 38 EXPECT_FALSE(cert_info.subject.empty()); |
| 39 } |
| OLD | NEW |