OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_coordinator/browser/memory_monitor_win.h" | 5 #include "content/browser/memory/memory_monitor_win.h" |
6 | 6 |
7 #include "components/memory_coordinator/browser/test_memory_monitor.h" | 7 #include "content/browser/memory/test_memory_monitor.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace memory_coordinator { | 10 namespace content { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // A delegate that allows mocking the various inputs to MemoryMonitorWin. | 14 // A delegate that allows mocking the various inputs to MemoryMonitorWin. |
15 class TestMemoryMonitorWinDelegate : public TestMemoryMonitorDelegate { | 15 class TestMemoryMonitorWinDelegate : public TestMemoryMonitorDelegate { |
16 public: | 16 public: |
17 TestMemoryMonitorWinDelegate() {} | 17 TestMemoryMonitorWinDelegate() {} |
18 | 18 |
19 void SetFreeMemoryKB(int free_memory_kb) { | 19 void SetFreeMemoryKB(int free_memory_kb) { |
20 mem_info_.free = free_memory_kb; | 20 mem_info_.free = free_memory_kb; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 EXPECT_EQ(100, monitor_->GetFreeMemoryUntilCriticalMB()); | 128 EXPECT_EQ(100, monitor_->GetFreeMemoryUntilCriticalMB()); |
129 EXPECT_EQ(1u, delegate_.calls()); | 129 EXPECT_EQ(1u, delegate_.calls()); |
130 delegate_.ResetCalls(); | 130 delegate_.ResetCalls(); |
131 | 131 |
132 delegate_.SetFreeMemoryKB(50 * kKBperMB); | 132 delegate_.SetFreeMemoryKB(50 * kKBperMB); |
133 EXPECT_EQ(-50, monitor_->GetFreeMemoryUntilCriticalMB()); | 133 EXPECT_EQ(-50, monitor_->GetFreeMemoryUntilCriticalMB()); |
134 EXPECT_EQ(1u, delegate_.calls()); | 134 EXPECT_EQ(1u, delegate_.calls()); |
135 delegate_.ResetCalls(); | 135 delegate_.ResetCalls(); |
136 } | 136 } |
137 | 137 |
138 } // namespace memory_coordinator | 138 } // namespace content |
OLD | NEW |