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

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

Issue 2739473002: cc: Reject non-opaque fullscreen overlay candidates. (Closed)
Patch Set: Rebase on master. 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 unified diff | Download patch
« no previous file with comments | « cc/output/overlay_strategy_fullscreen.cc ('k') | no next file » | 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 500
501 RenderPass* main_pass = pass.get(); 501 RenderPass* main_pass = pass.get();
502 // Check that all the quads are gone. 502 // Check that all the quads are gone.
503 EXPECT_EQ(0U, main_pass->quad_list.size()); 503 EXPECT_EQ(0U, main_pass->quad_list.size());
504 // Check that we have only one overlay. 504 // Check that we have only one overlay.
505 EXPECT_EQ(1U, candidate_list.size()); 505 EXPECT_EQ(1U, candidate_list.size());
506 // Check that the right resource id got extracted. 506 // Check that the right resource id got extracted.
507 EXPECT_EQ(original_resource_id, candidate_list.front().resource_id); 507 EXPECT_EQ(original_resource_id, candidate_list.front().resource_id);
508 } 508 }
509 509
510 TEST_F(FullscreenOverlayTest, AlphaFail) {
511 std::unique_ptr<RenderPass> pass = CreateRenderPass();
512 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad(
513 resource_provider_.get(), pass->shared_quad_state_list.back(),
514 pass.get());
515 original_quad->opaque_rect = gfx::Rect(0, 0, 0, 0);
516
517 // Check for potential candidates.
518 OverlayCandidateList candidate_list;
519 RenderPassFilterList render_pass_filters;
520 RenderPassFilterList render_pass_background_filters;
521 overlay_processor_->ProcessForOverlays(
522 resource_provider_.get(), pass.get(), render_pass_filters,
523 render_pass_background_filters, &candidate_list, nullptr, nullptr,
524 &damage_rect_, &content_bounds_);
525
526 RenderPass* main_pass = pass.get();
527 // Check that all the quads are gone.
528 EXPECT_EQ(1U, main_pass->quad_list.size());
529 // Check that we have only one overlay.
530 EXPECT_EQ(0U, candidate_list.size());
531 }
532
510 TEST_F(FullscreenOverlayTest, ResourceSizeInPixelsFail) { 533 TEST_F(FullscreenOverlayTest, ResourceSizeInPixelsFail) {
511 std::unique_ptr<RenderPass> pass = CreateRenderPass(); 534 std::unique_ptr<RenderPass> pass = CreateRenderPass();
512 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( 535 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad(
513 resource_provider_.get(), pass->shared_quad_state_list.back(), 536 resource_provider_.get(), pass->shared_quad_state_list.back(),
514 pass.get()); 537 pass.get());
515 original_quad->set_resource_size_in_pixels(gfx::Size(64, 64)); 538 original_quad->set_resource_size_in_pixels(gfx::Size(64, 64));
516 539
517 // Check for potential candidates. 540 // Check for potential candidates.
518 OverlayCandidateList candidate_list; 541 OverlayCandidateList candidate_list;
519 RenderPassFilterList render_pass_filters; 542 RenderPassFilterList render_pass_filters;
(...skipping 1913 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 kOverlayRect, render_pass_id_, 2, gfx::RectF(), gfx::Size(), 2456 kOverlayRect, render_pass_id_, 2, gfx::RectF(), gfx::Size(),
2434 gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF()); 2457 gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF());
2435 } 2458 }
2436 2459
2437 ProcessForOverlays(); 2460 ProcessForOverlays();
2438 EXPECT_EQ(0U, ca_layer_list_.size()); 2461 EXPECT_EQ(0U, ca_layer_list_.size());
2439 } 2462 }
2440 2463
2441 } // namespace 2464 } // namespace
2442 } // namespace cc 2465 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_strategy_fullscreen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698