Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/surfaces/surface_aggregator.h" | 5 #include "cc/surfaces/surface_aggregator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 test::Quad expected_quads2[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; | 416 test::Quad expected_quads2[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; |
| 417 test::Pass expected_passes2[] = { | 417 test::Pass expected_passes2[] = { |
| 418 test::Pass(expected_quads2, arraysize(expected_quads2))}; | 418 test::Pass(expected_quads2, arraysize(expected_quads2))}; |
| 419 AggregateAndVerify(expected_passes2, arraysize(expected_passes2), ids, | 419 AggregateAndVerify(expected_passes2, arraysize(expected_passes2), ids, |
| 420 arraysize(ids)); | 420 arraysize(ids)); |
| 421 | 421 |
| 422 primary_child_factory.EvictSurface(); | 422 primary_child_factory.EvictSurface(); |
| 423 fallback_child_factory.EvictSurface(); | 423 fallback_child_factory.EvictSurface(); |
| 424 } | 424 } |
| 425 | 425 |
| 426 // This test verifies that in the presence of both primary Surface and fallback | |
| 427 // Surface, the fallback will not be used. | |
| 428 TEST_F(SurfaceAggregatorValidSurfaceTest, FallbackSurfaceReferenceWithPrimary) { | |
| 429 SurfaceFactory primary_child_factory(kArbitraryChildFrameSinkId1, &manager_, | |
| 430 &empty_client_); | |
| 431 LocalSurfaceId primary_child_local_surface_id = allocator_.GenerateId(); | |
| 432 SurfaceId primary_child_surface_id(primary_child_factory.frame_sink_id(), | |
| 433 primary_child_local_surface_id); | |
| 434 test::Quad primary_child_quads[] = { | |
| 435 test::Quad::SolidColorQuad(SK_ColorGREEN)}; | |
| 436 test::Pass primary_child_passes[] = { | |
| 437 test::Pass(primary_child_quads, arraysize(primary_child_quads))}; | |
| 438 | |
| 439 // Submit a CompositorFrame to the primary Surface containing a green | |
| 440 // SolidColorDrawQuad. | |
| 441 SubmitCompositorFrame(&primary_child_factory, primary_child_passes, | |
| 442 arraysize(primary_child_passes), | |
| 443 primary_child_local_surface_id); | |
| 444 | |
| 445 SurfaceFactory fallback_child_factory(kArbitraryChildFrameSinkId2, &manager_, | |
| 446 &empty_client_); | |
| 447 LocalSurfaceId fallback_child_local_surface_id = allocator_.GenerateId(); | |
| 448 SurfaceId fallback_child_surface_id(fallback_child_factory.frame_sink_id(), | |
| 449 fallback_child_local_surface_id); | |
| 450 | |
| 451 test::Quad fallback_child_quads[] = {test::Quad::SolidColorQuad(SK_ColorRED)}; | |
| 452 test::Pass fallback_child_passes[] = { | |
| 453 test::Pass(fallback_child_quads, arraysize(fallback_child_quads))}; | |
| 454 | |
| 455 // Submit a CompositorFrame to the fallback Surface containing a red | |
| 456 // SolidColorDrawQuad. | |
| 457 SubmitCompositorFrame(&fallback_child_factory, fallback_child_passes, | |
| 458 arraysize(fallback_child_passes), | |
| 459 fallback_child_local_surface_id); | |
| 460 | |
| 461 // Try to embed |primary_child_surface_id| and if unavailabe, embed | |
| 462 // |fallback_child_surface_id|. | |
| 463 test::Quad root_quads[] = {test::Quad::SurfaceQuad( | |
| 464 primary_child_surface_id, fallback_child_surface_id, 1.f)}; | |
| 465 test::Pass root_passes[] = {test::Pass(root_quads, arraysize(root_quads))}; | |
| 466 | |
| 467 SubmitCompositorFrame(&factory_, root_passes, arraysize(root_passes), | |
| 468 root_local_surface_id_); | |
| 469 | |
| 470 // There is no CompositorFrame submitted to |primary_child_surface_id| and so | |
| 471 // |fallback_child_surface_id| will be embedded and we should see a red | |
| 472 // SolidColorDrawQuad. | |
|
jbauman
2017/03/09 03:01:17
Fix this comment to match the test.
| |
| 473 test::Quad expected_quads1[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; | |
| 474 test::Pass expected_passes1[] = { | |
| 475 test::Pass(expected_quads1, arraysize(expected_quads1))}; | |
| 476 | |
| 477 SurfaceId root_surface_id(factory_.frame_sink_id(), root_local_surface_id_); | |
| 478 SurfaceId ids[] = {root_surface_id, primary_child_surface_id, | |
| 479 fallback_child_surface_id}; | |
| 480 AggregateAndVerify(expected_passes1, arraysize(expected_passes1), ids, | |
| 481 arraysize(ids)); | |
| 482 | |
| 483 primary_child_factory.EvictSurface(); | |
| 484 fallback_child_factory.EvictSurface(); | |
| 485 } | |
| 486 | |
| 426 TEST_F(SurfaceAggregatorValidSurfaceTest, CopyRequest) { | 487 TEST_F(SurfaceAggregatorValidSurfaceTest, CopyRequest) { |
| 427 SurfaceFactory embedded_factory(kArbitraryChildFrameSinkId1, &manager_, | 488 SurfaceFactory embedded_factory(kArbitraryChildFrameSinkId1, &manager_, |
| 428 &empty_client_); | 489 &empty_client_); |
| 429 LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); | 490 LocalSurfaceId embedded_local_surface_id = allocator_.GenerateId(); |
| 430 SurfaceId embedded_surface_id(embedded_factory.frame_sink_id(), | 491 SurfaceId embedded_surface_id(embedded_factory.frame_sink_id(), |
| 431 embedded_local_surface_id); | 492 embedded_local_surface_id); |
| 432 | 493 |
| 433 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; | 494 test::Quad embedded_quads[] = {test::Quad::SolidColorQuad(SK_ColorGREEN)}; |
| 434 test::Pass embedded_passes[] = { | 495 test::Pass embedded_passes[] = { |
| 435 test::Pass(embedded_quads, arraysize(embedded_quads))}; | 496 test::Pass(embedded_quads, arraysize(embedded_quads))}; |
| (...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2205 aggregated_frame = aggregator_.Aggregate(surface_id); | 2266 aggregated_frame = aggregator_.Aggregate(surface_id); |
| 2206 EXPECT_EQ(3u, aggregated_frame.render_pass_list.size()); | 2267 EXPECT_EQ(3u, aggregated_frame.render_pass_list.size()); |
| 2207 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[0]->color_space); | 2268 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[0]->color_space); |
| 2208 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[1]->color_space); | 2269 EXPECT_EQ(color_space1, aggregated_frame.render_pass_list[1]->color_space); |
| 2209 EXPECT_EQ(color_space3, aggregated_frame.render_pass_list[2]->color_space); | 2270 EXPECT_EQ(color_space3, aggregated_frame.render_pass_list[2]->color_space); |
| 2210 } | 2271 } |
| 2211 | 2272 |
| 2212 } // namespace | 2273 } // namespace |
| 2213 } // namespace cc | 2274 } // namespace cc |
| 2214 | 2275 |
| OLD | NEW |