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

Unified Diff: cc/surfaces/compositor_frame_sink_support_unittest.cc

Issue 2685393003: Surfaces: Allow parent to refer to child surfaces that don't exist yet. (Closed)
Patch Set: Rebased Created 3 years, 10 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 | « no previous file | cc/surfaces/surface_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/compositor_frame_sink_support_unittest.cc
diff --git a/cc/surfaces/compositor_frame_sink_support_unittest.cc b/cc/surfaces/compositor_frame_sink_support_unittest.cc
index 86a57cee27c6ac104da0d4a670c2333d377ab591..7984c87202b7243350ea877955982b823240d015 100644
--- a/cc/surfaces/compositor_frame_sink_support_unittest.cc
+++ b/cc/surfaces/compositor_frame_sink_support_unittest.cc
@@ -102,6 +102,18 @@ class CompositorFrameSinkSupportTest : public testing::Test,
SurfaceManager& surface_manager() { return surface_manager_; }
+ // Returns all the references where |surface_id| is the parent.
+ const SurfaceManager::SurfaceIdSet& GetChildReferences(
+ const SurfaceId& surface_id) {
+ return surface_manager().parent_to_child_refs_[surface_id];
+ }
+
+ // Returns all the temporary references for the given frame sink id.
+ std::vector<LocalSurfaceId> GetTempReferences(
+ const FrameSinkId& frame_sink_id) {
+ return surface_manager().temp_references_[frame_sink_id];
+ }
+
SurfaceDependencyTracker& dependency_tracker() {
return *surface_manager_.dependency_tracker();
}
@@ -524,5 +536,42 @@ TEST_F(CompositorFrameSinkSupportTest,
UnorderedElementsAre(returned_resource));
}
+// This test verifies that a SurfaceReference from parent to child can be added
+// prior to the child submitting a CompositorFrame. This test also verifies that
+// when the child later submits a CompositorFrame,
+TEST_F(CompositorFrameSinkSupportTest,
+ DisplayCompositorLockingReferenceAddedBeforeChildExists) {
+ const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
+ const SurfaceId child_id = MakeSurfaceId(kChildFrameSink1, 1);
+
+ // The parent submits a CompositorFrame that depends on |child_id| before the
+ // child submits a CompositorFrame.
+ parent_support().SubmitCompositorFrame(parent_id.local_surface_id(),
+ MakeCompositorFrame({child_id}));
+
+ // Verify that the CompositorFrame is blocked on |child_id|.
+ EXPECT_FALSE(parent_surface()->HasActiveFrame());
+ EXPECT_TRUE(parent_surface()->HasPendingFrame());
+ EXPECT_THAT(parent_surface()->blocking_surfaces_for_testing(),
+ UnorderedElementsAre(child_id));
+
+ // Verify that a SurfaceReference(parent_id, child_id) exists in the
+ // SurfaceManager.
+ EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id));
+
+ child_support1().SubmitCompositorFrame(
+ child_id.local_surface_id(), MakeCompositorFrame(empty_surface_ids()));
+
+ // Verify that the child CompositorFrame activates immediately.
+ EXPECT_TRUE(child_surface1()->HasActiveFrame());
+ EXPECT_FALSE(child_surface1()->HasPendingFrame());
+ EXPECT_THAT(child_surface1()->blocking_surfaces_for_testing(), IsEmpty());
+
+ // Verify that there is no temporary reference for the child and that
+ // the reference from the parent to the child still exists.
+ EXPECT_THAT(GetTempReferences(child_id.frame_sink_id()), IsEmpty());
+ EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id));
+}
+
} // namespace test
} // namespace cc
« no previous file with comments | « no previous file | cc/surfaces/surface_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698