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

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

Issue 2681643003: Expose DiscardTab() to MemoryCoordiantor (Closed)
Patch Set: fix compile error on android 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 3e83a1264047c7248e2e8203cdd4ccda78d3d6dd..81e49eb04058ecfc268382c1368056e2ab202c12 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) {
@@ -486,6 +496,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

Powered by Google App Engine
This is Rietveld 408576698