Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / components / memory_pressure / test_memory_pressure_calculator.cc
blob2e0aa5b2f9ff84d177a344f10749914bf46726ae
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
3 // found in the LICENSE file.
5 #include "components/memory_pressure/test_memory_pressure_calculator.h"
7 namespace memory_pressure {
9 #if defined(MEMORY_PRESSURE_IS_POLLING)
11 TestMemoryPressureCalculator::TestMemoryPressureCalculator()
12 : level_(MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE), calls_(0) {}
14 TestMemoryPressureCalculator::MemoryPressureLevel
15 TestMemoryPressureCalculator::CalculateCurrentPressureLevel() {
16 ++calls_;
17 return level_;
20 void TestMemoryPressureCalculator::SetNone() {
21 level_ = MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;
24 void TestMemoryPressureCalculator::SetModerate() {
25 level_ = MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE;
28 void TestMemoryPressureCalculator::SetCritical() {
29 level_ = MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL;
32 void TestMemoryPressureCalculator::ResetCalls() {
33 calls_ = 0;
36 #endif // defined(MEMORY_PRESSURE_IS_POLLING)
38 } // namespace memory_pressure