| 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.
|
|
|