Chromium Code Reviews| 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 "content/child/web_process_memory_dump_impl.h" | 5 #include "platform/WebProcessMemoryDumpImpl.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 "content/child/web_memory_allocator_dump_impl.h" | 11 #include "platform/WebMemoryAllocatorDumpImpl.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace blink { |
| 15 | 15 |
| 16 // Tests that the Chromium<>Blink plumbing that exposes the MemoryInfra classes | 16 // Tests that the Chromium<>Blink plumbing that exposes the MemoryInfra classes |
| 17 // behaves correctly, performs the right transfers of memory ownerships and | 17 // behaves correctly, performs the right transfers of memory ownerships and |
| 18 // doesn't leak objects. | 18 // doesn't leak objects. |
| 19 TEST(WebProcessMemoryDumpImplTest, IntegrationTest) { | 19 TEST(WebProcessMemoryDumpImplTest, IntegrationTest) { |
| 20 scoped_refptr<base::trace_event::TracedValue> traced_value( | 20 scoped_refptr<base::trace_event::TracedValue> traced_value( |
|
hajimehoshi
2016/02/05 11:38:38
Ooooh, we can't use scoped_refptr in Blink, but wh
| |
| 21 new base::trace_event::TracedValue()); | 21 new base::trace_event::TracedValue()); |
| 22 | 22 |
| 23 scoped_ptr<WebProcessMemoryDumpImpl> wpmd1(new WebProcessMemoryDumpImpl()); | 23 scoped_ptr<WebProcessMemoryDumpImpl> wpmd1(new WebProcessMemoryDumpImpl()); |
| 24 auto wmad1 = wpmd1->createMemoryAllocatorDump("1/1"); | 24 auto wmad1 = wpmd1->createMemoryAllocatorDump("1/1"); |
| 25 auto wmad2 = wpmd1->createMemoryAllocatorDump("1/2"); | 25 auto wmad2 = wpmd1->createMemoryAllocatorDump("1/2"); |
| 26 ASSERT_EQ(wmad1, wpmd1->getMemoryAllocatorDump("1/1")); | 26 ASSERT_EQ(wmad1, wpmd1->getMemoryAllocatorDump("1/1")); |
| 27 ASSERT_EQ(wmad2, wpmd1->getMemoryAllocatorDump("1/2")); | 27 ASSERT_EQ(wmad2, wpmd1->getMemoryAllocatorDump("1/2")); |
| 28 | 28 |
| 29 scoped_ptr<WebProcessMemoryDumpImpl> wpmd2(new WebProcessMemoryDumpImpl()); | 29 scoped_ptr<WebProcessMemoryDumpImpl> wpmd2(new WebProcessMemoryDumpImpl()); |
| 30 wpmd2->createMemoryAllocatorDump("2/1"); | 30 wpmd2->createMemoryAllocatorDump("2/1"); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 wpmd1->addOwnershipEdge(wmad4->guid(), guid); | 114 wpmd1->addOwnershipEdge(wmad4->guid(), guid); |
| 115 auto allocator_dumps_edges = | 115 auto allocator_dumps_edges = |
| 116 wpmd1->process_memory_dump()->allocator_dumps_edges(); | 116 wpmd1->process_memory_dump()->allocator_dumps_edges(); |
| 117 ASSERT_EQ(1u, allocator_dumps_edges.size()); | 117 ASSERT_EQ(1u, allocator_dumps_edges.size()); |
| 118 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64()); | 118 ASSERT_EQ(wmad4->guid(), allocator_dumps_edges[0].source.ToUint64()); |
| 119 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64()); | 119 ASSERT_EQ(guid, allocator_dumps_edges[0].target.ToUint64()); |
| 120 | 120 |
| 121 wpmd1.reset(); | 121 wpmd1.reset(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace content | 124 } // namespace blink |
| OLD | NEW |