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 15994ef927f9e43bd1f021c4559b0314f9d7a2e8..5e2bcf1d04907bb00d546220e092a5dbbe1bc3af 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -7777,5 +7777,37 @@ TEST_F(LayerTreeHostImplTest, GpuRasterizationStatusModes) { |
EXPECT_TRUE(host_impl_->use_gpu_rasterization()); |
} |
+// A mock output surface which lets us detect calls to ForceReclaimResources. |
+class MockReclaimResourcesOutputSurface : public FakeOutputSurface { |
+ public: |
+ static scoped_ptr<MockReclaimResourcesOutputSurface> Create3d() { |
+ return make_scoped_ptr(new MockReclaimResourcesOutputSurface( |
+ TestContextProvider::Create(), TestContextProvider::Create(), false)); |
+ } |
+ |
+ MOCK_METHOD0(ForceReclaimResources, void()); |
+ |
+ protected: |
+ MockReclaimResourcesOutputSurface( |
+ scoped_refptr<ContextProvider> context_provider, |
+ scoped_refptr<ContextProvider> worker_context_provider, |
+ bool delegated_rendering) |
+ : FakeOutputSurface(context_provider, |
+ worker_context_provider, |
+ delegated_rendering) {} |
+}; |
+ |
+// 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) { |
+ scoped_ptr<MockReclaimResourcesOutputSurface> output_surface( |
+ MockReclaimResourcesOutputSurface::Create3d()); |
+ EXPECT_CALL(*output_surface.get(), ForceReclaimResources()).Times(1); |
+ CreateHostImpl(DefaultSettings(), output_surface.Pass()); |
+ host_impl_->BeginCommit(); |
danakj
2015/05/19 18:33:54
can you verifyexpectations before this so we know
ericrk
2015/05/19 18:38:08
Done.
|
+} |
+ |
} // namespace |
} // namespace cc |