| 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/trace_event/memory_dump_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 class MemoryDumpManagerTest : public testing::Test { | 96 class MemoryDumpManagerTest : public testing::Test { |
| 97 public: | 97 public: |
| 98 MemoryDumpManagerTest() : testing::Test(), kDefaultOptions() {} | 98 MemoryDumpManagerTest() : testing::Test(), kDefaultOptions() {} |
| 99 | 99 |
| 100 void SetUp() override { | 100 void SetUp() override { |
| 101 last_callback_success_ = false; | 101 last_callback_success_ = false; |
| 102 message_loop_.reset(new MessageLoop()); | 102 message_loop_.reset(new MessageLoop()); |
| 103 mdm_.reset(new MemoryDumpManager()); | 103 mdm_.reset(new MemoryDumpManager()); |
| 104 MemoryDumpManager::SetInstanceForTesting(mdm_.get()); | 104 MemoryDumpManager::SetInstanceForTesting(mdm_.get()); |
| 105 ASSERT_EQ(mdm_, MemoryDumpManager::GetInstance()); | 105 ASSERT_EQ(mdm_.get(), MemoryDumpManager::GetInstance()); |
| 106 delegate_.reset(new MemoryDumpManagerDelegateForTesting); | 106 delegate_.reset(new MemoryDumpManagerDelegateForTesting); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void TearDown() override { | 109 void TearDown() override { |
| 110 MemoryDumpManager::SetInstanceForTesting(nullptr); | 110 MemoryDumpManager::SetInstanceForTesting(nullptr); |
| 111 mdm_.reset(); | 111 mdm_.reset(); |
| 112 delegate_.reset(); | 112 delegate_.reset(); |
| 113 message_loop_.reset(); | 113 message_loop_.reset(); |
| 114 TraceLog::DeleteForTesting(); | 114 TraceLog::DeleteForTesting(); |
| 115 } | 115 } |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 ASSERT_EQ(1u, trace_analyzer::CountMatches(events, Query::EventPidIs(123))); | 818 ASSERT_EQ(1u, trace_analyzer::CountMatches(events, Query::EventPidIs(123))); |
| 819 ASSERT_EQ(1u, trace_analyzer::CountMatches(events, Query::EventPidIs(456))); | 819 ASSERT_EQ(1u, trace_analyzer::CountMatches(events, Query::EventPidIs(456))); |
| 820 ASSERT_EQ(1u, trace_analyzer::CountMatches( | 820 ASSERT_EQ(1u, trace_analyzer::CountMatches( |
| 821 events, Query::EventPidIs(GetCurrentProcId()))); | 821 events, Query::EventPidIs(GetCurrentProcId()))); |
| 822 ASSERT_EQ(events[0]->id, events[1]->id); | 822 ASSERT_EQ(events[0]->id, events[1]->id); |
| 823 ASSERT_EQ(events[0]->id, events[2]->id); | 823 ASSERT_EQ(events[0]->id, events[2]->id); |
| 824 } | 824 } |
| 825 | 825 |
| 826 } // namespace trace_event | 826 } // namespace trace_event |
| 827 } // namespace base | 827 } // namespace base |
| OLD | NEW |