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

Unified Diff: base/trace_event/memory_dump_manager_unittest.cc

Issue 2876543002: memory-infra: Don't invoke all dump providers in SUMMARY_ONLY mode (Closed)
Patch Set: fix comment Created 3 years, 7 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: base/trace_event/memory_dump_manager_unittest.cc
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc
index c1e9befc5e3e0d8e6a5896d0d8617163bb9840e5..ef9b84cabf7f197b1db5e69eabfa65d23db58202 100644
--- a/base/trace_event/memory_dump_manager_unittest.cc
+++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -64,6 +64,8 @@ namespace {
const char* kMDPName = "TestDumpProvider";
const char* kWhitelistedMDPName = "WhitelistedTestDumpProvider";
const char* const kTestMDPWhitelist[] = {kWhitelistedMDPName, nullptr};
+const char* const kTestMDPWhitelistForSummary[] = {kWhitelistedMDPName,
+ nullptr};
void RegisterDumpProvider(
MemoryDumpProvider* mdp,
@@ -1081,10 +1083,27 @@ TEST_F(MemoryDumpManagerTest, DumpOnBehalfOfOtherProcess) {
ASSERT_EQ(events[0]->id, events[2]->id);
}
+TEST_F(MemoryDumpManagerTest, TestSummaryWhitelisting) {
Primiano Tucci (use gerrit) 2017/05/10 16:18:58 s/TestSummaryWhitelisting/SummaryOnlyWhitelisting/
hjd 2017/05/15 12:02:27 Done.
+ InitializeMemoryDumpManager(false /* is_coordinator */);
+ SetDumpProviderWhitelistForTesting(kTestMDPWhitelist);
+
+ // Standard provider with default options (create dump for current process).
+ MockMemoryDumpProvider mdp;
+ RegisterDumpProvider(&mdp, nullptr, kDefaultOptions, kWhitelistedMDPName);
+
+ EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory);
+ EXPECT_CALL(global_dump_handler_, RequestGlobalMemoryDump(_, _)).Times(1);
+ EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(0);
+ RequestGlobalDumpAndWait(MemoryDumpType::SUMMARY_ONLY,
+ MemoryDumpLevelOfDetail::BACKGROUND);
+ DisableTracing();
+}
+
TEST_F(MemoryDumpManagerTest, SummaryOnlyDumpsArentAddedToTrace) {
using trace_analyzer::Query;
InitializeMemoryDumpManager(false /* is_coordinator */);
+ SetDumpProviderSummaryWhitelistForTesting(kTestMDPWhitelistForSummary);
SetDumpProviderWhitelistForTesting(kTestMDPWhitelist);
// Standard provider with default options (create dump for current process).

Powered by Google App Engine
This is Rietveld 408576698