| 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..762013e0b06901c8ae12429c0ad7abaaa49e0c5c
|
| --- /dev/null
|
| +++ b/base/memory/memory_pressure_monitor_unittest.cc
|
| @@ -0,0 +1,33 @@
|
| +// Copyright 2015 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);
|
| + tester.ExpectTotalCount(kHistogram, 1);
|
| + tester.ExpectBucketCount(kHistogram, 0, 1);
|
| +
|
| + MemoryPressureMonitor::RecordMemoryPressure(
|
| + MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);
|
| + tester.ExpectTotalCount(kHistogram, 2);
|
| + tester.ExpectBucketCount(kHistogram, 1, 1);
|
| +
|
| + MemoryPressureMonitor::RecordMemoryPressure(
|
| + MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL);
|
| + tester.ExpectTotalCount(kHistogram, 3);
|
| + tester.ExpectBucketCount(kHistogram, 2, 1);
|
| +}
|
| +} // namespace base
|
|
|