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

Side by Side Diff: base/memory/memory_pressure_monitor_unittest.cc

Issue 2434103003: Add Mac memory pressure statistic reporting and consolidate platform code (Closed)
Patch Set: Add radar ID Created 4 years, 1 month 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/memory/memory_pressure_monitor_mac.cc ('k') | base/memory/memory_pressure_monitor_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 "base/memory/memory_pressure_monitor.h"
6
7 #include "base/macros.h"
8 #include "base/memory/memory_pressure_listener.h"
9 #include "base/test/histogram_tester.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace base {
13
14 TEST(MemoryPressureMonitorTest, RecordMemoryPressure) {
15 base::HistogramTester tester;
16 const char* kHistogram = "Memory.PressureLevel";
17
18 MemoryPressureMonitor::RecordMemoryPressure(
19 MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE, 3);
20 tester.ExpectTotalCount(kHistogram, 3);
21 tester.ExpectBucketCount(kHistogram, 0, 3);
22
23 MemoryPressureMonitor::RecordMemoryPressure(
24 MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE, 2);
25 tester.ExpectTotalCount(kHistogram, 5);
26 tester.ExpectBucketCount(kHistogram, 1, 2);
27
28 MemoryPressureMonitor::RecordMemoryPressure(
29 MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL, 1);
30 tester.ExpectTotalCount(kHistogram, 6);
31 tester.ExpectBucketCount(kHistogram, 2, 1);
32 }
33 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/memory_pressure_monitor_mac.cc ('k') | base/memory/memory_pressure_monitor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698