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

Unified Diff: content/browser/memory/memory_coordinator_impl.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
Index: content/browser/memory/memory_coordinator_impl.cc
diff --git a/content/browser/memory/memory_coordinator_impl.cc b/content/browser/memory/memory_coordinator_impl.cc
index 647c00f1aaef7ca6d4bec3f1af00406254f42654..d5fff2e2c5bc86e47685d9e7f91c0112bdd99fe0 100644
--- a/content/browser/memory/memory_coordinator_impl.cc
+++ b/content/browser/memory/memory_coordinator_impl.cc
@@ -114,6 +114,18 @@ base::MemoryState MemoryCoordinatorImpl::GetCurrentMemoryState() const {
return current_state_;
}
+void MemoryCoordinatorImpl::SetCurrentMemoryStateForTesting(
+ base::MemoryState memory_state) {
+ // This changes the current state temporariy for testing. The state will be
+ // updated later by the task posted at ScheduleUpdateState.
+ base::MemoryState prev_state = current_state_;
+ current_state_ = memory_state;
+ if (prev_state != current_state_) {
+ NotifyStateToClients();
+ NotifyStateToChildren();
+ }
+}
+
void MemoryCoordinatorImpl::Observe(int type,
const NotificationSource& source,
const NotificationDetails& details) {
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.h ('k') | content/browser/memory/memory_coordinator_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698