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 #include "components/memory_pressure/direct_memory_pressure_calculator_win.h" | 5 #include "components/memory_pressure/direct_memory_pressure_calculator_win.h" |
6 | 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/process/process_metrics.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
8 | 10 |
9 namespace memory_pressure { | 11 namespace memory_pressure { |
10 | 12 |
11 #if defined(MEMORY_PRESSURE_IS_POLLING) | 13 #if defined(MEMORY_PRESSURE_IS_POLLING) |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 static const int kKBperMB = 1024; | 17 const int kKBperMB = 1024; |
16 | 18 |
17 } // namespace | 19 } // namespace |
18 | 20 |
19 // This is out of the anonymous namespace space because it is a friend of | 21 // This is out of the anonymous namespace space because it is a friend of |
20 // DirectMemoryPressureCalculator. | 22 // DirectMemoryPressureCalculator. |
21 class TestDirectMemoryPressureCalculator | 23 class TestDirectMemoryPressureCalculator |
22 : public DirectMemoryPressureCalculator { | 24 : public DirectMemoryPressureCalculator { |
23 public: | 25 public: |
24 explicit TestDirectMemoryPressureCalculator(bool large_memory) | 26 explicit TestDirectMemoryPressureCalculator(bool large_memory) |
25 : DirectMemoryPressureCalculator(20, 10) { | 27 : DirectMemoryPressureCalculator(20, 10) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 172 |
171 EXPECT_EQ(kModerateMb, calc.moderate_threshold_mb()); | 173 EXPECT_EQ(kModerateMb, calc.moderate_threshold_mb()); |
172 EXPECT_EQ(kCriticalMb, calc.critical_threshold_mb()); | 174 EXPECT_EQ(kCriticalMb, calc.critical_threshold_mb()); |
173 | 175 |
174 ASSERT_NO_FATAL_FAILURE(CalculateCurrentPressureLevelTest(&calc)); | 176 ASSERT_NO_FATAL_FAILURE(CalculateCurrentPressureLevelTest(&calc)); |
175 } | 177 } |
176 | 178 |
177 #endif // defined(MEMORY_PRESSURE_IS_POLLING) | 179 #endif // defined(MEMORY_PRESSURE_IS_POLLING) |
178 | 180 |
179 } // namespace memory_pressure | 181 } // namespace memory_pressure |
OLD | NEW |