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

Unified Diff: chrome/browser/safe_browsing/incident_reporting/environment_data_collection_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 | « no previous file | chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc
diff --git a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc
index cab5b073cced49cc164375fe14ef200c06b71eb6..b5b559b67ce99af7fda51d356ee993bae91aa1dd 100644
--- a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection_win_unittest.cc
@@ -182,10 +182,10 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, VerifyLoadedModules) {
// Edit the first byte of the function exported by the first module. Calling
// GetModuleHandle so we do not increment the library ref count.
HMODULE module_handle = GetModuleHandle(safe_browsing::kTestDllNames[0]);
- EXPECT_NE(reinterpret_cast<HANDLE>(NULL), module_handle);
+ ASSERT_NE(reinterpret_cast<HANDLE>(NULL), module_handle);
uint8_t* export_addr = reinterpret_cast<uint8_t*>(
GetProcAddress(module_handle, safe_browsing::kTestExportName));
- EXPECT_NE(reinterpret_cast<uint8_t*>(NULL), export_addr);
+ ASSERT_NE(reinterpret_cast<uint8_t*>(NULL), export_addr);
uint8_t new_val = (*export_addr) + 1;
SIZE_T bytes_written = 0;
@@ -194,7 +194,7 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, VerifyLoadedModules) {
reinterpret_cast<void*>(&new_val),
1,
&bytes_written);
- EXPECT_EQ(1, bytes_written);
+ ASSERT_EQ(1, bytes_written);
safe_browsing::ClientIncidentReport_EnvironmentData_Process process_report;
safe_browsing::CollectModuleVerificationData(
@@ -205,7 +205,14 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, VerifyLoadedModules) {
// CollectModuleVerificationData should return the single modified module and
// its modified export. The other module, being unmodified, is omitted from
// the returned list of modules.
+ // AddressSanitizer build is special though, as it patches the code at
+ // startup, which makes every single module modified and introduces extra
+ // exports.
+ ASSERT_LE(1, process_report.module_state_size());
+#if !defined(ADDRESS_SANITIZER)
EXPECT_EQ(1, process_report.module_state_size());
+ EXPECT_EQ(1, process_report.module_state(0).modified_export_size());
+#endif
EXPECT_EQ(base::WideToUTF8(safe_browsing::kTestDllNames[0]),
process_report.module_state(0).name());
@@ -213,7 +220,6 @@ TEST(SafeBrowsingEnvironmentDataCollectionWinTest, VerifyLoadedModules) {
safe_browsing::ClientIncidentReport_EnvironmentData_Process_ModuleState::
MODULE_STATE_MODIFIED,
process_report.module_state(0).modified_state());
- EXPECT_EQ(1, process_report.module_state(0).modified_export_size());
EXPECT_EQ(std::string(safe_browsing::kTestExportName),
process_report.module_state(0).modified_export(0));
}
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/incident_reporting/module_integrity_verifier_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698