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

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

Issue 1337943003: [tracing] Non-functional refactor of memory dump arg names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows test Created 5 years, 3 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/memory_allocator_dump.h" 5 #include "base/trace_event/memory_allocator_dump.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/memory_allocator_dump_guid.h" 9 #include "base/trace_event/memory_allocator_dump_guid.h"
10 #include "base/trace_event/memory_dump_provider.h" 10 #include "base/trace_event/memory_dump_provider.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 ASSERT_EQ(guid_bar, guid_bar_2); 119 ASSERT_EQ(guid_bar, guid_bar_2);
120 120
121 mad.reset(new MemoryAllocatorDump("baz", nullptr)); 121 mad.reset(new MemoryAllocatorDump("baz", nullptr));
122 const MemoryAllocatorDumpGuid guid_baz = mad->guid(); 122 const MemoryAllocatorDumpGuid guid_baz = mad->guid();
123 ASSERT_NE(guid_bar, guid_baz); 123 ASSERT_NE(guid_bar, guid_baz);
124 } 124 }
125 125
126 TEST(MemoryAllocatorDumpTest, DumpIntoProcessMemoryDump) { 126 TEST(MemoryAllocatorDumpTest, DumpIntoProcessMemoryDump) {
127 FakeMemoryAllocatorDumpProvider fmadp; 127 FakeMemoryAllocatorDumpProvider fmadp;
128 ProcessMemoryDump pmd(make_scoped_refptr(new MemoryDumpSessionState())); 128 ProcessMemoryDump pmd(make_scoped_refptr(new MemoryDumpSessionState()));
129 MemoryDumpArgs dump_args = {MemoryDumpArgs::LevelOfDetail::HIGH}; 129 MemoryDumpArgs dump_args = {MemoryDumpLevelOfDetail::DETAILED};
130 130
131 fmadp.OnMemoryDump(dump_args, &pmd); 131 fmadp.OnMemoryDump(dump_args, &pmd);
132 132
133 ASSERT_EQ(3u, pmd.allocator_dumps().size()); 133 ASSERT_EQ(3u, pmd.allocator_dumps().size());
134 134
135 const MemoryAllocatorDump* root_heap = 135 const MemoryAllocatorDump* root_heap =
136 pmd.GetAllocatorDump("foobar_allocator"); 136 pmd.GetAllocatorDump("foobar_allocator");
137 ASSERT_NE(nullptr, root_heap); 137 ASSERT_NE(nullptr, root_heap);
138 EXPECT_EQ("foobar_allocator", root_heap->absolute_name()); 138 EXPECT_EQ("foobar_allocator", root_heap->absolute_name());
139 CheckScalar(root_heap, MemoryAllocatorDump::kNameSize, 139 CheckScalar(root_heap, MemoryAllocatorDump::kNameSize,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 pmd.CreateAllocatorDump("foo_allocator"); 176 pmd.CreateAllocatorDump("foo_allocator");
177 pmd.CreateAllocatorDump("bar_allocator/heap"); 177 pmd.CreateAllocatorDump("bar_allocator/heap");
178 ASSERT_DEATH(pmd.CreateAllocatorDump("foo_allocator"), ""); 178 ASSERT_DEATH(pmd.CreateAllocatorDump("foo_allocator"), "");
179 ASSERT_DEATH(pmd.CreateAllocatorDump("bar_allocator/heap"), ""); 179 ASSERT_DEATH(pmd.CreateAllocatorDump("bar_allocator/heap"), "");
180 ASSERT_DEATH(pmd.CreateAllocatorDump(""), ""); 180 ASSERT_DEATH(pmd.CreateAllocatorDump(""), "");
181 } 181 }
182 #endif 182 #endif
183 183
184 } // namespace trace_event 184 } // namespace trace_event
185 } // namespace base 185 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/java_heap_dump_provider_android_unittest.cc ('k') | base/trace_event/memory_dump_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698