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

Unified Diff: services/ui/surfaces/display_compositor_unittest.cc

Issue 2612873003: Fix bug removing temporary surface references. (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 | « services/ui/surfaces/display_compositor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/surfaces/display_compositor_unittest.cc
diff --git a/services/ui/surfaces/display_compositor_unittest.cc b/services/ui/surfaces/display_compositor_unittest.cc
index 23d32a5e5adcf5e73fd5550a686bb80808c4b339..6d2cf5a166dade018393196f7c815ff47ce23ad5 100644
--- a/services/ui/surfaces/display_compositor_unittest.cc
+++ b/services/ui/surfaces/display_compositor_unittest.cc
@@ -285,5 +285,36 @@ TEST_F(DisplayCompositorTest, AddSurfacesSkipReference) {
EXPECT_EQ(0u, CountTempReferences());
}
+TEST_F(DisplayCompositorTest, RemoveFirstTempRefOnly) {
+ const cc::SurfaceId parent_id = MakeSurfaceId(1, 1, 1);
+ const cc::SurfaceId surface_id1 = MakeSurfaceId(2, 1, 1);
+ const cc::SurfaceId surface_id2 = MakeSurfaceId(2, 1, 2);
+
+ // Add two surfaces that have the same FrameSinkId. This would happen when a
+ // client submits two CFs before parent submits a new CF.
+ surface_observer()->OnSurfaceCreated(
+ cc::SurfaceInfo(surface_id1, 1.0f, gfx::Size(1, 1)));
+ surface_observer()->OnSurfaceCreated(
+ cc::SurfaceInfo(surface_id2, 1.0f, gfx::Size(1, 1)));
+ RunUntilIdle();
+
+ // Client should get OnSurfaceCreated call and temporary reference added for
+ // both surfaces.
+ EXPECT_EQ("OnSurfaceCreated(2:1:1);OnSurfaceCreated(2:1:2)",
+ client_.events());
+ EXPECT_EQ("Add(0:0:0-2:1:1);Add(0:0:0-2:1:2)", reference_manager_.events());
+ EXPECT_EQ(2u, CountTempReferences());
+
+ // Add a reference to the surface with the earlier LocalFrameId.
+ AddSurfaceReference(parent_id, surface_id1);
+ RunUntilIdle();
+
+ // The real reference should be added for 2:1:1 and temporary reference
+ // should be removed. The temporary reference for 2:1:2 should remain.
+ EXPECT_EQ("Add(1:1:1-2:1:1);Remove(0:0:0-2:1:1)",
+ reference_manager_.events());
+ EXPECT_EQ(1u, CountTempReferences());
+}
+
} // namespace test
} // namespace ui
« no previous file with comments | « services/ui/surfaces/display_compositor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698