| Index: services/resource_coordinator/memory/coordinator/coordinator_impl_unittest.cc
|
| diff --git a/services/memory_instrumentation/coordinator_impl_unittest.cc b/services/resource_coordinator/memory/coordinator/coordinator_impl_unittest.cc
|
| similarity index 76%
|
| rename from services/memory_instrumentation/coordinator_impl_unittest.cc
|
| rename to services/resource_coordinator/memory/coordinator/coordinator_impl_unittest.cc
|
| index 5b91a2bc983305b332ec3cba0782ae75e5061d9b..1bc8254b90282a01e301422f3c558b2c944cde85 100644
|
| --- a/services/memory_instrumentation/coordinator_impl_unittest.cc
|
| +++ b/services/resource_coordinator/memory/coordinator/coordinator_impl_unittest.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "services/resource_coordinator/memory/coordinator/coordinator_impl.h"
|
| #include "base/bind_helpers.h"
|
| #include "base/callback_forward.h"
|
| #include "base/memory/ref_counted.h"
|
| @@ -10,15 +11,14 @@
|
| #include "base/trace_event/memory_dump_request_args.h"
|
| #include "mojo/public/cpp/bindings/binding.h"
|
| #include "mojo/public/cpp/bindings/interface_request.h"
|
| -#include "services/memory_instrumentation/coordinator_impl.h"
|
| -#include "services/memory_instrumentation/public/interfaces/memory_instrumentation.mojom.h"
|
| +#include "services/resource_coordinator/public/interfaces/memory/memory_instrumentation.mojom.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| namespace memory_instrumentation {
|
|
|
| class CoordinatorImplTest : public testing::Test {
|
| public:
|
| - CoordinatorImplTest() { }
|
| + CoordinatorImplTest() {}
|
| void SetUp() override {
|
| dump_response_args_ = {static_cast<uint64_t>(-1), false};
|
| }
|
| @@ -26,26 +26,24 @@ class CoordinatorImplTest : public testing::Test {
|
| void RegisterProcessLocalDumpManager(
|
| mojom::ProcessLocalDumpManagerPtr process_manager) {
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind(&CoordinatorImpl::RegisterProcessLocalDumpManager,
|
| - base::Unretained(&coordinator_),
|
| - base::Passed(&process_manager)));
|
| + FROM_HERE, base::Bind(&CoordinatorImpl::RegisterProcessLocalDumpManager,
|
| + base::Unretained(&coordinator_),
|
| + base::Passed(&process_manager)));
|
| }
|
|
|
| void RequestGlobalMemoryDump(base::trace_event::MemoryDumpRequestArgs args,
|
| base::Closure closure) {
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| FROM_HERE,
|
| - base::Bind(
|
| - &CoordinatorImpl::RequestGlobalMemoryDump,
|
| - base::Unretained(&coordinator_),
|
| - args,
|
| - base::Bind(&CoordinatorImplTest::OnGlobalMemoryDumpResponse,
|
| - base::Unretained(this), closure)));
|
| + base::Bind(&CoordinatorImpl::RequestGlobalMemoryDump,
|
| + base::Unretained(&coordinator_), args,
|
| + base::Bind(&CoordinatorImplTest::OnGlobalMemoryDumpResponse,
|
| + base::Unretained(this), closure)));
|
| }
|
|
|
| void OnGlobalMemoryDumpResponse(base::Closure closure,
|
| - uint64_t dump_guid, bool success) {
|
| + uint64_t dump_guid,
|
| + bool success) {
|
| dump_response_args_ = {dump_guid, success};
|
| closure.Run();
|
| }
|
| @@ -74,9 +72,7 @@ class MockDumpManager : mojom::ProcessLocalDumpManager {
|
| std::move(process_manager));
|
| }
|
|
|
| - ~MockDumpManager() override {
|
| - EXPECT_EQ(0, expected_calls_);
|
| - }
|
| + ~MockDumpManager() override { EXPECT_EQ(0, expected_calls_); }
|
|
|
| void RequestProcessMemoryDump(
|
| const base::trace_event::MemoryDumpRequestArgs& args,
|
| @@ -93,8 +89,7 @@ class MockDumpManager : mojom::ProcessLocalDumpManager {
|
| TEST_F(CoordinatorImplTest, NoProcessLocalManagers) {
|
| base::RunLoop run_loop;
|
| base::trace_event::MemoryDumpRequestArgs args = {
|
| - 1234,
|
| - base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
|
| + 1234, base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
|
| base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
|
| RequestGlobalMemoryDump(args, run_loop.QuitClosure());
|
| run_loop.Run();
|
| @@ -108,8 +103,7 @@ TEST_F(CoordinatorImplTest, SeveralProcessLocalManagers) {
|
| MockDumpManager dump_manager_1(this, 1);
|
| MockDumpManager dump_manager_2(this, 1);
|
| base::trace_event::MemoryDumpRequestArgs args = {
|
| - 2345,
|
| - base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
|
| + 2345, base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
|
| base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
|
| RequestGlobalMemoryDump(args, run_loop.QuitClosure());
|
|
|
| @@ -125,8 +119,7 @@ TEST_F(CoordinatorImplTest, FaultyProcessLocalManager) {
|
| MockDumpManager dump_manager_1(this, 1);
|
| std::unique_ptr<MockDumpManager> dump_manager_2(new MockDumpManager(this, 0));
|
| base::trace_event::MemoryDumpRequestArgs args = {
|
| - 3456,
|
| - base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
|
| + 3456, base::trace_event::MemoryDumpType::EXPLICITLY_TRIGGERED,
|
| base::trace_event::MemoryDumpLevelOfDetail::DETAILED};
|
| RequestGlobalMemoryDump(args, run_loop.QuitClosure());
|
| // One of the process-local managers dies after a global dump is requested and
|
| @@ -134,9 +127,8 @@ TEST_F(CoordinatorImplTest, FaultyProcessLocalManager) {
|
| // should detect that one of its clients is disconnected and claim the global
|
| // dump attempt has failed.
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| - FROM_HERE,
|
| - base::Bind([](std::unique_ptr<MockDumpManager> dm) { },
|
| - base::Passed(&dump_manager_2)));
|
| + FROM_HERE, base::Bind([](std::unique_ptr<MockDumpManager> dm) {},
|
| + base::Passed(&dump_manager_2)));
|
|
|
| run_loop.Run();
|
|
|
|
|