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

Unified Diff: components/browser_watcher/postmortem_report_collector_unittest.cc

Issue 2649773008: Collect module information from the stability file (Closed)
Patch Set: YA signed/unsigned Created 3 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
Index: components/browser_watcher/postmortem_report_collector_unittest.cc
diff --git a/components/browser_watcher/postmortem_report_collector_unittest.cc b/components/browser_watcher/postmortem_report_collector_unittest.cc
index d7c2307ce33b64a8f3dfbb2b2eddad98af807110..6f79bbbb68b878125ed04a0d74b83795072d4baa 100644
--- a/components/browser_watcher/postmortem_report_collector_unittest.cc
+++ b/components/browser_watcher/postmortem_report_collector_unittest.cc
@@ -585,7 +585,7 @@ TEST_F(PostmortemReportCollectorCollectionFromGlobalTrackerTest,
collector.Collect(debug_file_path(), &report));
ASSERT_NE(nullptr, report);
- // Validate the report's log content.
+ // Validate the report's user data.
const auto& collected_data = report->global_data();
ASSERT_EQ(8U, collected_data.size());
@@ -628,4 +628,52 @@ TEST_F(PostmortemReportCollectorCollectionFromGlobalTrackerTest,
EXPECT_EQ(strlen(string2), static_cast<uint64_t>(sref.size()));
}
+TEST_F(PostmortemReportCollectorCollectionFromGlobalTrackerTest,
+ ModuleCollection) {
+ // Record some module information.
+ GlobalActivityTracker::CreateWithFile(debug_file_path(), kMemorySize, 0ULL,
+ "", 3);
+
+ base::debug::GlobalActivityTracker::ModuleInfo module_info = {};
+ module_info.is_loaded = true;
+ module_info.address = 0x123456;
+ module_info.load_time = 1111LL;
+ module_info.size = 0x2d000;
+ module_info.timestamp = 0xCAFECAFE;
+ module_info.age = 1;
+ crashpad::UUID debug_uuid;
+ debug_uuid.InitializeFromString("11223344-5566-7788-abcd-0123456789ab");
+ memcpy(module_info.identifier, &debug_uuid, sizeof(module_info.identifier));
+ module_info.file = "foo";
+ module_info.debug_file = "bar";
+
+ GlobalActivityTracker::Get()->RecordModuleInfo(module_info);
+
+ // Collect the stability report.
+ PostmortemReportCollector collector(kProductName, kVersionNumber,
+ kChannelName);
+ std::unique_ptr<StabilityReport> report;
+ ASSERT_EQ(PostmortemReportCollector::SUCCESS,
+ collector.Collect(debug_file_path(), &report));
+ ASSERT_NE(nullptr, report);
+
+ // Validate the report's modules content.
+ ASSERT_EQ(1, report->process_states_size());
+ const ProcessState& process_state = report->process_states(0);
+ ASSERT_EQ(1, process_state.modules_size());
+
+ const CodeModule collected_module = process_state.modules(0);
+ EXPECT_EQ(module_info.address,
+ static_cast<uintptr_t>(collected_module.base_address()));
+ EXPECT_EQ(module_info.size, static_cast<size_t>(collected_module.size()));
+ EXPECT_EQ(module_info.file, collected_module.code_file());
+ EXPECT_EQ("CAFECAFE2d000", collected_module.code_identifier());
+ EXPECT_EQ(module_info.debug_file, collected_module.debug_file());
+ EXPECT_EQ("1122334455667788ABCD0123456789AB1",
+ collected_module.debug_identifier());
+ EXPECT_EQ("", collected_module.version());
+ EXPECT_EQ(0LL, collected_module.shrink_down_delta());
+ EXPECT_EQ(!module_info.is_loaded, collected_module.is_unloaded());
+}
+
} // namespace browser_watcher
« no previous file with comments | « components/browser_watcher/postmortem_report_collector.cc ('k') | components/browser_watcher/stability_report.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698