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

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

Issue 2681643003: Expose DiscardTab() to MemoryCoordiantor (Closed)
Patch Set: comments Created 3 years, 10 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 a0e1b319ea913dff91948416fd4b8d94f70bc0f2..345eacb790bb0f010ccdb8bcbcb3cd09731e896b 100644
--- a/content/browser/memory/memory_coordinator_impl_unittest.cc
+++ b/content/browser/memory/memory_coordinator_impl_unittest.cc
@@ -101,7 +101,13 @@ class TestMemoryCoordinatorDelegate : public MemoryCoordinatorDelegate {
return true;
}
+ void DiscardTab() override { discard_tab_called_ = true; }
+
+ bool discard_tab_called() const { return discard_tab_called_; }
+
private:
+ bool discard_tab_called_ = false;
+
DISALLOW_COPY_AND_ASSIGN(TestMemoryCoordinatorDelegate);
};
@@ -152,6 +158,10 @@ class TestMemoryCoordinatorImpl : public MemoryCoordinatorImpl {
return iter->second.get();
}
+ TestMemoryCoordinatorDelegate* GetDelegate() {
+ return static_cast<TestMemoryCoordinatorDelegate*>(delegate());
+ }
+
// Wrapper of MemoryCoordinator::SetMemoryState that also calls RunUntilIdle.
bool SetChildMemoryState(
int render_process_id, MemoryState memory_state) {
@@ -477,6 +487,10 @@ TEST_F(MemoryCoordinatorImplTest, ForceSetGlobalState) {
EXPECT_EQ(base::MemoryState::THROTTLED, coordinator_->GetGlobalMemoryState());
}
+TEST_F(MemoryCoordinatorImplTest, DiscardTab) {
+ coordinator_->DiscardTab();
+ EXPECT_TRUE(coordinator_->GetDelegate()->discard_tab_called());
+}
#if defined(OS_ANDROID)
// TODO(jcivelli): Broken on Android. http://crbug.com/678665
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.cc ('k') | content/public/browser/memory_coordinator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698