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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc

Issue 848923004: Make all SafeBrowsing* unit_tests work under AddressSanitizer on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address the comment Created 5 years, 11 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/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc
index 46f3283a8c0292fe7a52283510cd82e4c3932683..abebb5f532af26113388d85cd907d6c3db0c8e8c 100644
--- a/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc
@@ -86,12 +86,15 @@ class SafeBrowsingModuleVerifierWinTest : public testing::Test {
scoped_ptr<base::win::PEImage> mem_peimage_ptr_;
};
+// Don't run these tests under AddressSanitizer as it patches the modules on
+// startup, thus interferes with all these test expectations.
+#if !defined(ADDRESS_SANITIZER)
TEST_F(SafeBrowsingModuleVerifierWinTest, VerifyModuleUnmodified) {
std::set<std::string> modified_exports;
// Call VerifyModule before the module has been loaded, should fail.
- EXPECT_EQ(MODULE_STATE_UNKNOWN,
+ ASSERT_EQ(MODULE_STATE_UNKNOWN,
VerifyModule(kTestDllNames[0], &modified_exports));
- EXPECT_EQ(0, modified_exports.size());
+ ASSERT_EQ(0, modified_exports.size());
// On loading, the module should be identical (up to relocations) in memory as
// on disk.
@@ -105,13 +108,13 @@ TEST_F(SafeBrowsingModuleVerifierWinTest, VerifyModuleModified) {
std::set<std::string> modified_exports;
// Confirm the module is identical in memory as on disk before we begin.
SetUpTestDllAndPEImages();
- EXPECT_EQ(MODULE_STATE_UNMODIFIED,
+ ASSERT_EQ(MODULE_STATE_UNMODIFIED,
VerifyModule(kTestDllNames[0], &modified_exports));
uint8_t* mem_code_addr = NULL;
uint8_t* disk_code_addr = NULL;
uint32_t code_size = 0;
- EXPECT_TRUE(GetCodeAddrsAndSize(*mem_peimage_ptr_,
+ ASSERT_TRUE(GetCodeAddrsAndSize(*mem_peimage_ptr_,
*disk_peimage_ptr_,
&mem_code_addr,
&disk_code_addr,
@@ -137,7 +140,7 @@ TEST_F(SafeBrowsingModuleVerifierWinTest, VerifyModuleExportModified) {
std::set<std::string> modified_exports;
// Confirm the module is identical in memory as on disk before we begin.
SetUpTestDllAndPEImages();
- EXPECT_EQ(MODULE_STATE_UNMODIFIED,
+ ASSERT_EQ(MODULE_STATE_UNMODIFIED,
VerifyModule(kTestDllNames[0], &modified_exports));
modified_exports.clear();
@@ -146,8 +149,9 @@ TEST_F(SafeBrowsingModuleVerifierWinTest, VerifyModuleExportModified) {
EditExport();
EXPECT_EQ(MODULE_STATE_MODIFIED,
VerifyModule(kTestDllNames[0], &modified_exports));
- EXPECT_EQ(1, modified_exports.size());
+ ASSERT_EQ(1, modified_exports.size());
EXPECT_EQ(0, std::string(kTestExportName).compare(*modified_exports.begin()));
}
+#endif // ADDRESS_SANITIZER
} // namespace safe_browsing
« no previous file with comments | « chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698