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

Unified Diff: components/memory_coordinator/browser/memory_coordinator_unittest.cc

Issue 2180843004: Use MemoryPressureListener in MemoryCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « components/memory_coordinator/browser/memory_coordinator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/memory_coordinator/browser/memory_coordinator_unittest.cc
diff --git a/components/memory_coordinator/browser/memory_coordinator_unittest.cc b/components/memory_coordinator/browser/memory_coordinator_unittest.cc
index 5fe205edb4f1a2ca7d36d4c62936ddf5a62dad41..2dc73c4f5472c0c0fce3b99aa4ba3ccec9ac507c 100644
--- a/components/memory_coordinator/browser/memory_coordinator_unittest.cc
+++ b/components/memory_coordinator/browser/memory_coordinator_unittest.cc
@@ -19,8 +19,7 @@ class MockMemoryPressureMonitor : public base::MemoryPressureMonitor {
~MockMemoryPressureMonitor() override {}
void Dispatch(MemoryPressureLevel level) {
- DCHECK(!callback_.is_null());
- callback_.Run(level);
+ base::MemoryPressureListener::NotifyMemoryPressure(level);
}
// MemoryPressureMonitor implementations:
@@ -28,12 +27,7 @@ class MockMemoryPressureMonitor : public base::MemoryPressureMonitor {
return base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;
}
- void SetDispatchCallback(const DispatchCallback& callback) override {
- callback_ = callback;
- }
-
- private:
- DispatchCallback callback_;
+ void SetDispatchCallback(const DispatchCallback& callback) override {}
};
class MockMemoryCoordinatorClient final : public MemoryCoordinatorClient {
@@ -52,11 +46,9 @@ public:
class MemoryCoordinatorTest : public testing::Test {
public:
- MemoryCoordinatorTest() : message_loop_(new base::MessageLoop) {
- // MemoryCoordinator needs to be initialized after an instance of
- // MemoryPressureMonitor is created.
- coordinator_.reset(new MemoryCoordinator);
- }
+ MemoryCoordinatorTest()
+ : message_loop_(new base::MessageLoop),
+ coordinator_(new MemoryCoordinator) {}
MockMemoryPressureMonitor& monitor() { return monitor_; }
MemoryCoordinator& coordinator() { return *coordinator_.get(); }
« no previous file with comments | « components/memory_coordinator/browser/memory_coordinator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698