Chromium Code Reviews| Index: cc/output/overlay_unittest.cc |
| diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc |
| index 87606f5eb64551848e8e6a40f1ffaba0d54c9ba8..7deb53a4b167857d124783a40eecf4340beef80c 100644 |
| --- a/cc/output/overlay_unittest.cc |
| +++ b/cc/output/overlay_unittest.cc |
| @@ -36,6 +36,7 @@ const gfx::Size kDisplaySize(256, 256); |
| const gfx::Rect kOverlayRect(0, 0, 128, 128); |
| const gfx::Rect kOverlayTopLeftRect(0, 0, 64, 64); |
| const gfx::Rect kOverlayBottomRightRect(64, 64, 64, 64); |
| +const gfx::Rect kOverlayClipRect(10, 20, 64, 64); |
| const gfx::PointF kUVTopLeft(0.1f, 0.2f); |
| const gfx::PointF kUVBottomRight(1.0f, 1.0f); |
| const gfx::Transform kNormalTransform = |
| @@ -66,6 +67,9 @@ class SingleOverlayValidator : public OverlayCandidateValidator { |
| ASSERT_EQ(2U, surfaces->size()); |
| OverlayCandidate& candidate = surfaces->back(); |
| + if (candidate.is_clipped && |
|
danakj
2015/09/02 21:50:21
How come this is added here?
william.xie1
2015/09/02 22:04:49
Hi Dana,
cc_unittest uses its own OverlayCandidat
danakj
2015/09/03 22:18:42
How come all the other logic from there isn't repl
|
| + !candidate.clip_rect.Contains(candidate.quad_rect_in_target_space)) |
| + return; |
| if (candidate.display_rect.width() == 64) { |
| EXPECT_EQ(kOverlayBottomRightRect, candidate.display_rect); |
| } else { |
| @@ -748,6 +752,22 @@ TEST_F(SingleOverlayOnTopTest, RejectNonAxisAlignedTransform) { |
| EXPECT_EQ(0U, candidate_list.size()); |
| } |
| +TEST_F(SingleOverlayOnTopTest, RejectClipped) { |
|
danakj
2015/09/02 21:50:21
Is this testing OverlayStrategyCommon or is it jus
william.xie1
2015/09/02 22:04:49
It will test OverlayStrategyCommon because Process
danakj
2015/09/03 22:21:17
OK I think I see.. there is no point in writing a
|
| + scoped_ptr<RenderPass> pass = CreateRenderPass(); |
| + CreateFullscreenCandidateQuad(resource_provider_.get(), |
| + pass->shared_quad_state_list.back(), |
| + pass.get()); |
| + pass->shared_quad_state_list.back()->is_clipped = true; |
| + pass->shared_quad_state_list.back()->clip_rect = kOverlayClipRect; |
|
danakj
2015/09/02 21:50:21
can you test the case where the clip rect exists b
william.xie1
2015/09/02 22:04:49
Done.
|
| + |
| + RenderPassList pass_list; |
| + pass_list.push_back(pass.Pass()); |
| + OverlayCandidateList candidate_list; |
| + overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); |
| + ASSERT_EQ(1U, pass_list.size()); |
| + EXPECT_EQ(0U, candidate_list.size()); |
| +} |
| + |
| TEST_F(SingleOverlayOnTopTest, AllowVerticalFlip) { |
| gfx::Rect rect = kOverlayRect; |
| rect.set_width(rect.width() / 2); |