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

Unified Diff: base/memory/memory_coordinator_proxy.cc

Issue 2448953002: Add MemoryCoordinatorProxy::SetCurrentMemoryStateForTesting (Closed)
Patch Set: Add tests Created 4 years, 2 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_coordinator_proxy.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/memory_coordinator_proxy.cc
diff --git a/base/memory/memory_coordinator_proxy.cc b/base/memory/memory_coordinator_proxy.cc
index 7e8527504102864bc63ca70631b8ca77699cb22b..24b6d66655e0e0d1cdaf59f89b7c2f2cb0c7458f 100644
--- a/base/memory/memory_coordinator_proxy.cc
+++ b/base/memory/memory_coordinator_proxy.cc
@@ -17,14 +17,25 @@ MemoryCoordinatorProxy* MemoryCoordinatorProxy::GetInstance() {
}
MemoryState MemoryCoordinatorProxy::GetCurrentMemoryState() const {
- if (!callback_)
+ if (!getter_callback_)
return MemoryState::NORMAL;
- return callback_.Run();
+ return getter_callback_.Run();
+}
+
+void MemoryCoordinatorProxy::SetCurrentMemoryStateForTesting(
+ MemoryState memory_state) {
+ DCHECK(setter_callback_);
+ setter_callback_.Run(memory_state);
}
void MemoryCoordinatorProxy::SetGetCurrentMemoryStateCallback(
GetCurrentMemoryStateCallback callback) {
- callback_ = callback;
+ getter_callback_ = callback;
+}
+
+void MemoryCoordinatorProxy::SetSetCurrentMemoryStateForTestingCallback(
+ SetCurrentMemoryStateCallback callback) {
+ setter_callback_ = callback;
}
} // namespace base
« no previous file with comments | « base/memory/memory_coordinator_proxy.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698