Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: content/browser/memory/memory_monitor_linux_unittest.cc

Issue 2448923004: memory coordinator: Use free memory to guess available memory on Linux (Closed)
Patch Set: fix test expectation Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/memory/memory_monitor_linux.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « content/browser/memory/memory_monitor_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698