| 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 "content/browser/memory/memory_monitor_linux.h" | 5 #include "content/browser/memory/memory_monitor_linux.h" |
| 6 | 6 |
| 7 #include "content/browser/memory/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 content { | 10 namespace content { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 monitor_.reset(new MemoryMonitorLinux(&delegate_)); | 58 monitor_.reset(new MemoryMonitorLinux(&delegate_)); |
| 59 EXPECT_EQ(0u, delegate_.calls()); | 59 EXPECT_EQ(0u, delegate_.calls()); |
| 60 | 60 |
| 61 delegate_.SetAvailableMemoryKB(200 * kKBperMB); | 61 delegate_.SetAvailableMemoryKB(200 * kKBperMB); |
| 62 EXPECT_EQ(200, monitor_->GetFreeMemoryUntilCriticalMB()); | 62 EXPECT_EQ(200, monitor_->GetFreeMemoryUntilCriticalMB()); |
| 63 EXPECT_EQ(1U, delegate_.calls()); | 63 EXPECT_EQ(1U, delegate_.calls()); |
| 64 delegate_.ResetCalls(); | 64 delegate_.ResetCalls(); |
| 65 | 65 |
| 66 delegate_.SetFreeMemoryKB(64 * kKBperMB, 32 * kKBperMB, 16 * kKBperMB); | 66 delegate_.SetFreeMemoryKB(64 * kKBperMB, 32 * kKBperMB, 16 * kKBperMB); |
| 67 EXPECT_EQ(112, monitor_->GetFreeMemoryUntilCriticalMB()); | 67 EXPECT_EQ(64, 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 content | 77 } // namespace content |
| OLD | NEW |