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

Side by Side Diff: chrome/browser/conflicts/module_info_util_win_unittest.cc

Issue 2653333002: [win] Create utilities for helping to populate ModuleDatabase. (Closed)
Patch Set: Fix include order. Created 3 years, 10 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
(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 }
OLDNEW
« no previous file with comments | « chrome/browser/conflicts/module_info_util_win.cc ('k') | chrome/browser/win/enumerate_modules_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698