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

Side by Side Diff: cc/output/overlay_unittest.cc

Issue 1271843005: cc: Remove code for drawing checkerboard quads, it's not used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rm-checkers: sizes Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « cc/output/gl_renderer_unittest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/scoped_ptr_vector.h" 5 #include "cc/base/scoped_ptr_vector.h"
6 #include "cc/output/compositor_frame_metadata.h" 6 #include "cc/output/compositor_frame_metadata.h"
7 #include "cc/output/gl_renderer.h" 7 #include "cc/output/gl_renderer.h"
8 #include "cc/output/output_surface.h" 8 #include "cc/output/output_surface.h"
9 #include "cc/output/output_surface_client.h" 9 #include "cc/output/output_surface_client.h"
10 #include "cc/output/overlay_candidate_validator.h" 10 #include "cc/output/overlay_candidate_validator.h"
11 #include "cc/output/overlay_processor.h" 11 #include "cc/output/overlay_processor.h"
12 #include "cc/output/overlay_strategy_single_on_top.h" 12 #include "cc/output/overlay_strategy_single_on_top.h"
13 #include "cc/output/overlay_strategy_underlay.h" 13 #include "cc/output/overlay_strategy_underlay.h"
14 #include "cc/quads/checkerboard_draw_quad.h"
15 #include "cc/quads/render_pass.h" 14 #include "cc/quads/render_pass.h"
15 #include "cc/quads/solid_color_draw_quad.h"
16 #include "cc/quads/stream_video_draw_quad.h" 16 #include "cc/quads/stream_video_draw_quad.h"
17 #include "cc/quads/texture_draw_quad.h" 17 #include "cc/quads/texture_draw_quad.h"
18 #include "cc/resources/resource_provider.h" 18 #include "cc/resources/resource_provider.h"
19 #include "cc/resources/texture_mailbox.h" 19 #include "cc/resources/texture_mailbox.h"
20 #include "cc/test/fake_output_surface_client.h" 20 #include "cc/test/fake_output_surface_client.h"
21 #include "cc/test/fake_resource_provider.h" 21 #include "cc/test/fake_resource_provider.h"
22 #include "cc/test/geometry_test_utils.h" 22 #include "cc/test/geometry_test_utils.h"
23 #include "cc/test/test_context_provider.h" 23 #include "cc/test/test_context_provider.h"
24 #include "cc/test/test_shared_bitmap_manager.h" 24 #include "cc/test/test_shared_bitmap_manager.h"
25 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 StreamVideoDrawQuad* CreateFullscreenCandidateVideoQuad( 232 StreamVideoDrawQuad* CreateFullscreenCandidateVideoQuad(
233 ResourceProvider* resource_provider, 233 ResourceProvider* resource_provider,
234 const SharedQuadState* shared_quad_state, 234 const SharedQuadState* shared_quad_state,
235 RenderPass* render_pass, 235 RenderPass* render_pass,
236 const gfx::Transform& transform) { 236 const gfx::Transform& transform) {
237 return CreateCandidateVideoQuadAt(resource_provider, shared_quad_state, 237 return CreateCandidateVideoQuadAt(resource_provider, shared_quad_state,
238 render_pass, kOverlayRect, transform); 238 render_pass, kOverlayRect, transform);
239 } 239 }
240 240
241 void CreateCheckeredQuadAt(ResourceProvider* resource_provider, 241 void CreateOpaqueQuadAt(ResourceProvider* resource_provider,
242 const SharedQuadState* shared_quad_state, 242 const SharedQuadState* shared_quad_state,
243 RenderPass* render_pass, 243 RenderPass* render_pass,
244 const gfx::Rect& rect) { 244 const gfx::Rect& rect) {
245 CheckerboardDrawQuad* checkerboard_quad = 245 SolidColorDrawQuad* color_quad =
246 render_pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>(); 246 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
247 checkerboard_quad->SetNew(shared_quad_state, rect, rect, SkColor(), 1.f); 247 color_quad->SetNew(shared_quad_state, rect, rect, SK_ColorBLACK, false);
248 } 248 }
249 249
250 void CreateFullscreenCheckeredQuad(ResourceProvider* resource_provider, 250 void CreateFullscreenOpaqueQuad(ResourceProvider* resource_provider,
251 const SharedQuadState* shared_quad_state, 251 const SharedQuadState* shared_quad_state,
252 RenderPass* render_pass) { 252 RenderPass* render_pass) {
253 CreateCheckeredQuadAt( 253 CreateOpaqueQuadAt(resource_provider, shared_quad_state, render_pass,
254 resource_provider, shared_quad_state, render_pass, kOverlayRect); 254 kOverlayRect);
255 } 255 }
256 256
257 static void CompareRenderPassLists(const RenderPassList& expected_list, 257 static void CompareRenderPassLists(const RenderPassList& expected_list,
258 const RenderPassList& actual_list) { 258 const RenderPassList& actual_list) {
259 EXPECT_EQ(expected_list.size(), actual_list.size()); 259 EXPECT_EQ(expected_list.size(), actual_list.size());
260 for (size_t i = 0; i < actual_list.size(); ++i) { 260 for (size_t i = 0; i < actual_list.size(); ++i) {
261 RenderPass* expected = expected_list[i]; 261 RenderPass* expected = expected_list[i];
262 RenderPass* actual = actual_list[i]; 262 RenderPass* actual = actual_list[i];
263 263
264 EXPECT_EQ(expected->id, actual->id); 264 EXPECT_EQ(expected->id, actual->id);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 TEST_F(SingleOverlayOnTopTest, SuccessfullOverlay) { 345 TEST_F(SingleOverlayOnTopTest, SuccessfullOverlay) {
346 scoped_ptr<RenderPass> pass = CreateRenderPass(); 346 scoped_ptr<RenderPass> pass = CreateRenderPass();
347 TextureDrawQuad* original_quad = 347 TextureDrawQuad* original_quad =
348 CreateFullscreenCandidateQuad(resource_provider_.get(), 348 CreateFullscreenCandidateQuad(resource_provider_.get(),
349 pass->shared_quad_state_list.back(), 349 pass->shared_quad_state_list.back(),
350 pass.get()); 350 pass.get());
351 unsigned original_resource_id = original_quad->resource_id(); 351 unsigned original_resource_id = original_quad->resource_id();
352 352
353 // Add something behind it. 353 // Add something behind it.
354 CreateFullscreenCheckeredQuad(resource_provider_.get(), 354 CreateFullscreenOpaqueQuad(resource_provider_.get(),
355 pass->shared_quad_state_list.back(), 355 pass->shared_quad_state_list.back(), pass.get());
356 pass.get()); 356 CreateFullscreenOpaqueQuad(resource_provider_.get(),
357 CreateFullscreenCheckeredQuad(resource_provider_.get(), 357 pass->shared_quad_state_list.back(), pass.get());
358 pass->shared_quad_state_list.back(),
359 pass.get());
360 358
361 RenderPassList pass_list; 359 RenderPassList pass_list;
362 pass_list.push_back(pass.Pass()); 360 pass_list.push_back(pass.Pass());
363 361
364 // Check for potential candidates. 362 // Check for potential candidates.
365 OverlayCandidateList candidate_list; 363 OverlayCandidateList candidate_list;
366 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 364 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
367 365
368 ASSERT_EQ(1U, pass_list.size()); 366 ASSERT_EQ(1U, pass_list.size());
369 ASSERT_EQ(2U, candidate_list.size()); 367 ASSERT_EQ(2U, candidate_list.size());
370 368
371 RenderPass* main_pass = pass_list.back(); 369 RenderPass* main_pass = pass_list.back();
372 // Check that the quad is gone. 370 // Check that the quad is gone.
373 EXPECT_EQ(2U, main_pass->quad_list.size()); 371 EXPECT_EQ(2U, main_pass->quad_list.size());
374 const QuadList& quad_list = main_pass->quad_list; 372 const QuadList& quad_list = main_pass->quad_list;
375 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); 373 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin();
376 it != quad_list.BackToFrontEnd(); 374 it != quad_list.BackToFrontEnd();
377 ++it) { 375 ++it) {
378 EXPECT_NE(DrawQuad::TEXTURE_CONTENT, it->material); 376 EXPECT_NE(DrawQuad::TEXTURE_CONTENT, it->material);
379 } 377 }
380 378
381 // Check that the right resource id got extracted. 379 // Check that the right resource id got extracted.
382 EXPECT_EQ(original_resource_id, candidate_list.back().resource_id); 380 EXPECT_EQ(original_resource_id, candidate_list.back().resource_id);
383 } 381 }
384 382
385 TEST_F(SingleOverlayOnTopTest, NoCandidates) { 383 TEST_F(SingleOverlayOnTopTest, NoCandidates) {
386 scoped_ptr<RenderPass> pass = CreateRenderPass(); 384 scoped_ptr<RenderPass> pass = CreateRenderPass();
387 CreateFullscreenCheckeredQuad(resource_provider_.get(), 385 CreateFullscreenOpaqueQuad(resource_provider_.get(),
388 pass->shared_quad_state_list.back(), 386 pass->shared_quad_state_list.back(), pass.get());
389 pass.get()); 387 CreateFullscreenOpaqueQuad(resource_provider_.get(),
390 CreateFullscreenCheckeredQuad(resource_provider_.get(), 388 pass->shared_quad_state_list.back(), pass.get());
391 pass->shared_quad_state_list.back(),
392 pass.get());
393 389
394 RenderPassList pass_list; 390 RenderPassList pass_list;
395 pass_list.push_back(pass.Pass()); 391 pass_list.push_back(pass.Pass());
396 392
397 RenderPassList original_pass_list; 393 RenderPassList original_pass_list;
398 RenderPass::CopyAll(pass_list, &original_pass_list); 394 RenderPass::CopyAll(pass_list, &original_pass_list);
399 395
400 OverlayCandidateList candidate_list; 396 OverlayCandidateList candidate_list;
401 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 397 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
402 EXPECT_EQ(0U, candidate_list.size()); 398 EXPECT_EQ(0U, candidate_list.size());
403 // There should be nothing new here. 399 // There should be nothing new here.
404 CompareRenderPassLists(pass_list, original_pass_list); 400 CompareRenderPassLists(pass_list, original_pass_list);
405 } 401 }
406 402
407 TEST_F(SingleOverlayOnTopTest, OccludedCandidates) { 403 TEST_F(SingleOverlayOnTopTest, OccludedCandidates) {
408 scoped_ptr<RenderPass> pass = CreateRenderPass(); 404 scoped_ptr<RenderPass> pass = CreateRenderPass();
409 CreateFullscreenCheckeredQuad(resource_provider_.get(), 405 CreateFullscreenOpaqueQuad(resource_provider_.get(),
410 pass->shared_quad_state_list.back(), 406 pass->shared_quad_state_list.back(), pass.get());
411 pass.get()); 407 CreateFullscreenOpaqueQuad(resource_provider_.get(),
412 CreateFullscreenCheckeredQuad(resource_provider_.get(), 408 pass->shared_quad_state_list.back(), pass.get());
413 pass->shared_quad_state_list.back(),
414 pass.get());
415 409
416 CreateFullscreenCandidateQuad(resource_provider_.get(), 410 CreateFullscreenCandidateQuad(resource_provider_.get(),
417 pass->shared_quad_state_list.back(), 411 pass->shared_quad_state_list.back(),
418 pass.get()); 412 pass.get());
419 413
420 RenderPassList pass_list; 414 RenderPassList pass_list;
421 pass_list.push_back(pass.Pass()); 415 pass_list.push_back(pass.Pass());
422 416
423 RenderPassList original_pass_list; 417 RenderPassList original_pass_list;
424 RenderPass::CopyAll(pass_list, &original_pass_list); 418 RenderPass::CopyAll(pass_list, &original_pass_list);
425 419
426 OverlayCandidateList candidate_list; 420 OverlayCandidateList candidate_list;
427 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 421 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
428 EXPECT_EQ(0U, candidate_list.size()); 422 EXPECT_EQ(0U, candidate_list.size());
429 // There should be nothing new here. 423 // There should be nothing new here.
430 CompareRenderPassLists(pass_list, original_pass_list); 424 CompareRenderPassLists(pass_list, original_pass_list);
431 } 425 }
432 426
433 // Test with multiple render passes. 427 // Test with multiple render passes.
434 TEST_F(SingleOverlayOnTopTest, MultipleRenderPasses) { 428 TEST_F(SingleOverlayOnTopTest, MultipleRenderPasses) {
435 RenderPassList pass_list; 429 RenderPassList pass_list;
436 pass_list.push_back(CreateRenderPass()); 430 pass_list.push_back(CreateRenderPass());
437 431
438 scoped_ptr<RenderPass> pass = CreateRenderPass(); 432 scoped_ptr<RenderPass> pass = CreateRenderPass();
439 CreateFullscreenCandidateQuad(resource_provider_.get(), 433 CreateFullscreenCandidateQuad(resource_provider_.get(),
440 pass->shared_quad_state_list.back(), 434 pass->shared_quad_state_list.back(),
441 pass.get()); 435 pass.get());
442 436
443 // Add something behind it. 437 // Add something behind it.
444 CreateFullscreenCheckeredQuad(resource_provider_.get(), 438 CreateFullscreenOpaqueQuad(resource_provider_.get(),
445 pass->shared_quad_state_list.back(), 439 pass->shared_quad_state_list.back(), pass.get());
446 pass.get()); 440 CreateFullscreenOpaqueQuad(resource_provider_.get(),
447 CreateFullscreenCheckeredQuad(resource_provider_.get(), 441 pass->shared_quad_state_list.back(), pass.get());
448 pass->shared_quad_state_list.back(),
449 pass.get());
450 442
451 pass_list.push_back(pass.Pass()); 443 pass_list.push_back(pass.Pass());
452 444
453 RenderPassList original_pass_list; 445 RenderPassList original_pass_list;
454 RenderPass::CopyAll(pass_list, &original_pass_list); 446 RenderPass::CopyAll(pass_list, &original_pass_list);
455 447
456 // Check for potential candidates. 448 // Check for potential candidates.
457 OverlayCandidateList candidate_list; 449 OverlayCandidateList candidate_list;
458 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 450 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
459 EXPECT_EQ(2U, candidate_list.size()); 451 EXPECT_EQ(2U, candidate_list.size());
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 pass_list.push_back(pass.Pass()); 654 pass_list.push_back(pass.Pass());
663 OverlayCandidateList candidate_list; 655 OverlayCandidateList candidate_list;
664 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 656 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
665 ASSERT_EQ(1U, pass_list.size()); 657 ASSERT_EQ(1U, pass_list.size());
666 ASSERT_EQ(2U, candidate_list.size()); 658 ASSERT_EQ(2U, candidate_list.size());
667 EXPECT_EQ(gfx::OVERLAY_TRANSFORM_ROTATE_270, candidate_list.back().transform); 659 EXPECT_EQ(gfx::OVERLAY_TRANSFORM_ROTATE_270, candidate_list.back().transform);
668 } 660 }
669 661
670 TEST_F(SingleOverlayOnTopTest, AllowNotTopIfNotOccluded) { 662 TEST_F(SingleOverlayOnTopTest, AllowNotTopIfNotOccluded) {
671 scoped_ptr<RenderPass> pass = CreateRenderPass(); 663 scoped_ptr<RenderPass> pass = CreateRenderPass();
672 CreateCheckeredQuadAt(resource_provider_.get(), 664 CreateOpaqueQuadAt(resource_provider_.get(),
673 pass->shared_quad_state_list.back(), 665 pass->shared_quad_state_list.back(), pass.get(),
674 pass.get(), 666 kOverlayTopLeftRect);
675 kOverlayTopLeftRect);
676 CreateCandidateQuadAt(resource_provider_.get(), 667 CreateCandidateQuadAt(resource_provider_.get(),
677 pass->shared_quad_state_list.back(), 668 pass->shared_quad_state_list.back(),
678 pass.get(), 669 pass.get(),
679 kOverlayBottomRightRect); 670 kOverlayBottomRightRect);
680 671
681 RenderPassList pass_list; 672 RenderPassList pass_list;
682 pass_list.push_back(pass.Pass()); 673 pass_list.push_back(pass.Pass());
683 674
684 RenderPassList original_pass_list; 675 RenderPassList original_pass_list;
685 RenderPass::CopyAll(pass_list, &original_pass_list); 676 RenderPass::CopyAll(pass_list, &original_pass_list);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 RenderPassList pass_list; 834 RenderPassList pass_list;
844 pass_list.push_back(pass.Pass()); 835 pass_list.push_back(pass.Pass());
845 OverlayCandidateList candidate_list; 836 OverlayCandidateList candidate_list;
846 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 837 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
847 ASSERT_EQ(1U, pass_list.size()); 838 ASSERT_EQ(1U, pass_list.size());
848 EXPECT_EQ(2U, candidate_list.size()); 839 EXPECT_EQ(2U, candidate_list.size());
849 } 840 }
850 841
851 TEST_F(UnderlayTest, OverlayLayerUnderMainLayer) { 842 TEST_F(UnderlayTest, OverlayLayerUnderMainLayer) {
852 scoped_ptr<RenderPass> pass = CreateRenderPass(); 843 scoped_ptr<RenderPass> pass = CreateRenderPass();
853 CreateFullscreenCheckeredQuad(resource_provider_.get(), 844 CreateFullscreenOpaqueQuad(resource_provider_.get(),
854 pass->shared_quad_state_list.back(), 845 pass->shared_quad_state_list.back(), pass.get());
855 pass.get());
856 CreateCandidateQuadAt(resource_provider_.get(), 846 CreateCandidateQuadAt(resource_provider_.get(),
857 pass->shared_quad_state_list.back(), pass.get(), 847 pass->shared_quad_state_list.back(), pass.get(),
858 kOverlayBottomRightRect); 848 kOverlayBottomRightRect);
859 849
860 RenderPassList pass_list; 850 RenderPassList pass_list;
861 pass_list.push_back(pass.Pass()); 851 pass_list.push_back(pass.Pass());
862 852
863 OverlayCandidateList candidate_list; 853 OverlayCandidateList candidate_list;
864 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 854 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
865 EXPECT_EQ(1U, pass_list.size()); 855 EXPECT_EQ(1U, pass_list.size());
866 ASSERT_EQ(2U, candidate_list.size()); 856 ASSERT_EQ(2U, candidate_list.size());
867 EXPECT_EQ(0, candidate_list[0].plane_z_order); 857 EXPECT_EQ(0, candidate_list[0].plane_z_order);
868 EXPECT_EQ(-1, candidate_list[1].plane_z_order); 858 EXPECT_EQ(-1, candidate_list[1].plane_z_order);
869 EXPECT_EQ(2U, pass_list[0]->quad_list.size()); 859 EXPECT_EQ(2U, pass_list[0]->quad_list.size());
870 // The overlay quad should have changed to a SOLID_COLOR quad. 860 // The overlay quad should have changed to a SOLID_COLOR quad.
871 EXPECT_EQ(pass_list[0]->quad_list.back()->material, DrawQuad::SOLID_COLOR); 861 EXPECT_EQ(pass_list[0]->quad_list.back()->material, DrawQuad::SOLID_COLOR);
872 } 862 }
873 863
874 TEST_F(UnderlayTest, AllowOnTop) { 864 TEST_F(UnderlayTest, AllowOnTop) {
875 scoped_ptr<RenderPass> pass = CreateRenderPass(); 865 scoped_ptr<RenderPass> pass = CreateRenderPass();
876 CreateFullscreenCandidateQuad(resource_provider_.get(), 866 CreateFullscreenCandidateQuad(resource_provider_.get(),
877 pass->shared_quad_state_list.back(), 867 pass->shared_quad_state_list.back(),
878 pass.get()); 868 pass.get());
879 pass->CreateAndAppendSharedQuadState()->opacity = 0.5f; 869 pass->CreateAndAppendSharedQuadState()->opacity = 0.5f;
880 CreateFullscreenCheckeredQuad(resource_provider_.get(), 870 CreateFullscreenOpaqueQuad(resource_provider_.get(),
881 pass->shared_quad_state_list.back(), 871 pass->shared_quad_state_list.back(), pass.get());
882 pass.get());
883 872
884 RenderPassList pass_list; 873 RenderPassList pass_list;
885 pass_list.push_back(pass.Pass()); 874 pass_list.push_back(pass.Pass());
886 875
887 OverlayCandidateList candidate_list; 876 OverlayCandidateList candidate_list;
888 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); 877 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
889 EXPECT_EQ(1U, pass_list.size()); 878 EXPECT_EQ(1U, pass_list.size());
890 ASSERT_EQ(2U, candidate_list.size()); 879 ASSERT_EQ(2U, candidate_list.size());
891 EXPECT_EQ(0, candidate_list[0].plane_z_order); 880 EXPECT_EQ(0, candidate_list[0].plane_z_order);
892 EXPECT_EQ(-1, candidate_list[1].plane_z_order); 881 EXPECT_EQ(-1, candidate_list[1].plane_z_order);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 Init(use_validator); 981 Init(use_validator);
993 renderer_->set_expect_overlays(true); 982 renderer_->set_expect_overlays(true);
994 gfx::Rect viewport_rect(16, 16); 983 gfx::Rect viewport_rect(16, 16);
995 984
996 scoped_ptr<RenderPass> pass = CreateRenderPass(); 985 scoped_ptr<RenderPass> pass = CreateRenderPass();
997 986
998 CreateFullscreenCandidateQuad(resource_provider_.get(), 987 CreateFullscreenCandidateQuad(resource_provider_.get(),
999 pass->shared_quad_state_list.back(), 988 pass->shared_quad_state_list.back(),
1000 pass.get()); 989 pass.get());
1001 990
1002 CreateFullscreenCheckeredQuad(resource_provider_.get(), 991 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1003 pass->shared_quad_state_list.back(), 992 pass->shared_quad_state_list.back(), pass.get());
1004 pass.get()); 993 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1005 CreateFullscreenCheckeredQuad(resource_provider_.get(), 994 pass->shared_quad_state_list.back(), pass.get());
1006 pass->shared_quad_state_list.back(),
1007 pass.get());
1008 995
1009 RenderPassList pass_list; 996 RenderPassList pass_list;
1010 pass_list.push_back(pass.Pass()); 997 pass_list.push_back(pass.Pass());
1011 998
1012 // Candidate pass was taken out and extra skipped pass added, 999 // Candidate pass was taken out and extra skipped pass added,
1013 // so only draw 2 quads. 1000 // so only draw 2 quads.
1014 EXPECT_CALL(*renderer_, DoDrawQuad(_, _, _)).Times(2); 1001 EXPECT_CALL(*renderer_, DoDrawQuad(_, _, _)).Times(2);
1015 EXPECT_CALL(scheduler_, 1002 EXPECT_CALL(scheduler_,
1016 Schedule(1, 1003 Schedule(1,
1017 gfx::OVERLAY_TRANSFORM_NONE, 1004 gfx::OVERLAY_TRANSFORM_NONE,
1018 _, 1005 _,
1019 kOverlayRect, 1006 kOverlayRect,
1020 BoundingRect(kUVTopLeft, kUVBottomRight))).Times(1); 1007 BoundingRect(kUVTopLeft, kUVBottomRight))).Times(1);
1021 renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false); 1008 renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false);
1022 1009
1023 SwapBuffers(); 1010 SwapBuffers();
1024 1011
1025 Mock::VerifyAndClearExpectations(renderer_.get()); 1012 Mock::VerifyAndClearExpectations(renderer_.get());
1026 Mock::VerifyAndClearExpectations(&scheduler_); 1013 Mock::VerifyAndClearExpectations(&scheduler_);
1027 } 1014 }
1028 1015
1029 TEST_F(GLRendererWithOverlaysTest, OccludedQuadInUnderlay) { 1016 TEST_F(GLRendererWithOverlaysTest, OccludedQuadInUnderlay) {
1030 bool use_validator = true; 1017 bool use_validator = true;
1031 Init(use_validator); 1018 Init(use_validator);
1032 renderer_->set_expect_overlays(true); 1019 renderer_->set_expect_overlays(true);
1033 gfx::Rect viewport_rect(16, 16); 1020 gfx::Rect viewport_rect(16, 16);
1034 1021
1035 scoped_ptr<RenderPass> pass = CreateRenderPass(); 1022 scoped_ptr<RenderPass> pass = CreateRenderPass();
1036 1023
1037 CreateFullscreenCheckeredQuad(resource_provider_.get(), 1024 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1038 pass->shared_quad_state_list.back(), 1025 pass->shared_quad_state_list.back(), pass.get());
1039 pass.get()); 1026 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1040 CreateFullscreenCheckeredQuad(resource_provider_.get(), 1027 pass->shared_quad_state_list.back(), pass.get());
1041 pass->shared_quad_state_list.back(),
1042 pass.get());
1043 1028
1044 CreateFullscreenCandidateQuad(resource_provider_.get(), 1029 CreateFullscreenCandidateQuad(resource_provider_.get(),
1045 pass->shared_quad_state_list.back(), 1030 pass->shared_quad_state_list.back(),
1046 pass.get()); 1031 pass.get());
1047 1032
1048 RenderPassList pass_list; 1033 RenderPassList pass_list;
1049 pass_list.push_back(pass.Pass()); 1034 pass_list.push_back(pass.Pass());
1050 1035
1051 // Candidate quad should fail to be overlaid on top because of occlusion. 1036 // Candidate quad should fail to be overlaid on top because of occlusion.
1052 // Expect to be replaced with transparent hole quad and placed in underlay. 1037 // Expect to be replaced with transparent hole quad and placed in underlay.
(...skipping 14 matching lines...) Expand all
1067 Init(use_validator); 1052 Init(use_validator);
1068 renderer_->set_expect_overlays(false); 1053 renderer_->set_expect_overlays(false);
1069 gfx::Rect viewport_rect(16, 16); 1054 gfx::Rect viewport_rect(16, 16);
1070 1055
1071 scoped_ptr<RenderPass> pass = CreateRenderPass(); 1056 scoped_ptr<RenderPass> pass = CreateRenderPass();
1072 1057
1073 CreateFullscreenCandidateQuad(resource_provider_.get(), 1058 CreateFullscreenCandidateQuad(resource_provider_.get(),
1074 pass->shared_quad_state_list.back(), 1059 pass->shared_quad_state_list.back(),
1075 pass.get()); 1060 pass.get());
1076 1061
1077 CreateFullscreenCheckeredQuad(resource_provider_.get(), 1062 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1078 pass->shared_quad_state_list.back(), 1063 pass->shared_quad_state_list.back(), pass.get());
1079 pass.get()); 1064 CreateFullscreenOpaqueQuad(resource_provider_.get(),
1080 CreateFullscreenCheckeredQuad(resource_provider_.get(), 1065 pass->shared_quad_state_list.back(), pass.get());
1081 pass->shared_quad_state_list.back(),
1082 pass.get());
1083 1066
1084 RenderPassList pass_list; 1067 RenderPassList pass_list;
1085 pass_list.push_back(pass.Pass()); 1068 pass_list.push_back(pass.Pass());
1086 1069
1087 // Should see no overlays. 1070 // Should see no overlays.
1088 EXPECT_CALL(*renderer_, DoDrawQuad(_, _, _)).Times(3); 1071 EXPECT_CALL(*renderer_, DoDrawQuad(_, _, _)).Times(3);
1089 EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(0); 1072 EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(0);
1090 renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false); 1073 renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false);
1091 1074
1092 SwapBuffers(); 1075 SwapBuffers();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 renderer_->BeginDrawingFrame(&frame3); 1165 renderer_->BeginDrawingFrame(&frame3);
1183 renderer_->FinishDrawingFrame(&frame3); 1166 renderer_->FinishDrawingFrame(&frame3);
1184 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); 1167 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
1185 SwapBuffers(); 1168 SwapBuffers();
1186 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); 1169 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1));
1187 Mock::VerifyAndClearExpectations(&scheduler_); 1170 Mock::VerifyAndClearExpectations(&scheduler_);
1188 } 1171 }
1189 1172
1190 } // namespace 1173 } // namespace
1191 } // namespace cc 1174 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer_unittest.cc ('k') | cc/output/renderer_pixeltest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698