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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/conflicts/module_info_util_win_unittest.cc
diff --git a/chrome/browser/conflicts/module_info_util_win_unittest.cc b/chrome/browser/conflicts/module_info_util_win_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f713bd10f2652bf1d5941a94f2a743821b5a4b2c
--- /dev/null
+++ b/chrome/browser/conflicts/module_info_util_win_unittest.cc
@@ -0,0 +1,39 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/conflicts/module_info_util_win.h"
+
+#include <memory>
+
+#include "base/base_paths.h"
+#include "base/environment.h"
+#include "base/files/file_path.h"
+#include "base/path_service.h"
+#include "base/strings/utf_string_conversions.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(ModuleInfoUtil, GetCertificateInfoUnsigned) {
+ base::FilePath path;
+ ASSERT_TRUE(base::PathService::Get(base::FILE_EXE, &path));
+ ModuleDatabase::CertificateInfo cert_info;
+ GetCertificateInfo(path, &cert_info);
+ EXPECT_EQ(ModuleDatabase::NO_CERTIFICATE, cert_info.type);
+ EXPECT_TRUE(cert_info.path.empty());
+ EXPECT_TRUE(cert_info.subject.empty());
+}
+
+TEST(ModuleInfoUtil, GetCertificateInfoSigned) {
+ std::unique_ptr<base::Environment> env = base::Environment::Create();
+ std::string sysroot;
+ ASSERT_TRUE(env->GetVar("SYSTEMROOT", &sysroot));
+
+ base::FilePath path =
+ base::FilePath::FromUTF8Unsafe(sysroot).Append(L"system32\\kernel32.dll");
+
+ ModuleDatabase::CertificateInfo cert_info;
+ GetCertificateInfo(path, &cert_info);
+ EXPECT_NE(ModuleDatabase::NO_CERTIFICATE, cert_info.type);
+ EXPECT_FALSE(cert_info.path.empty());
+ EXPECT_FALSE(cert_info.subject.empty());
+}
« 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