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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 1139823008: Re-enable ForceReclaimResources w/ ui impl side painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make expectations more constrained Created 5 years, 7 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') | no next file » | 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 15994ef927f9e43bd1f021c4559b0314f9d7a2e8..5b21182184e64207640717312c36a2d179c213d1 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -7777,5 +7777,40 @@ 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());
+ // Hold an unowned pointer to the output surface to use for mock expectations.
+ MockReclaimResourcesOutputSurface* mock_output_surface = output_surface.get();
+
+ CreateHostImpl(DefaultSettings(), output_surface.Pass());
+ EXPECT_CALL(*mock_output_surface, ForceReclaimResources()).Times(1);
+ host_impl_->BeginCommit();
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698