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

Side by Side Diff: third_party/WebKit/Source/platform/web_process_memory_dump_impl_test.cc

Issue 1738463004: Improve test coveage of WebProcessMemoryDumpImplTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bashi's review Created 4 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/platform/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "platform/web_process_memory_dump_impl.h" 5 #include "platform/web_process_memory_dump_impl.h"
6 6
7 #include "base/memory/discardable_memory.h"
8 #include "base/test/test_discardable_memory_allocator.h"
7 #include "base/trace_event/memory_allocator_dump.h" 9 #include "base/trace_event/memory_allocator_dump.h"
8 #include "base/trace_event/process_memory_dump.h" 10 #include "base/trace_event/process_memory_dump.h"
9 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "platform/web_memory_allocator_dump_impl.h" 13 #include "platform/web_memory_allocator_dump_impl.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 #include "wtf/OwnPtr.h" 15 #include "wtf/OwnPtr.h"
14 16
15 namespace blink { 17 namespace blink {
16 18
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 114
113 // Check that AddOwnershipEdge is propagated correctly. 115 // Check that AddOwnershipEdge is propagated correctly.
114 auto wmad4 = wpmd1->createMemoryAllocatorDump("1/4"); 116 auto wmad4 = wpmd1->createMemoryAllocatorDump("1/4");
115 wpmd1->addOwnershipEdge(wmad4->guid(), guid); 117 wpmd1->addOwnershipEdge(wmad4->guid(), guid);
116 auto allocator_dumps_edges = 118 auto allocator_dumps_edges =
117 wpmd1->process_memory_dump()->allocator_dumps_edges(); 119 wpmd1->process_memory_dump()->allocator_dumps_edges();
118 ASSERT_EQ(1u, allocator_dumps_edges.size()); 120 ASSERT_EQ(1u, allocator_dumps_edges.size());
119 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64()); 121 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64());
120 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64()); 122 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64());
121 123
124 // Check that createDumpAdapterForSkia() works.
125 auto skia_trace_memory_dump = wpmd1->createDumpAdapterForSkia("1/skia");
126 ASSERT_NE(nullptr, skia_trace_memory_dump);
Primiano Tucci (use gerrit) 2016/02/29 16:15:28 IIRC the ASSERT_NE incantation fails to expand pro
hajimehoshi 2016/03/01 10:06:23 Done. (Used ASSERT_TRUE)
127
128 // Check that createDiscardableMemoryAllocatorDump() works.
129 base::TestDiscardableMemoryAllocator discardable_memory_allocator;
130 auto discardable_memory =
131 discardable_memory_allocator.AllocateLockedDiscardableMemory(1024);
132 wpmd1->createDiscardableMemoryAllocatorDump("1/discardable",
133 discardable_memory.get());
134 discardable_memory->Unlock();
135
122 wpmd1.reset(); 136 wpmd1.reset();
123 } 137 }
124 138
125 } // namespace blink 139 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698