| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 mock_dump_provider_.reset(new MockDumpProvider()); | 97 mock_dump_provider_.reset(new MockDumpProvider()); |
| 98 MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 98 MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
| 99 mock_dump_provider_.get(), "MockDumpProvider", nullptr); | 99 mock_dump_provider_.get(), "MockDumpProvider", nullptr); |
| 100 MemoryDumpManager::GetInstance() | 100 MemoryDumpManager::GetInstance() |
| 101 ->set_dumper_registrations_ignored_for_testing(false); | 101 ->set_dumper_registrations_ignored_for_testing(false); |
| 102 ContentBrowserTest::SetUp(); | 102 ContentBrowserTest::SetUp(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void TearDown() override { | 105 void TearDown() override { |
| 106 MemoryDumpManager::GetInstance()->UnregisterDumpProvider( | 106 MemoryDumpManager::GetInstance()->UnregisterAndDeleteDumpProviderSoon( |
| 107 mock_dump_provider_.get()); | 107 std::move(mock_dump_provider_)); |
| 108 mock_dump_provider_.reset(); | 108 mock_dump_provider_.reset(); |
| 109 ContentBrowserTest::TearDown(); | 109 ContentBrowserTest::TearDown(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void EnableMemoryTracing() { | 112 void EnableMemoryTracing() { |
| 113 // Re-enabling tracing could crash these tests https://crbug.com/657628 . | 113 // Re-enabling tracing could crash these tests https://crbug.com/657628 . |
| 114 if (base::trace_event::TraceLog::GetInstance()->IsEnabled()) { | 114 if (base::trace_event::TraceLog::GetInstance()->IsEnabled()) { |
| 115 FAIL() << "Tracing seems to be already enabled. " | 115 FAIL() << "Tracing seems to be already enabled. " |
| 116 "Very likely this is because the startup tracing file " | 116 "Very likely this is because the startup tracing file " |
| 117 "has been leaked from a previous test."; | 117 "has been leaked from a previous test."; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 EXPECT_CALL(*this, OnMemoryDumpDone(_, true /* success */)); | 316 EXPECT_CALL(*this, OnMemoryDumpDone(_, true /* success */)); |
| 317 | 317 |
| 318 EnableMemoryTracing(); | 318 EnableMemoryTracing(); |
| 319 RequestGlobalDumpAndWait(false /* from_renderer_thread */, | 319 RequestGlobalDumpAndWait(false /* from_renderer_thread */, |
| 320 MemoryDumpType::EXPLICITLY_TRIGGERED, | 320 MemoryDumpType::EXPLICITLY_TRIGGERED, |
| 321 MemoryDumpLevelOfDetail::DETAILED); | 321 MemoryDumpLevelOfDetail::DETAILED); |
| 322 DisableTracing(); | 322 DisableTracing(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace content | 325 } // namespace content |
| OLD | NEW |