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

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

Issue 2941123004: Remove MemoryCoordinator::CanSuspendRenderer() (Closed)
Patch Set: Fix tests Created 3 years, 6 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_unittest.cc
diff --git a/content/browser/memory/memory_coordinator_impl_unittest.cc b/content/browser/memory/memory_coordinator_impl_unittest.cc
index d32996be023a2102b2a3d84b19348039754f2fd0..56bff5def9e4b7928e40822ef19c0e4d8b6846ba 100644
--- a/content/browser/memory/memory_coordinator_impl_unittest.cc
+++ b/content/browser/memory/memory_coordinator_impl_unittest.cc
@@ -101,10 +101,6 @@ class TestMemoryCoordinatorDelegate : public MemoryCoordinatorDelegate {
TestMemoryCoordinatorDelegate() {}
~TestMemoryCoordinatorDelegate() override {}
- bool CanSuspendBackgroundedRenderer(int render_process_id) override {
- return true;
- }
-
void DiscardTab() override { ++discard_tab_count_; }
int discard_tab_count() const { return discard_tab_count_; }
@@ -245,13 +241,8 @@ TEST_F(MemoryCoordinatorImplTest, SetMemoryStateDelivered) {
coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED));
EXPECT_EQ(1, cmc1->on_state_change_calls());
EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc1->state());
-
- EXPECT_TRUE(
- coordinator_->SetChildMemoryState(2, MemoryState::SUSPENDED));
- EXPECT_EQ(1, cmc2->on_state_change_calls());
- // Child processes are considered as visible (foreground) by default,
- // and visible ones won't be suspended but throttled.
- EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc2->state());
+ EXPECT_EQ(0, cmc2->on_state_change_calls());
+ EXPECT_EQ(mojom::MemoryState::NORMAL, cmc2->state());
}
TEST_F(MemoryCoordinatorImplTest, PurgeMemoryChild) {
@@ -277,8 +268,7 @@ TEST_F(MemoryCoordinatorImplTest, SetChildMemoryState) {
EXPECT_TRUE(
coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED));
EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state());
- EXPECT_TRUE(
- coordinator_->SetChildMemoryState(1, MemoryState::SUSPENDED));
+ EXPECT_TRUE(coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED));
EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state());
// Background
@@ -293,19 +283,6 @@ TEST_F(MemoryCoordinatorImplTest, SetChildMemoryState) {
EXPECT_TRUE(
coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED));
EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state());
- EXPECT_TRUE(
- coordinator_->SetChildMemoryState(1, MemoryState::SUSPENDED));
- EXPECT_EQ(mojom::MemoryState::SUSPENDED, cmc->state());
-
- // Background but there are workers
- render_process_host->IncrementServiceWorkerRefCount();
- EXPECT_TRUE(
- coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED));
- EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state());
- EXPECT_FALSE(
- coordinator_->SetChildMemoryState(1, MemoryState::SUSPENDED));
- EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state());
- render_process_host->DecrementSharedWorkerRefCount();
}
// TODO(bashi): Move policy specific tests into a separate file.

Powered by Google App Engine
This is Rietveld 408576698