| 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_linux.h" | 5 #include "content/browser/memory/memory_monitor_linux.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 MemoryMonitorLinux. | 14 // A delegate that allows mocking the various inputs to MemoryMonitorLinux. |
| 15 class TestMemoryMonitorLinuxDelegate : public TestMemoryMonitorDelegate { | 15 class TestMemoryMonitorLinuxDelegate : public TestMemoryMonitorDelegate { |
| 16 public: | 16 public: |
| 17 TestMemoryMonitorLinuxDelegate() {} | 17 TestMemoryMonitorLinuxDelegate() {} |
| 18 | 18 |
| 19 void SetAvailableMemoryKB(int available_memory_kb) { | 19 void SetAvailableMemoryKB(int available_memory_kb) { |
| 20 // If this is set, other "free" values are ignored. | 20 // If this is set, other "free" values are ignored. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 EXPECT_EQ(112, monitor_->GetFreeMemoryUntilCriticalMB()); | 67 EXPECT_EQ(112, monitor_->GetFreeMemoryUntilCriticalMB()); |
| 68 EXPECT_EQ(1U, delegate_.calls()); | 68 EXPECT_EQ(1U, delegate_.calls()); |
| 69 delegate_.ResetCalls(); | 69 delegate_.ResetCalls(); |
| 70 | 70 |
| 71 delegate_.SetFreeMemoryKB(0, 0, 0); | 71 delegate_.SetFreeMemoryKB(0, 0, 0); |
| 72 EXPECT_EQ(0, monitor_->GetFreeMemoryUntilCriticalMB()); | 72 EXPECT_EQ(0, monitor_->GetFreeMemoryUntilCriticalMB()); |
| 73 EXPECT_EQ(1U, delegate_.calls()); | 73 EXPECT_EQ(1U, delegate_.calls()); |
| 74 delegate_.ResetCalls(); | 74 delegate_.ResetCalls(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace memory_coordinator | 77 } // namespace content |
| OLD | NEW |