OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/metrics/process_memory_metrics_emitter.h" | |
6 | |
7 #include "base/message_loop/message_loop.h" | |
8 #include "chrome/test/base/in_process_browser_test.h" | |
9 #include "content/public/test/test_utils.h" | |
10 | |
11 namespace { | |
12 | |
13 class ProcessMemoryMetricsEmitterFake : public ProcessMemoryMetricsEmitter { | |
14 public: | |
15 ProcessMemoryMetricsEmitterFake() {} | |
16 | |
17 private: | |
18 ~ProcessMemoryMetricsEmitterFake() override {} | |
19 | |
20 void ReceivedMemoryDump( | |
21 uint64_t dump_guid, | |
dcheng
2017/05/11 22:12:27
FWIW, I still think the typical expectation for "g
erikchen
2017/05/11 22:18:47
@primiano:
thakis and I had a discussion about bir
Nico
2017/05/11 22:24:38
IIRC the numbers were like "there's a 5% chance th
| |
22 bool success, | |
23 memory_instrumentation::mojom::GlobalMemoryDumpPtr ptr) override { | |
24 EXPECT_TRUE(success); | |
25 base::MessageLoop::current()->QuitWhenIdle(); | |
26 } | |
27 | |
28 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMetricsEmitterFake); | |
29 }; | |
30 | |
31 } // namespace | |
32 | |
33 class ProcessMemoryMetricsEmitterTest : public InProcessBrowserTest { | |
34 public: | |
35 ProcessMemoryMetricsEmitterTest() {} | |
36 ~ProcessMemoryMetricsEmitterTest() override {} | |
37 | |
38 private: | |
39 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryMetricsEmitterTest); | |
40 }; | |
41 | |
42 IN_PROC_BROWSER_TEST_F(ProcessMemoryMetricsEmitterTest, FetchAndEmitMetrics) { | |
43 // Intentionally let emitter leave scope to check that it correctly keeps | |
44 // itself alive. | |
45 { | |
46 scoped_refptr<ProcessMemoryMetricsEmitterFake> emitter( | |
47 new ProcessMemoryMetricsEmitterFake); | |
48 emitter->FetchAndEmitProcessMemoryMetrics(); | |
49 } | |
50 | |
51 content::RunMessageLoop(); | |
52 } | |
OLD | NEW |