| 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 "base/process/process_metrics.h" | 7 #include "base/process/process_metrics.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 MemoryMonitorWinDelegate { | 15 class TestMemoryMonitorWinDelegate : public MemoryMonitorWinDelegate { |
| 16 public: | 16 public: |
| 17 TestMemoryMonitorWinDelegate() : calls_(0) { | 17 TestMemoryMonitorWinDelegate() : calls_(0) { |
| 18 mem_info_ = {}; | 18 mem_info_ = {}; |
| 19 } | 19 } |
| 20 | 20 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 EXPECT_EQ(100, monitor_->GetFreeMemoryUntilCriticalMB()); | 148 EXPECT_EQ(100, monitor_->GetFreeMemoryUntilCriticalMB()); |
| 149 EXPECT_EQ(1u, delegate_.calls()); | 149 EXPECT_EQ(1u, delegate_.calls()); |
| 150 delegate_.ResetCalls(); | 150 delegate_.ResetCalls(); |
| 151 | 151 |
| 152 delegate_.SetFreeMemoryKB(50 * kKBperMB); | 152 delegate_.SetFreeMemoryKB(50 * kKBperMB); |
| 153 EXPECT_EQ(-50, monitor_->GetFreeMemoryUntilCriticalMB()); | 153 EXPECT_EQ(-50, monitor_->GetFreeMemoryUntilCriticalMB()); |
| 154 EXPECT_EQ(1u, delegate_.calls()); | 154 EXPECT_EQ(1u, delegate_.calls()); |
| 155 delegate_.ResetCalls(); | 155 delegate_.ResetCalls(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace memory_coordinator | 158 } // namespace content |
| OLD | NEW |