| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "base/trace_event/memory_dump_manager.h" | 9 #include "base/trace_event/memory_dump_manager.h" |
| 10 #include "base/trace_event/memory_dump_provider.h" | 10 #include "base/trace_event/memory_dump_provider.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 last_callback_dump_guid_ = dump_guid; | 61 last_callback_dump_guid_ = dump_guid; |
| 62 last_callback_success_ = success; | 62 last_callback_success_ = success; |
| 63 closure.Run(); | 63 closure.Run(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 void SetUp() override { | 67 void SetUp() override { |
| 68 callback_call_count_ = 0; | 68 callback_call_count_ = 0; |
| 69 last_callback_dump_guid_ = 0; | 69 last_callback_dump_guid_ = 0; |
| 70 last_callback_success_ = false; | 70 last_callback_success_ = false; |
| 71 MemoryDumpManager::GetInstance()->Initialize(); | |
| 72 mock_dump_provider_.reset(new MockDumpProvider()); | 71 mock_dump_provider_.reset(new MockDumpProvider()); |
| 73 MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 72 MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 74 mock_dump_provider_.get()); | 73 mock_dump_provider_.get()); |
| 74 MemoryDumpManager::GetInstance()->set_ignore_registrations_for_testing( |
| 75 true); |
| 76 MemoryDumpManager::GetInstance()->Initialize(); |
| 75 // TODO(primiano): This should be done via TraceConfig. | 77 // TODO(primiano): This should be done via TraceConfig. |
| 76 // See https://goo.gl/5Hj3o0. | 78 // See https://goo.gl/5Hj3o0. |
| 77 MemoryDumpManager::GetInstance()->DisablePeriodicDumpsForTesting(); | 79 MemoryDumpManager::GetInstance()->DisablePeriodicDumpsForTesting(); |
| 78 ContentBrowserTest::SetUp(); | 80 ContentBrowserTest::SetUp(); |
| 79 } | 81 } |
| 80 | 82 |
| 81 void TearDown() override { | 83 void TearDown() override { |
| 82 MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 84 MemoryDumpManager::GetInstance()->UnregisterDumpProvider( |
| 83 mock_dump_provider_.get()); | 85 mock_dump_provider_.get()); |
| 84 mock_dump_provider_.reset(); | 86 mock_dump_provider_.reset(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 208 |
| 207 EnableMemoryTracing(); | 209 EnableMemoryTracing(); |
| 208 RequestGlobalDumpAndWait(false /* from_renderer_thread */); | 210 RequestGlobalDumpAndWait(false /* from_renderer_thread */); |
| 209 EXPECT_EQ(1u, callback_call_count_); | 211 EXPECT_EQ(1u, callback_call_count_); |
| 210 EXPECT_NE(0u, last_callback_dump_guid_); | 212 EXPECT_NE(0u, last_callback_dump_guid_); |
| 211 EXPECT_TRUE(last_callback_success_); | 213 EXPECT_TRUE(last_callback_success_); |
| 212 DisableTracing(); | 214 DisableTracing(); |
| 213 } | 215 } |
| 214 | 216 |
| 215 } // namespace content | 217 } // namespace content |
| OLD | NEW |