| OLD | NEW |
| 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 "content/child/web_process_memory_dump_impl.h" |
| 6 | 6 |
| 7 #include "base/trace_event/memory_allocator_dump.h" | 7 #include "base/trace_event/memory_allocator_dump.h" |
| 8 #include "base/trace_event/process_memory_dump.h" | 8 #include "base/trace_event/process_memory_dump.h" |
| 9 #include "base/trace_event/trace_event_argument.h" | 9 #include "base/trace_event/trace_event_argument.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "platform/web_memory_allocator_dump_impl.h" | 11 #include "content/child/web_memory_allocator_dump_impl.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "wtf/OwnPtr.h" | |
| 14 | 13 |
| 15 namespace blink { | 14 namespace content { |
| 16 | 15 |
| 17 // Tests that the Chromium<>Blink plumbing that exposes the MemoryInfra classes | 16 // Tests that the Chromium<>Blink plumbing that exposes the MemoryInfra classes |
| 18 // behaves correctly, performs the right transfers of memory ownerships and | 17 // behaves correctly, performs the right transfers of memory ownerships and |
| 19 // doesn't leak objects. | 18 // doesn't leak objects. |
| 20 TEST(WebProcessMemoryDumpImplTest, IntegrationTest) { | 19 TEST(WebProcessMemoryDumpImplTest, IntegrationTest) { |
| 21 scoped_refptr<base::trace_event::TracedValue> traced_value( | 20 scoped_refptr<base::trace_event::TracedValue> traced_value( |
| 22 new base::trace_event::TracedValue()); | 21 new base::trace_event::TracedValue()); |
| 23 | 22 |
| 24 scoped_ptr<WebProcessMemoryDumpImpl> wpmd1(new WebProcessMemoryDumpImpl()); | 23 scoped_ptr<WebProcessMemoryDumpImpl> wpmd1(new WebProcessMemoryDumpImpl()); |
| 25 auto wmad1 = wpmd1->createMemoryAllocatorDump("1/1"); | 24 auto wmad1 = wpmd1->createMemoryAllocatorDump("1/1"); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 wpmd1->addOwnershipEdge(wmad4->guid(), guid); | 114 wpmd1->addOwnershipEdge(wmad4->guid(), guid); |
| 116 auto allocator_dumps_edges = | 115 auto allocator_dumps_edges = |
| 117 wpmd1->process_memory_dump()->allocator_dumps_edges(); | 116 wpmd1->process_memory_dump()->allocator_dumps_edges(); |
| 118 ASSERT_EQ(1u, allocator_dumps_edges.size()); | 117 ASSERT_EQ(1u, allocator_dumps_edges.size()); |
| 119 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64()); | 118 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64()); |
| 120 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64()); | 119 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64()); |
| 121 | 120 |
| 122 wpmd1.reset(); | 121 wpmd1.reset(); |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace blink | 124 } // namespace content |
| OLD | NEW |