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

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

Issue 2739473002: cc: Reject non-opaque fullscreen overlay candidates. (Closed)
Patch Set: 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
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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 466
467 RenderPass* main_pass = pass.get(); 467 RenderPass* main_pass = pass.get();
468 // Check that all the quads are gone. 468 // Check that all the quads are gone.
469 EXPECT_EQ(0U, main_pass->quad_list.size()); 469 EXPECT_EQ(0U, main_pass->quad_list.size());
470 // Check that we have only one overlay. 470 // Check that we have only one overlay.
471 EXPECT_EQ(1U, candidate_list.size()); 471 EXPECT_EQ(1U, candidate_list.size());
472 // Check that the right resource id got extracted. 472 // Check that the right resource id got extracted.
473 EXPECT_EQ(original_resource_id, candidate_list.front().resource_id); 473 EXPECT_EQ(original_resource_id, candidate_list.front().resource_id);
474 } 474 }
475 475
476 TEST_F(FullscreenOverlayTest, AlphaFail) {
477 std::unique_ptr<RenderPass> pass = CreateRenderPass();
478 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad(
479 resource_provider_.get(), pass->shared_quad_state_list.back(),
480 pass.get());
481 original_quad->opaque_rect = gfx::Rect(0, 0, 0, 0);
482
483 // Check for potential candidates.
484 OverlayCandidateList candidate_list;
485 RenderPassFilterList render_pass_filters;
486 RenderPassFilterList render_pass_background_filters;
487 overlay_processor_->ProcessForOverlays(
488 resource_provider_.get(), pass.get(), render_pass_filters,
489 render_pass_background_filters, &candidate_list, nullptr, &damage_rect_,
490 &content_bounds_);
491
492 RenderPass* main_pass = pass.get();
493 // Check that all the quads are gone.
494 EXPECT_EQ(1U, main_pass->quad_list.size());
495 // Check that we have only one overlay.
496 EXPECT_EQ(0U, candidate_list.size());
497 }
498
476 TEST_F(FullscreenOverlayTest, ResourceSizeInPixelsFail) { 499 TEST_F(FullscreenOverlayTest, ResourceSizeInPixelsFail) {
477 std::unique_ptr<RenderPass> pass = CreateRenderPass(); 500 std::unique_ptr<RenderPass> pass = CreateRenderPass();
478 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( 501 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad(
479 resource_provider_.get(), pass->shared_quad_state_list.back(), 502 resource_provider_.get(), pass->shared_quad_state_list.back(),
480 pass.get()); 503 pass.get());
481 original_quad->set_resource_size_in_pixels(gfx::Size(64, 64)); 504 original_quad->set_resource_size_in_pixels(gfx::Size(64, 64));
482 505
483 // Check for potential candidates. 506 // Check for potential candidates.
484 OverlayCandidateList candidate_list; 507 OverlayCandidateList candidate_list;
485 RenderPassFilterList render_pass_filters; 508 RenderPassFilterList render_pass_filters;
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 kOverlayRect, render_pass_id_, 2, gfx::RectF(), gfx::Size(), 2314 kOverlayRect, render_pass_id_, 2, gfx::RectF(), gfx::Size(),
2292 gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF()); 2315 gfx::Vector2dF(1, 1), gfx::PointF(), gfx::RectF());
2293 } 2316 }
2294 2317
2295 ProcessForOverlays(); 2318 ProcessForOverlays();
2296 EXPECT_EQ(0U, ca_layer_list_.size()); 2319 EXPECT_EQ(0U, ca_layer_list_.size());
2297 } 2320 }
2298 2321
2299 } // namespace 2322 } // namespace
2300 } // namespace cc 2323 } // namespace cc
OLDNEW
« cc/output/overlay_strategy_fullscreen.cc ('K') | « cc/output/overlay_strategy_fullscreen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698