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

Unified Diff: base/memory/memory_pressure_monitor_linux_unittest.cc

Issue 1250093006: Added memory pressure monitor for linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uncomment ::Get functionality Created 5 years, 5 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/memory_pressure_monitor_linux.cc ('k') | base/memory/memory_pressure_monitor_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_pressure_monitor_linux_unittest.cc
diff --git a/base/memory/memory_pressure_monitor_chromeos_unittest.cc b/base/memory/memory_pressure_monitor_linux_unittest.cc
similarity index 90%
copy from base/memory/memory_pressure_monitor_chromeos_unittest.cc
copy to base/memory/memory_pressure_monitor_linux_unittest.cc
index e0afa448a412e80a24be8293716ecd403d954de9..b9fd64d467ecabb478b89eade42990c53f9fdeb5 100644
--- a/base/memory/memory_pressure_monitor_chromeos_unittest.cc
+++ b/base/memory/memory_pressure_monitor_linux_unittest.cc
@@ -1,8 +1,8 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/memory/memory_pressure_monitor_chromeos.h"
+#include "base/memory/memory_pressure_monitor.h"
#include "base/basictypes.h"
#include "base/memory/memory_pressure_listener.h"
@@ -10,7 +10,6 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
-namespace chromeos {
namespace {
@@ -45,8 +44,7 @@ bool WasOnMemoryPressureCalled() {
class TestMemoryPressureMonitor : public MemoryPressureMonitor {
public:
TestMemoryPressureMonitor()
- : MemoryPressureMonitor(THRESHOLD_DEFAULT),
- memory_in_percent_override_(0) {
+ : MemoryPressureMonitor(), memory_in_percent_override_(0) {
// Disable any timers which are going on and set a special memory reporting
// function.
StopObserving();
@@ -57,14 +55,10 @@ class TestMemoryPressureMonitor : public MemoryPressureMonitor {
memory_in_percent_override_ = percent;
}
- void CheckMemoryPressureForTest() {
- CheckMemoryPressure();
- }
+ void CheckMemoryPressureForTest() { CheckMemoryPressure(); }
private:
- int GetUsedMemoryInPercent() override {
- return memory_in_percent_override_;
- }
+ int GetUsedMemoryInPercent() override { return memory_in_percent_override_; }
int memory_in_percent_override_;
DISALLOW_COPY_AND_ASSIGN(TestMemoryPressureMonitor);
@@ -72,10 +66,9 @@ class TestMemoryPressureMonitor : public MemoryPressureMonitor {
// This test tests the various transition states from memory pressure, looking
// for the correct behavior on event reposting as well as state updates.
-TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
+TEST(LinuxMemoryPressureMonitorTest, CheckMemoryPressure) {
base::MessageLoopForUI message_loop;
- scoped_ptr<TestMemoryPressureMonitor> monitor(
- new TestMemoryPressureMonitor);
+ scoped_ptr<TestMemoryPressureMonitor> monitor(new TestMemoryPressureMonitor);
scoped_ptr<MemoryPressureListener> listener(
new MemoryPressureListener(base::Bind(&OnMemoryPressure)));
// Checking the memory pressure while 0% are used should not produce any
@@ -162,5 +155,4 @@ TEST(ChromeOSMemoryPressureMonitorTest, CheckMemoryPressure) {
EXPECT_EQ(j, i);
}
-} // namespace chromeos
} // namespace base
« no previous file with comments | « base/memory/memory_pressure_monitor_linux.cc ('k') | base/memory/memory_pressure_monitor_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698