Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: services/resource_coordinator/memory/coordinator/coordinator_impl_unittest.cc

Issue 2883693002: [Memory-UMA] Implement basic working prototype. (Closed)
Patch Set: Fix test. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/coordinator/coordinator_impl.h" 5 #include "services/resource_coordinator/memory/coordinator/coordinator_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/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/trace_event/memory_dump_request_args.h" 12 #include "base/trace_event/memory_dump_request_args.h"
13 #include "mojo/public/cpp/bindings/binding.h" 13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "mojo/public/cpp/bindings/interface_request.h" 14 #include "mojo/public/cpp/bindings/interface_request.h"
15 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h" 15 #include "services/resource_coordinator/public/interfaces/memory/memory_instrume ntation.mojom.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace memory_instrumentation { 18 namespace memory_instrumentation {
19 19
20 class CoordinatorImplFake : public CoordinatorImpl {
21 public:
22 CoordinatorImplFake() : CoordinatorImpl(false, nullptr) {}
23 ~CoordinatorImplFake() override {}
24 service_manager::Identity GetDispatchContext() const override {
25 return service_manager::Identity();
26 }
27 };
28
20 class CoordinatorImplTest : public testing::Test { 29 class CoordinatorImplTest : public testing::Test {
21 public: 30 public:
22 CoordinatorImplTest() {} 31 CoordinatorImplTest() {}
23 void SetUp() override { 32 void SetUp() override {
24 dump_response_args_ = {0U, false}; 33 dump_response_args_ = {0U, false};
25 coordinator_.reset(new CoordinatorImpl(false)); 34 coordinator_.reset(new CoordinatorImplFake);
26 } 35 }
27 36
28 void TearDown() override { coordinator_.reset(); } 37 void TearDown() override { coordinator_.reset(); }
29 38
30 void RegisterProcessLocalDumpManager( 39 void RegisterProcessLocalDumpManager(
31 mojom::ProcessLocalDumpManagerPtr process_manager) { 40 mojom::ProcessLocalDumpManagerPtr process_manager) {
32 base::ThreadTaskRunnerHandle::Get()->PostTask( 41 base::ThreadTaskRunnerHandle::Get()->PostTask(
33 FROM_HERE, base::Bind(&CoordinatorImpl::RegisterProcessLocalDumpManager, 42 FROM_HERE, base::Bind(&CoordinatorImpl::RegisterProcessLocalDumpManager,
34 base::Unretained(coordinator_.get()), 43 base::Unretained(coordinator_.get()),
35 base::Passed(&process_manager))); 44 base::Passed(&process_manager)));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 base::ThreadTaskRunnerHandle::Get()->PostTask( 143 base::ThreadTaskRunnerHandle::Get()->PostTask(
135 FROM_HERE, base::Bind([](std::unique_ptr<MockDumpManager> dm) {}, 144 FROM_HERE, base::Bind([](std::unique_ptr<MockDumpManager> dm) {},
136 base::Passed(&dump_manager_2))); 145 base::Passed(&dump_manager_2)));
137 146
138 run_loop.Run(); 147 run_loop.Run();
139 148
140 EXPECT_EQ(3456U, dump_response_args_.dump_guid); 149 EXPECT_EQ(3456U, dump_response_args_.dump_guid);
141 EXPECT_FALSE(dump_response_args_.success); 150 EXPECT_FALSE(dump_response_args_.success);
142 } 151 }
143 } // namespace memory_instrumentation 152 } // namespace memory_instrumentation
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698