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

Unified Diff: cc/surfaces/surface_aggregator_unittest.cc

Issue 2741613002: Add case to verify the coexistence of primary Surface and fallback Surface (Closed)
Patch Set: Refine comments 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator_unittest.cc
diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc
index 46229bbd92d336183728435ee03971bb5bd7a938..90017ef13162e728b644836385e70875a8dd00f0 100644
--- a/cc/surfaces/surface_aggregator_unittest.cc
+++ b/cc/surfaces/surface_aggregator_unittest.cc
@@ -423,6 +423,67 @@ TEST_F(SurfaceAggregatorValidSurfaceTest, FallbackSurfaceReference) {
fallback_child_factory.EvictSurface();
}
+// This test verifies that in the presence of both primary Surface and fallback
+// Surface, the fallback will not be used.
+TEST_F(SurfaceAggregatorValidSurfaceTest, FallbackSurfaceReferenceWithPrimary) {
+ SurfaceFactory primary_child_factory(kArbitraryChildFrameSinkId1, &manager_,
+ &empty_client_);
+ LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId();
+ SurfaceId primary_child_surface_id(primary_child_factory.frame_sink_id(),
+ primary_child_local_surface_id);
+ test::Quad primary_child_quads[] = {
+ test::Quad::SolidColorQuad(SK_ColorGREEN)};
+ test::Pass primary_child_passes[] = {
+ test::Pass(primary_child_quads, arraysize(primary_child_quads))};
+
+ // Submit a CompositorFrame to the primary Surface containing a green
+ // SolidColorDrawQuad.
+ SubmitCompositorFrame(&primary_child_factory, primary_child_passes,
+ arraysize(primary_child_passes),
+ primary_child_local_surface_id);
+
+ SurfaceFactory fallback_child_factory(kArbitraryChildFrameSinkId2, &manager_,
+ &empty_client_);
+ LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId();
+ SurfaceId fallback_child_surface_id(fallback_child_factory.frame_sink_id(),
+ fallback_child_local_surface_id);
+
+ test::Quad fallback_child_quads[] = {test::Quad::SolidColorQuad(SK_ColorRED)};
+ test::Pass fallback_child_passes[] = {
+ test::Pass(fallback_child_quads, arraysize(fallback_child_quads))};
+
+ // Submit a CompositorFrame to the fallback Surface containing a red
+ // SolidColorDrawQuad.
+ SubmitCompositorFrame(&fallback_child_factory, fallback_child_passes,
+ arraysize(fallback_child_passes),
+ fallback_child_local_surface_id);
+
+ // Try to embed |primary_child_surface_id| and if unavailabe, embed
+ // |fallback_child_surface_id|.
+ test::Quad root_quads[] = {test::Quad::SurfaceQuad(
+ primary_child_surface_id, fallback_child_surface_id, 1.f)};
+ test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))};
+
+ SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes),
+ root_local_surface_id_);
+
+ // The CompositorFrame is submitted to |primary_child_surface_id|, so
+ // |fallback_child_surface_id| will not be used and we should see a green
+ // SolidColorDrawQuad.
+ test::Quad expected_quads1[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)};
+ test::Pass expected_passes1[] = {
+ test::Pass(expected_quads1, arraysize(expected_quads1))};
+
+ SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id_);
+ SurfaceId ids[] = {root_surface_id, primary_child_surface_id,
+ fallback_child_surface_id};
+ AggregateAndVerify(expected_passes1, arraysize(expected_passes1), ids,
+ arraysize(ids));
+
+ primary_child_factory.EvictSurface();
+ fallback_child_factory.EvictSurface();
+}
+
TEST_F(SurfaceAggregatorValidSurfaceTest, CopyRequest) {
SurfaceFactory embedded_factory(kArbitraryChildFrameSinkId1, &manager_,
&empty_client_);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698