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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_pressure_monitor_unittest.cc
diff --git a/base/memory/memory_pressure_monitor_unittest.cc b/base/memory/memory_pressure_monitor_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e9747418cc887383d822c9bf409861f8686df195
--- /dev/null
+++ b/base/memory/memory_pressure_monitor_unittest.cc
@@ -0,0 +1,33 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/memory_pressure_monitor.h"
+
+#include "base/macros.h"
+#include "base/memory/memory_pressure_listener.h"
+#include "base/test/histogram_tester.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace base {
+
+TEST(MemoryPressureMonitorTest, RecordMemoryPressure) {
+ base::HistogramTester tester;
+ const char* kHistogram = "Memory.PressureLevel";
+
+ MemoryPressureMonitor::RecordMemoryPressure(
+ MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE, 3);
+ tester.ExpectTotalCount(kHistogram, 3);
+ tester.ExpectBucketCount(kHistogram, 0, 3);
+
+ MemoryPressureMonitor::RecordMemoryPressure(
+ MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE, 2);
+ tester.ExpectTotalCount(kHistogram, 5);
+ tester.ExpectBucketCount(kHistogram, 1, 2);
+
+ MemoryPressureMonitor::RecordMemoryPressure(
+ MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL, 1);
+ tester.ExpectTotalCount(kHistogram, 6);
+ tester.ExpectBucketCount(kHistogram, 2, 1);
+}
+} // namespace base
« 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