| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/resource_coordinator/public/cpp/memory/process_local_dump_man
ager_impl.h" | 5 #include "services/resource_coordinator/public/cpp/memory/process_local_dump_man
ager_impl.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/trace_event/memory_dump_manager.h" | 10 #include "base/trace_event/memory_dump_manager.h" |
| 11 #include "base/trace_event/memory_dump_request_args.h" | 11 #include "base/trace_event/memory_dump_request_args.h" |
| 12 #include "base/trace_event/trace_config.h" | 12 #include "base/trace_event/trace_config.h" |
| 13 #include "base/trace_event/trace_log.h" | 13 #include "base/trace_event/trace_log.h" |
| 14 #include "mojo/public/cpp/bindings/binding_set.h" | 14 #include "mojo/public/cpp/bindings/binding_set.h" |
| 15 #include "services/resource_coordinator/public/cpp/memory/coordinator.h" | 15 #include "services/resource_coordinator/public/cpp/memory/coordinator.h" |
| 16 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume
ntation.mojom.h" | 16 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume
ntation.mojom.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 using base::trace_event::MemoryDumpLevelOfDetail; | 19 using base::trace_event::MemoryDumpLevelOfDetail; |
| 20 using base::trace_event::MemoryDumpManager; | 20 using base::trace_event::MemoryDumpManager; |
| 21 using base::trace_event::MemoryDumpType; | 21 using base::trace_event::MemoryDumpType; |
| 22 | 22 |
| 23 namespace memory_instrumentation { | 23 namespace memory_instrumentation { |
| 24 | 24 |
| 25 class MockCoordinator : public Coordinator, public mojom::Coordinator { | 25 class MockCoordinator : public Coordinator, public mojom::Coordinator { |
| 26 public: | 26 public: |
| 27 void BindCoordinatorRequest(mojom::CoordinatorRequest request) override { | 27 void BindCoordinatorRequest( |
| 28 const service_manager::BindSourceInfo& source_info, |
| 29 mojom::CoordinatorRequest request) override { |
| 28 bindings_.AddBinding(this, std::move(request)); | 30 bindings_.AddBinding(this, std::move(request)); |
| 29 } | 31 } |
| 30 | 32 |
| 31 void RegisterProcessLocalDumpManager( | 33 void RegisterProcessLocalDumpManager( |
| 32 mojom::ProcessLocalDumpManagerPtr process_manager) override {} | 34 mojom::ProcessLocalDumpManagerPtr process_manager) override {} |
| 33 | 35 |
| 34 void RequestGlobalMemoryDump( | 36 void RequestGlobalMemoryDump( |
| 35 const base::trace_event::MemoryDumpRequestArgs& args, | 37 const base::trace_event::MemoryDumpRequestArgs& args, |
| 36 const RequestGlobalMemoryDumpCallback& callback) override { | 38 const RequestGlobalMemoryDumpCallback& callback) override { |
| 37 callback.Run(args.dump_guid, true); | 39 callback.Run(args.dump_guid, true); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 expected_callback_calls_ = 3; | 129 expected_callback_calls_ = 3; |
| 128 quit_closure_ = run_loop.QuitClosure(); | 130 quit_closure_ = run_loop.QuitClosure(); |
| 129 SequentiallyRequestGlobalDumps(1); | 131 SequentiallyRequestGlobalDumps(1); |
| 130 SequentiallyRequestGlobalDumps(1); | 132 SequentiallyRequestGlobalDumps(1); |
| 131 SequentiallyRequestGlobalDumps(1); | 133 SequentiallyRequestGlobalDumps(1); |
| 132 run_loop.Run(); | 134 run_loop.Run(); |
| 133 EXPECT_EQ(1, dump_requests_received_by_coordinator_); | 135 EXPECT_EQ(1, dump_requests_received_by_coordinator_); |
| 134 } | 136 } |
| 135 | 137 |
| 136 } // namespace memory_instrumentation | 138 } // namespace memory_instrumentation |
| OLD | NEW |