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

Side by Side Diff: base/trace_event/process_memory_dump_unittest.cc

Issue 2012883003: [tracing] Set whitelist values for dump provider supporting background mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@background_dump_names
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/trace_event/process_memory_dump.h" 5 #include "base/trace_event/process_memory_dump.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/aligned_memory.h" 9 #include "base/memory/aligned_memory.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // Suballocations. 263 // Suballocations.
264 pmd->AddSuballocation(guid, "malloc/allocated_objects"); 264 pmd->AddSuballocation(guid, "malloc/allocated_objects");
265 EXPECT_EQ(0u, pmd->allocator_dumps_edges_.size()); 265 EXPECT_EQ(0u, pmd->allocator_dumps_edges_.size());
266 EXPECT_EQ(0u, pmd->allocator_dumps_.size()); 266 EXPECT_EQ(0u, pmd->allocator_dumps_.size());
267 267
268 // Valid dump names. 268 // Valid dump names.
269 EXPECT_NE(black_hole_mad, pmd->CreateAllocatorDump("Whitelisted/TestName")); 269 EXPECT_NE(black_hole_mad, pmd->CreateAllocatorDump("Whitelisted/TestName"));
270 EXPECT_NE(black_hole_mad, 270 EXPECT_NE(black_hole_mad,
271 pmd->CreateAllocatorDump("Whitelisted/TestName0xA1b2")); 271 pmd->CreateAllocatorDump("Whitelisted/TestName0xA1b2"));
272 EXPECT_NE(black_hole_mad, 272 EXPECT_NE(black_hole_mad,
273 pmd->CreateAllocatorDump("Whitelisted/TestName_123")); 273 pmd->CreateAllocatorDump("Whitelisted/TestName123"));
274 EXPECT_NE(black_hole_mad, 274 EXPECT_NE(black_hole_mad,
275 pmd->CreateAllocatorDump("Whitelisted_12/0xaB/TestName")); 275 pmd->CreateAllocatorDump("Whitelisted12/0xaB/TestName"));
276 276
277 // GetAllocatorDump is consistent. 277 // GetAllocatorDump is consistent.
278 EXPECT_EQ(black_hole_mad, pmd->GetAllocatorDump("NotWhitelisted/TestName")); 278 EXPECT_EQ(black_hole_mad, pmd->GetAllocatorDump("NotWhitelisted/TestName"));
279 EXPECT_NE(black_hole_mad, pmd->GetAllocatorDump("Whitelisted/TestName")); 279 EXPECT_NE(black_hole_mad, pmd->GetAllocatorDump("Whitelisted/TestName"));
280 } 280 }
281 281
282 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED) 282 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
283 TEST(ProcessMemoryDumpTest, CountResidentBytes) { 283 TEST(ProcessMemoryDumpTest, CountResidentBytes) {
284 const size_t page_size = ProcessMemoryDump::GetSystemPageSize(); 284 const size_t page_size = ProcessMemoryDump::GetSystemPageSize();
285 285
(...skipping 11 matching lines...) Expand all
297 static_cast<char*>(base::AlignedAlloc(kVeryLargeMemorySize, page_size))); 297 static_cast<char*>(base::AlignedAlloc(kVeryLargeMemorySize, page_size)));
298 memset(memory2.get(), 0, kVeryLargeMemorySize); 298 memset(memory2.get(), 0, kVeryLargeMemorySize);
299 size_t res2 = ProcessMemoryDump::CountResidentBytes(memory2.get(), 299 size_t res2 = ProcessMemoryDump::CountResidentBytes(memory2.get(),
300 kVeryLargeMemorySize); 300 kVeryLargeMemorySize);
301 ASSERT_EQ(res2, kVeryLargeMemorySize); 301 ASSERT_EQ(res2, kVeryLargeMemorySize);
302 } 302 }
303 #endif // defined(COUNT_RESIDENT_BYTES_SUPPORTED) 303 #endif // defined(COUNT_RESIDENT_BYTES_SUPPORTED)
304 304
305 } // namespace trace_event 305 } // namespace trace_event
306 } // namespace base 306 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698