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

Unified Diff: cc/surfaces/surface_manager_unittest.cc

Issue 2750223005: Preserve FrameSinkSourceMapping nodes that have path to root (Closed)
Patch Set: UnregisterBeginFrameSource, fix debug build of unit test Created 3 years, 9 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
« cc/surfaces/surface_manager.cc ('K') | « cc/surfaces/surface_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_manager_unittest.cc
diff --git a/cc/surfaces/surface_manager_unittest.cc b/cc/surfaces/surface_manager_unittest.cc
index b6edc2be4e4ec3f4a955568f4b73598b88336a5c..9db36f7a5e786fcb3166e00774ae4d78b3086549 100644
--- a/cc/surfaces/surface_manager_unittest.cc
+++ b/cc/surfaces/surface_manager_unittest.cc
@@ -181,6 +181,43 @@ TEST_F(SurfaceManagerTest, MultipleDisplays) {
client_b.frame_sink_id());
}
+// This test verifies that a BeginFrameSource path to the root from a
+// FrameSinkId is preserved even if that FrameSinkId has no children
+// and does not have a corresponding SurfaceFactoryClient.
+TEST_F(SurfaceManagerTest, ParentWithoutClientRetained) {
+ StubBeginFrameSource root_source;
+
+ constexpr FrameSinkId kFrameSinkIdRoot(1, 1);
+ constexpr FrameSinkId kFrameSinkIdA(2, 2);
+ constexpr FrameSinkId kFrameSinkIdB(3, 3);
+ constexpr FrameSinkId kFrameSinkIdC(4, 4);
+
+ FakeSurfaceFactoryClient root(kFrameSinkIdRoot, &manager_);
+ FakeSurfaceFactoryClient client_b(kFrameSinkIdB, &manager_);
+ FakeSurfaceFactoryClient client_c(kFrameSinkIdC, &manager_);
+
+ manager_.RegisterBeginFrameSource(&root_source, root.frame_sink_id());
+ EXPECT_EQ(&root_source, root.source());
+
+ // Set up initial hierarchy: root -> A -> B.
+ // Note that A does not have a SurfaceFactoryClient.
+ manager_.RegisterFrameSinkHierarchy(kFrameSinkIdRoot, kFrameSinkIdA);
+ manager_.RegisterFrameSinkHierarchy(kFrameSinkIdA, kFrameSinkIdB);
+ // The root's BeginFrameSource should propagate to B.
+ EXPECT_EQ(root.source(), client_b.source());
+
+ // Unregister B, and attach C to A: root -> A -> C
+ manager_.UnregisterFrameSinkHierarchy(kFrameSinkIdA, kFrameSinkIdB);
+ EXPECT_EQ(nullptr, client_b.source());
+ manager_.RegisterFrameSinkHierarchy(kFrameSinkIdA, kFrameSinkIdC);
+ // The root's BeginFrameSource should propagate to C.
+ EXPECT_EQ(root.source(), client_c.source());
+
+ manager_.UnregisterBeginFrameSource(&root_source);
+ EXPECT_EQ(nullptr, root.source());
+ EXPECT_EQ(nullptr, client_c.source());
+}
+
// In practice, registering and unregistering both parent/child relationships
// and SurfaceFactoryClients can happen in any ordering with respect to
// each other. These following tests verify that all the data structures
« cc/surfaces/surface_manager.cc ('K') | « cc/surfaces/surface_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698