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

Unified Diff: content/browser/memory/memory_coordinator_impl_unittest.cc

Issue 2412413002: WIP: Add MemoryCoordinator::GetCurrentMemoryState (Closed)
Patch Set: (rebase) 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 | « content/browser/memory/memory_coordinator_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_coordinator_impl_unittest.cc
diff --git a/content/browser/memory/memory_coordinator_impl_unittest.cc b/content/browser/memory/memory_coordinator_impl_unittest.cc
index 529fdf197f7bbae9363c84591f13a830ac3da780..d8c575d67a32da6a69997937f56be9f6512ef619 100644
--- a/content/browser/memory/memory_coordinator_impl_unittest.cc
+++ b/content/browser/memory/memory_coordinator_impl_unittest.cc
@@ -71,8 +71,12 @@ TEST_F(MemoryCoordinatorImplTest, CalculateNextState) {
coordinator_->new_renderers_back_to_throttled_ = 3;
DCHECK(coordinator_->ValidateParameters());
+ // The default state is NORMAL.
+ EXPECT_EQ(base::MemoryState::NORMAL, coordinator_->GetCurrentMemoryState());
+
// Transitions from NORMAL
coordinator_->current_state_ = base::MemoryState::NORMAL;
+ EXPECT_EQ(base::MemoryState::NORMAL, coordinator_->GetCurrentMemoryState());
GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(50);
EXPECT_EQ(base::MemoryState::NORMAL, coordinator_->CalculateNextState());
GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(40);
@@ -82,6 +86,8 @@ TEST_F(MemoryCoordinatorImplTest, CalculateNextState) {
// Transitions from THROTTLED
coordinator_->current_state_ = base::MemoryState::THROTTLED;
+ EXPECT_EQ(base::MemoryState::THROTTLED,
+ coordinator_->GetCurrentMemoryState());
GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(40);
EXPECT_EQ(base::MemoryState::THROTTLED, coordinator_->CalculateNextState());
GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(50);
@@ -91,6 +97,8 @@ TEST_F(MemoryCoordinatorImplTest, CalculateNextState) {
// Transitions from SUSPENDED
coordinator_->current_state_ = base::MemoryState::SUSPENDED;
+ EXPECT_EQ(base::MemoryState::SUSPENDED,
+ coordinator_->GetCurrentMemoryState());
GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(20);
EXPECT_EQ(base::MemoryState::SUSPENDED, coordinator_->CalculateNextState());
GetMockMemoryMonitor()->SetFreeMemoryUntilCriticalMB(30);
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698