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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2633563003: Revert of Remove ForceReclaimResources (Closed)
Patch Set: Created 3 years, 11 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 | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_tiles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index f0afd404d9111b5ae23acbe1491fc6d2bcee724c..b2fd2e17215b8e00a617b949a2a20be090cd5e37 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -8409,7 +8409,8 @@
auto compositor_frame_sink = base::MakeUnique<TestCompositorFrameSink>(
context_provider, TestContextProvider::CreateWorker(), nullptr, nullptr,
RendererSettings(), base::ThreadTaskRunnerHandle::Get().get(),
- true /* synchronous_composite */);
+ true /* synchronous_composite */,
+ false /* force_disable_reclaim_resources */);
compositor_frame_sink->SetClient(&test_client_);
CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink));
@@ -11448,6 +11449,32 @@
EXPECT_FALSE(host_impl_->use_gpu_rasterization());
}
+// A mock output surface which lets us detect calls to ForceReclaimResources.
+class MockReclaimResourcesCompositorFrameSink : public FakeCompositorFrameSink {
+ public:
+ MockReclaimResourcesCompositorFrameSink()
+ : FakeCompositorFrameSink(TestContextProvider::Create(),
+ TestContextProvider::CreateWorker()) {}
+
+ MOCK_METHOD0(ForceReclaimResources, void());
+};
+
+// Display::Draw (and the planned Display Scheduler) currently rely on resources
+// being reclaimed to block drawing between BeginCommit / Swap. This test
+// ensures that BeginCommit triggers ForceReclaimResources. See
+// crbug.com/489515.
+TEST_F(LayerTreeHostImplTest, BeginCommitReclaimsResources) {
+ auto compositor_frame_sink =
+ base::MakeUnique<MockReclaimResourcesCompositorFrameSink>();
+ // Hold an unowned pointer to the output surface to use for mock expectations.
+ MockReclaimResourcesCompositorFrameSink* mock_compositor_frame_sink =
+ compositor_frame_sink.get();
+
+ CreateHostImpl(DefaultSettings(), std::move(compositor_frame_sink));
+ EXPECT_CALL(*mock_compositor_frame_sink, ForceReclaimResources()).Times(1);
+ host_impl_->BeginCommit();
+}
+
TEST_F(LayerTreeHostImplTest, UpdatePageScaleFactorOnActiveTree) {
// Check page scale factor update in property trees when an update is made
// on the active tree.
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_pixeltest_tiles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698