| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_MEMORY_PRESSURE_TEST_MEMORY_PRESSURE_CALCULATOR_H_ | 5 #ifndef COMPONENTS_MEMORY_PRESSURE_TEST_MEMORY_PRESSURE_CALCULATOR_H_ |
| 6 #define COMPONENTS_MEMORY_PRESSURE_TEST_MEMORY_PRESSURE_CALCULATOR_H_ | 6 #define COMPONENTS_MEMORY_PRESSURE_TEST_MEMORY_PRESSURE_CALCULATOR_H_ |
| 7 | 7 |
| 8 #include "components/memory_pressure/memory_pressure_calculator.h" | 8 #include "components/memory_pressure/memory_pressure_calculator.h" |
| 9 | 9 |
| 10 namespace memory_pressure { | 10 namespace memory_pressure { |
| 11 | 11 |
| 12 #if defined(MEMORY_PRESSURE_IS_POLLING) | 12 #if defined(MEMORY_PRESSURE_IS_POLLING) |
| 13 | 13 |
| 14 // A mock memory pressure calculator for unittesting. | 14 // A mock memory pressure calculator for unittesting. |
| 15 class TestMemoryPressureCalculator : public MemoryPressureCalculator { | 15 class TestMemoryPressureCalculator : public MemoryPressureCalculator { |
| 16 public: | 16 public: |
| 17 TestMemoryPressureCalculator(); | 17 TestMemoryPressureCalculator(); |
| 18 virtual ~TestMemoryPressureCalculator() {} | 18 ~TestMemoryPressureCalculator() override {} |
| 19 | 19 |
| 20 // MemoryPressureCalculator implementation. | 20 // MemoryPressureCalculator implementation. |
| 21 MemoryPressureLevel CalculateCurrentPressureLevel() override; | 21 MemoryPressureLevel CalculateCurrentPressureLevel() override; |
| 22 | 22 |
| 23 // Sets the mock calculator to return no pressure. | 23 // Sets the mock calculator to return no pressure. |
| 24 void SetNone(); | 24 void SetNone(); |
| 25 | 25 |
| 26 // Sets the mock calculator to return moderate pressure. | 26 // Sets the mock calculator to return moderate pressure. |
| 27 void SetModerate(); | 27 void SetModerate(); |
| 28 | 28 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 int calls_; | 40 int calls_; |
| 41 | 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(TestMemoryPressureCalculator); | 42 DISALLOW_COPY_AND_ASSIGN(TestMemoryPressureCalculator); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 #endif // defined(MEMORY_PRESSURE_IS_POLLING) | 45 #endif // defined(MEMORY_PRESSURE_IS_POLLING) |
| 46 | 46 |
| 47 } // namespace memory_pressure | 47 } // namespace memory_pressure |
| 48 | 48 |
| 49 #endif // COMPONENTS_MEMORY_PRESSURE_TEST_MEMORY_PRESSURE_CALCULATOR_H_ | 49 #endif // COMPONENTS_MEMORY_PRESSURE_TEST_MEMORY_PRESSURE_CALCULATOR_H_ |
| OLD | NEW |