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

Side by Side Diff: base/trace_event/memory_dump_manager_unittest.cc

Issue 2895083004: memory-infra: rename service folder to memory_instrumentation (Closed)
Patch Set: comments 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
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | chrome/browser/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 } // namespace 241 } // namespace
242 242
243 class MemoryDumpManagerTest : public testing::Test { 243 class MemoryDumpManagerTest : public testing::Test {
244 public: 244 public:
245 MemoryDumpManagerTest() : testing::Test(), kDefaultOptions() {} 245 MemoryDumpManagerTest() : testing::Test(), kDefaultOptions() {}
246 246
247 void SetUp() override { 247 void SetUp() override {
248 last_callback_success_ = false; 248 last_callback_success_ = false;
249 message_loop_.reset(new MessageLoop()); 249 message_loop_.reset(new MessageLoop());
250 mdm_.reset(new MemoryDumpManager()); 250 mdm_ = MemoryDumpManager::CreateInstanceForTesting();
251 ASSERT_EQ(mdm_.get(), MemoryDumpManager::GetInstance());
251 results_.clear(); 252 results_.clear();
252 MemoryDumpManager::SetInstanceForTesting(mdm_.get());
253 ASSERT_EQ(mdm_.get(), MemoryDumpManager::GetInstance());
254 } 253 }
255 254
256 void TearDown() override { 255 void TearDown() override {
257 MemoryDumpManager::SetInstanceForTesting(nullptr);
258 mdm_.reset(); 256 mdm_.reset();
259 message_loop_.reset(); 257 message_loop_.reset();
260 TraceLog::DeleteForTesting(); 258 TraceLog::DeleteForTesting();
261 } 259 }
262 260
263 // Turns a Closure into a GlobalMemoryDumpCallback, keeping track of the 261 // Turns a Closure into a GlobalMemoryDumpCallback, keeping track of the
264 // callback result and taking care of posting the closure on the correct task 262 // callback result and taking care of posting the closure on the correct task
265 // runner. 263 // runner.
266 void GlobalDumpCallbackAdapter( 264 void GlobalDumpCallbackAdapter(
267 scoped_refptr<SingleThreadTaskRunner> task_runner, 265 scoped_refptr<SingleThreadTaskRunner> task_runner,
(...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 EXPECT_EQ(3u, result.chrome_dump.v8_total_kb); 1402 EXPECT_EQ(3u, result.chrome_dump.v8_total_kb);
1405 // partition_alloc has partition_alloc/allocated_objects/* which is a subset 1403 // partition_alloc has partition_alloc/allocated_objects/* which is a subset
1406 // of partition_alloc/partitions/* so we only count the latter. 1404 // of partition_alloc/partitions/* so we only count the latter.
1407 EXPECT_EQ(4u, result.chrome_dump.partition_alloc_total_kb); 1405 EXPECT_EQ(4u, result.chrome_dump.partition_alloc_total_kb);
1408 // resident_set_kb should read from process_totals. 1406 // resident_set_kb should read from process_totals.
1409 EXPECT_EQ(5u, result.os_dump.resident_set_kb); 1407 EXPECT_EQ(5u, result.os_dump.resident_set_kb);
1410 }; 1408 };
1411 1409
1412 } // namespace trace_event 1410 } // namespace trace_event
1413 } // namespace base 1411 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager.cc ('k') | chrome/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698