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/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_sandwich.h" |
12 #include "cc/output/overlay_strategy_single_on_top.h" | 13 #include "cc/output/overlay_strategy_single_on_top.h" |
13 #include "cc/output/overlay_strategy_underlay.h" | 14 #include "cc/output/overlay_strategy_underlay.h" |
14 #include "cc/quads/render_pass.h" | 15 #include "cc/quads/render_pass.h" |
15 #include "cc/quads/solid_color_draw_quad.h" | 16 #include "cc/quads/solid_color_draw_quad.h" |
16 #include "cc/quads/stream_video_draw_quad.h" | 17 #include "cc/quads/stream_video_draw_quad.h" |
17 #include "cc/quads/texture_draw_quad.h" | 18 #include "cc/quads/texture_draw_quad.h" |
18 #include "cc/resources/resource_provider.h" | 19 #include "cc/resources/resource_provider.h" |
19 #include "cc/resources/texture_mailbox.h" | 20 #include "cc/resources/texture_mailbox.h" |
20 #include "cc/test/fake_output_surface_client.h" | 21 #include "cc/test/fake_output_surface_client.h" |
21 #include "cc/test/fake_resource_provider.h" | 22 #include "cc/test/fake_resource_provider.h" |
22 #include "cc/test/geometry_test_utils.h" | 23 #include "cc/test/geometry_test_utils.h" |
23 #include "cc/test/test_context_provider.h" | 24 #include "cc/test/test_context_provider.h" |
24 #include "cc/test/test_shared_bitmap_manager.h" | 25 #include "cc/test/test_shared_bitmap_manager.h" |
25 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
27 | 28 |
28 using testing::_; | 29 using testing::_; |
29 using testing::Mock; | 30 using testing::Mock; |
30 | 31 |
31 namespace cc { | 32 namespace cc { |
32 namespace { | 33 namespace { |
33 | 34 |
| 35 const gfx::Size kDisplaySize(256, 256); |
34 const gfx::Rect kOverlayRect(0, 0, 128, 128); | 36 const gfx::Rect kOverlayRect(0, 0, 128, 128); |
35 const gfx::Rect kOverlayTopLeftRect(0, 0, 64, 64); | 37 const gfx::Rect kOverlayTopLeftRect(0, 0, 64, 64); |
36 const gfx::Rect kOverlayBottomRightRect(64, 64, 64, 64); | 38 const gfx::Rect kOverlayBottomRightRect(64, 64, 64, 64); |
37 const gfx::PointF kUVTopLeft(0.1f, 0.2f); | 39 const gfx::PointF kUVTopLeft(0.1f, 0.2f); |
38 const gfx::PointF kUVBottomRight(1.0f, 1.0f); | 40 const gfx::PointF kUVBottomRight(1.0f, 1.0f); |
39 const gfx::Transform kNormalTransform = | 41 const gfx::Transform kNormalTransform = |
40 gfx::Transform(0.9f, 0, 0, 0.8f, 0.1f, 0.2f); // x,y -> x,y. | 42 gfx::Transform(0.9f, 0, 0, 0.8f, 0.1f, 0.2f); // x,y -> x,y. |
41 const gfx::Transform kXMirrorTransform = | 43 const gfx::Transform kXMirrorTransform = |
42 gfx::Transform(-0.9f, 0, 0, 0.8f, 1.0f, 0.2f); // x,y -> 1-x,y. | 44 gfx::Transform(-0.9f, 0, 0, 0.8f, 1.0f, 0.2f); // x,y -> 1-x,y. |
43 const gfx::Transform kYMirrorTransform = | 45 const gfx::Transform kYMirrorTransform = |
44 gfx::Transform(0.9f, 0, 0, -0.8f, 0.1f, 1.0f); // x,y -> x,1-y. | 46 gfx::Transform(0.9f, 0, 0, -0.8f, 0.1f, 1.0f); // x,y -> x,1-y. |
45 const gfx::Transform kBothMirrorTransform = | 47 const gfx::Transform kBothMirrorTransform = |
46 gfx::Transform(-0.9f, 0, 0, -0.8f, 1.0f, 1.0f); // x,y -> 1-x,1-y. | 48 gfx::Transform(-0.9f, 0, 0, -0.8f, 1.0f, 1.0f); // x,y -> 1-x,1-y. |
47 const gfx::Transform kSwapTransform = | 49 const gfx::Transform kSwapTransform = |
48 gfx::Transform(0, 1, 1, 0, 0, 0); // x,y -> y,x. | 50 gfx::Transform(0, 1, 1, 0, 0, 0); // x,y -> y,x. |
49 | 51 |
50 void MailboxReleased(unsigned sync_point, | 52 void MailboxReleased(unsigned sync_point, |
51 bool lost_resource, | 53 bool lost_resource, |
52 BlockingTaskRunner* main_thread_task_runner) { | 54 BlockingTaskRunner* main_thread_task_runner) { |
53 } | 55 } |
54 | 56 |
55 class SingleOverlayValidator : public OverlayCandidateValidator { | 57 class SingleOverlayValidator : public OverlayCandidateValidator { |
56 public: | 58 public: |
57 void CheckOverlaySupport(OverlayCandidateList* surfaces) override; | 59 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
| 60 strategies->push_back(scoped_ptr<OverlayProcessor::Strategy>( |
| 61 new OverlayStrategyCommon(this, new OverlayStrategySingleOnTop))); |
| 62 strategies->push_back(scoped_ptr<OverlayProcessor::Strategy>( |
| 63 new OverlayStrategyCommon(this, new OverlayStrategyUnderlay))); |
| 64 } |
| 65 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { |
| 66 ASSERT_EQ(2U, surfaces->size()); |
| 67 |
| 68 OverlayCandidate& candidate = surfaces->back(); |
| 69 if (candidate.display_rect.width() == 64) { |
| 70 EXPECT_EQ(kOverlayBottomRightRect, candidate.display_rect); |
| 71 } else { |
| 72 EXPECT_NEAR(kOverlayRect.x(), candidate.display_rect.x(), 0.01f); |
| 73 EXPECT_NEAR(kOverlayRect.y(), candidate.display_rect.y(), 0.01f); |
| 74 EXPECT_NEAR(kOverlayRect.width(), candidate.display_rect.width(), 0.01f); |
| 75 EXPECT_NEAR(kOverlayRect.height(), candidate.display_rect.height(), |
| 76 0.01f); |
| 77 } |
| 78 EXPECT_EQ(BoundingRect(kUVTopLeft, kUVBottomRight).ToString(), |
| 79 candidate.uv_rect.ToString()); |
| 80 candidate.overlay_handled = true; |
| 81 } |
58 }; | 82 }; |
59 | 83 |
60 void SingleOverlayValidator::CheckOverlaySupport( | 84 class SandwichOverlayValidator : public OverlayCandidateValidator { |
61 OverlayCandidateList* surfaces) { | 85 public: |
62 ASSERT_EQ(2U, surfaces->size()); | 86 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
63 | 87 strategies->push_back(scoped_ptr<OverlayProcessor::Strategy>( |
64 OverlayCandidate& candidate = surfaces->back(); | 88 new OverlayStrategyCommon(this, new OverlayStrategySandwich))); |
65 if (candidate.display_rect.width() == 64) { | |
66 EXPECT_EQ(kOverlayBottomRightRect, candidate.display_rect); | |
67 } else { | |
68 EXPECT_NEAR(kOverlayRect.x(), candidate.display_rect.x(), 0.01f); | |
69 EXPECT_NEAR(kOverlayRect.y(), candidate.display_rect.y(), 0.01f); | |
70 EXPECT_NEAR(kOverlayRect.width(), candidate.display_rect.width(), 0.01f); | |
71 EXPECT_NEAR(kOverlayRect.height(), candidate.display_rect.height(), 0.01f); | |
72 } | 89 } |
73 EXPECT_EQ(BoundingRect(kUVTopLeft, kUVBottomRight).ToString(), | 90 void CheckOverlaySupport(OverlayCandidateList* surfaces) override { |
74 candidate.uv_rect.ToString()); | 91 for (OverlayCandidate& candidate : *surfaces) |
75 candidate.overlay_handled = true; | 92 candidate.overlay_handled = true; |
76 } | 93 } |
| 94 }; |
77 | 95 |
78 template <typename OverlayStrategyType> | 96 template <typename OverlayStrategyType> |
79 class SingleOverlayProcessor : public OverlayProcessor { | 97 class SingleOverlayProcessor : public OverlayProcessor { |
80 public: | 98 public: |
81 explicit SingleOverlayProcessor(OutputSurface* surface) | 99 explicit SingleOverlayProcessor(OutputSurface* surface) |
82 : OverlayProcessor(surface) { | 100 : OverlayProcessor(surface) { |
83 EXPECT_EQ(surface, surface_); | 101 EXPECT_EQ(surface, surface_); |
84 } | 102 } |
85 | 103 |
86 // Virtual to allow testing different strategies. | 104 // Virtual to allow testing different strategies. |
87 void Initialize() override { | 105 void Initialize() override { |
88 OverlayCandidateValidator* candidates = | 106 OverlayCandidateValidator* validator = |
89 surface_->GetOverlayCandidateValidator(); | 107 surface_->GetOverlayCandidateValidator(); |
90 ASSERT_TRUE(candidates != NULL); | 108 ASSERT_TRUE(validator != NULL); |
91 strategies_.push_back( | 109 strategies_.push_back(scoped_ptr<Strategy>( |
92 scoped_ptr<Strategy>(new OverlayStrategyType(candidates))); | 110 new OverlayStrategyCommon(validator, new OverlayStrategyType))); |
93 } | 111 } |
94 }; | 112 }; |
95 | 113 |
96 class DefaultOverlayProcessor : public OverlayProcessor { | 114 class DefaultOverlayProcessor : public OverlayProcessor { |
97 public: | 115 public: |
98 explicit DefaultOverlayProcessor(OutputSurface* surface); | 116 explicit DefaultOverlayProcessor(OutputSurface* surface); |
99 size_t GetStrategyCount(); | 117 size_t GetStrategyCount(); |
100 }; | 118 }; |
101 | 119 |
102 DefaultOverlayProcessor::DefaultOverlayProcessor(OutputSurface* surface) | 120 DefaultOverlayProcessor::DefaultOverlayProcessor(OutputSurface* surface) |
103 : OverlayProcessor(surface) { | 121 : OverlayProcessor(surface) { |
104 } | 122 } |
105 | 123 |
106 size_t DefaultOverlayProcessor::GetStrategyCount() { | 124 size_t DefaultOverlayProcessor::GetStrategyCount() { |
107 return strategies_.size(); | 125 return strategies_.size(); |
108 } | 126 } |
109 | 127 |
110 class OverlayOutputSurface : public OutputSurface { | 128 class OverlayOutputSurface : public OutputSurface { |
111 public: | 129 public: |
112 explicit OverlayOutputSurface(scoped_refptr<ContextProvider> context_provider) | 130 explicit OverlayOutputSurface(scoped_refptr<ContextProvider> context_provider) |
113 : OutputSurface(context_provider) {} | 131 : OutputSurface(context_provider) { |
| 132 surface_size_ = kDisplaySize; |
| 133 device_scale_factor_ = 1; |
| 134 } |
| 135 |
| 136 void SetScaleFactor(float scale_factor) { |
| 137 device_scale_factor_ = scale_factor; |
| 138 } |
114 | 139 |
115 // OutputSurface implementation | 140 // OutputSurface implementation |
116 void SwapBuffers(CompositorFrame* frame) override; | 141 void SwapBuffers(CompositorFrame* frame) override; |
117 | 142 |
118 void InitWithSingleOverlayValidator() { | 143 void InitWithSingleOverlayValidator() { |
119 overlay_candidate_validator_.reset(new SingleOverlayValidator); | 144 overlay_candidate_validator_.reset(new SingleOverlayValidator); |
120 } | 145 } |
| 146 void InitWithSandwichOverlayValidator() { |
| 147 overlay_candidate_validator_.reset(new SandwichOverlayValidator); |
| 148 } |
121 | 149 |
122 OverlayCandidateValidator* GetOverlayCandidateValidator() const override { | 150 OverlayCandidateValidator* GetOverlayCandidateValidator() const override { |
123 return overlay_candidate_validator_.get(); | 151 return overlay_candidate_validator_.get(); |
124 } | 152 } |
125 | 153 |
126 private: | 154 private: |
127 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; | 155 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; |
128 }; | 156 }; |
129 | 157 |
130 void OverlayOutputSurface::SwapBuffers(CompositorFrame* frame) { | 158 void OverlayOutputSurface::SwapBuffers(CompositorFrame* frame) { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 scoped_ptr<OverlayOutputSurface> output_surface_; | 363 scoped_ptr<OverlayOutputSurface> output_surface_; |
336 FakeOutputSurfaceClient client_; | 364 FakeOutputSurfaceClient client_; |
337 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; | 365 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
338 scoped_ptr<ResourceProvider> resource_provider_; | 366 scoped_ptr<ResourceProvider> resource_provider_; |
339 scoped_ptr<SingleOverlayProcessor<OverlayStrategyType>> overlay_processor_; | 367 scoped_ptr<SingleOverlayProcessor<OverlayStrategyType>> overlay_processor_; |
340 }; | 368 }; |
341 | 369 |
342 typedef OverlayTest<OverlayStrategySingleOnTop> SingleOverlayOnTopTest; | 370 typedef OverlayTest<OverlayStrategySingleOnTop> SingleOverlayOnTopTest; |
343 typedef OverlayTest<OverlayStrategyUnderlay> UnderlayTest; | 371 typedef OverlayTest<OverlayStrategyUnderlay> UnderlayTest; |
344 | 372 |
| 373 class SandwichTest : public testing::Test { |
| 374 protected: |
| 375 void SetUp() override { |
| 376 provider_ = TestContextProvider::Create(); |
| 377 output_surface_.reset(new OverlayOutputSurface(provider_)); |
| 378 EXPECT_TRUE(output_surface_->BindToClient(&client_)); |
| 379 output_surface_->InitWithSandwichOverlayValidator(); |
| 380 EXPECT_TRUE(output_surface_->GetOverlayCandidateValidator() != NULL); |
| 381 |
| 382 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
| 383 resource_provider_ = FakeResourceProvider::Create( |
| 384 output_surface_.get(), shared_bitmap_manager_.get()); |
| 385 |
| 386 overlay_processor_.reset(new OverlayProcessor(output_surface_.get())); |
| 387 overlay_processor_->Initialize(); |
| 388 } |
| 389 |
| 390 scoped_refptr<TestContextProvider> provider_; |
| 391 scoped_ptr<OverlayOutputSurface> output_surface_; |
| 392 FakeOutputSurfaceClient client_; |
| 393 scoped_ptr<SharedBitmapManager> shared_bitmap_manager_; |
| 394 scoped_ptr<ResourceProvider> resource_provider_; |
| 395 scoped_ptr<OverlayProcessor> overlay_processor_; |
| 396 }; |
| 397 |
| 398 TEST_F(SandwichTest, SuccessfulSingleOverlay) { |
| 399 scoped_ptr<RenderPass> pass = CreateRenderPass(); |
| 400 TextureDrawQuad* original_quad = CreateFullscreenCandidateQuad( |
| 401 resource_provider_.get(), pass->shared_quad_state_list.back(), |
| 402 pass.get()); |
| 403 unsigned original_resource_id = original_quad->resource_id(); |
| 404 |
| 405 // Add something behind it. |
| 406 CreateFullscreenOpaqueQuad(resource_provider_.get(), |
| 407 pass->shared_quad_state_list.back(), pass.get()); |
| 408 CreateFullscreenOpaqueQuad(resource_provider_.get(), |
| 409 pass->shared_quad_state_list.back(), pass.get()); |
| 410 |
| 411 RenderPassList pass_list; |
| 412 pass_list.push_back(pass.Pass()); |
| 413 |
| 414 // Check for potential candidates. |
| 415 OverlayCandidateList candidate_list; |
| 416 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); |
| 417 |
| 418 ASSERT_EQ(1U, pass_list.size()); |
| 419 ASSERT_EQ(2U, candidate_list.size()); |
| 420 |
| 421 RenderPass* main_pass = pass_list.back(); |
| 422 // Check that the quad is gone. |
| 423 EXPECT_EQ(2U, main_pass->quad_list.size()); |
| 424 const QuadList& quad_list = main_pass->quad_list; |
| 425 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
| 426 it != quad_list.BackToFrontEnd(); ++it) { |
| 427 EXPECT_NE(DrawQuad::TEXTURE_CONTENT, it->material); |
| 428 } |
| 429 |
| 430 // Check that the right resource id got extracted. |
| 431 EXPECT_EQ(original_resource_id, candidate_list.back().resource_id); |
| 432 } |
| 433 |
| 434 TEST_F(SandwichTest, SuccessfulSandwichOverlay) { |
| 435 scoped_ptr<RenderPass> pass = CreateRenderPass(); |
| 436 |
| 437 CreateOpaqueQuadAt(resource_provider_.get(), |
| 438 pass->shared_quad_state_list.back(), pass.get(), |
| 439 gfx::Rect(16, 16, 32, 32)); |
| 440 unsigned candidate_id = |
| 441 CreateCandidateQuadAt(resource_provider_.get(), |
| 442 pass->shared_quad_state_list.back(), pass.get(), |
| 443 gfx::Rect(32, 32, 32, 32)) |
| 444 ->resource_id(); |
| 445 CreateOpaqueQuadAt(resource_provider_.get(), |
| 446 pass->shared_quad_state_list.back(), pass.get(), |
| 447 gfx::Rect(kDisplaySize)); |
| 448 |
| 449 RenderPassList pass_list; |
| 450 pass_list.push_back(pass.Pass()); |
| 451 |
| 452 // Check for potential candidates. |
| 453 OverlayCandidateList candidate_list; |
| 454 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); |
| 455 |
| 456 ASSERT_EQ(1U, pass_list.size()); |
| 457 ASSERT_EQ(3U, candidate_list.size()); |
| 458 |
| 459 RenderPass* main_pass = pass_list.back(); |
| 460 // Check that the quad is gone. |
| 461 EXPECT_EQ(3U, main_pass->quad_list.size()); |
| 462 const QuadList& quad_list = main_pass->quad_list; |
| 463 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
| 464 it != quad_list.BackToFrontEnd(); ++it) { |
| 465 EXPECT_NE(DrawQuad::TEXTURE_CONTENT, it->material); |
| 466 } |
| 467 |
| 468 EXPECT_FALSE(candidate_list[0].use_output_surface_for_resource); |
| 469 EXPECT_EQ(candidate_id, candidate_list[1].resource_id); |
| 470 EXPECT_EQ(gfx::Rect(32, 32, 32, 32), candidate_list[1].display_rect); |
| 471 EXPECT_TRUE(candidate_list[2].use_output_surface_for_resource); |
| 472 EXPECT_EQ(gfx::Rect(32, 32, 16, 16), candidate_list[2].display_rect); |
| 473 EXPECT_EQ(gfx::RectF(32. / 256, 32. / 256, 16. / 256, 16. / 256), |
| 474 candidate_list[2].uv_rect); |
| 475 } |
| 476 |
| 477 TEST_F(SandwichTest, GrowTopOverlayForToAlignWithDIP) { |
| 478 output_surface_->SetScaleFactor(2); |
| 479 scoped_ptr<RenderPass> pass = CreateRenderPass(); |
| 480 |
| 481 // The opaque quad on top is not DIP aligned, so it should be enlarged to |
| 482 // include the surrounding DIP. |
| 483 CreateOpaqueQuadAt(resource_provider_.get(), |
| 484 pass->shared_quad_state_list.back(), pass.get(), |
| 485 gfx::Rect(16, 16, 33, 33)); |
| 486 unsigned candidate_id = |
| 487 CreateCandidateQuadAt(resource_provider_.get(), |
| 488 pass->shared_quad_state_list.back(), pass.get(), |
| 489 gfx::Rect(32, 32, 32, 32)) |
| 490 ->resource_id(); |
| 491 CreateOpaqueQuadAt(resource_provider_.get(), |
| 492 pass->shared_quad_state_list.back(), pass.get(), |
| 493 gfx::Rect(kDisplaySize)); |
| 494 |
| 495 RenderPassList pass_list; |
| 496 pass_list.push_back(pass.Pass()); |
| 497 |
| 498 // Check for potential candidates. |
| 499 OverlayCandidateList candidate_list; |
| 500 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); |
| 501 ASSERT_EQ(1U, pass_list.size()); |
| 502 ASSERT_EQ(3U, candidate_list.size()); |
| 503 |
| 504 // Check that the quad is gone. |
| 505 RenderPass* main_pass = pass_list.back(); |
| 506 EXPECT_EQ(3U, main_pass->quad_list.size()); |
| 507 const QuadList& quad_list = main_pass->quad_list; |
| 508 for (QuadList::ConstBackToFrontIterator it = quad_list.BackToFrontBegin(); |
| 509 it != quad_list.BackToFrontEnd(); ++it) { |
| 510 EXPECT_NE(DrawQuad::TEXTURE_CONTENT, it->material); |
| 511 } |
| 512 |
| 513 EXPECT_FALSE(candidate_list[0].use_output_surface_for_resource); |
| 514 EXPECT_EQ(candidate_id, candidate_list[1].resource_id); |
| 515 EXPECT_EQ(gfx::Rect(32, 32, 32, 32), candidate_list[1].display_rect); |
| 516 EXPECT_TRUE(candidate_list[2].use_output_surface_for_resource); |
| 517 EXPECT_EQ(gfx::Rect(32, 32, 18, 18), candidate_list[2].display_rect); |
| 518 EXPECT_EQ(gfx::RectF(32. / 256, 32. / 256, 18. / 256, 18. / 256), |
| 519 candidate_list[2].uv_rect); |
| 520 } |
| 521 |
| 522 TEST_F(SandwichTest, MisalignedOverlay) { |
| 523 output_surface_->SetScaleFactor(2); |
| 524 scoped_ptr<RenderPass> pass = CreateRenderPass(); |
| 525 |
| 526 // We can't create an overlay for a candidate that is not DIP aligned. |
| 527 CreateCandidateQuadAt(resource_provider_.get(), |
| 528 pass->shared_quad_state_list.back(), pass.get(), |
| 529 gfx::Rect(32, 32, 33, 33)) |
| 530 ->resource_id(); |
| 531 CreateOpaqueQuadAt(resource_provider_.get(), |
| 532 pass->shared_quad_state_list.back(), pass.get(), |
| 533 gfx::Rect(kDisplaySize)); |
| 534 |
| 535 RenderPassList pass_list; |
| 536 pass_list.push_back(pass.Pass()); |
| 537 |
| 538 OverlayCandidateList candidate_list; |
| 539 overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list); |
| 540 |
| 541 ASSERT_EQ(1U, pass_list.size()); |
| 542 ASSERT_EQ(0U, candidate_list.size()); |
| 543 } |
| 544 |
345 TEST_F(SingleOverlayOnTopTest, SuccessfullOverlay) { | 545 TEST_F(SingleOverlayOnTopTest, SuccessfullOverlay) { |
346 scoped_ptr<RenderPass> pass = CreateRenderPass(); | 546 scoped_ptr<RenderPass> pass = CreateRenderPass(); |
347 TextureDrawQuad* original_quad = | 547 TextureDrawQuad* original_quad = |
348 CreateFullscreenCandidateQuad(resource_provider_.get(), | 548 CreateFullscreenCandidateQuad(resource_provider_.get(), |
349 pass->shared_quad_state_list.back(), | 549 pass->shared_quad_state_list.back(), |
350 pass.get()); | 550 pass.get()); |
351 unsigned original_resource_id = original_quad->resource_id(); | 551 unsigned original_resource_id = original_quad->resource_id(); |
352 | 552 |
353 // Add something behind it. | 553 // Add something behind it. |
354 CreateFullscreenOpaqueQuad(resource_provider_.get(), | 554 CreateFullscreenOpaqueQuad(resource_provider_.get(), |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 renderer_->BeginDrawingFrame(&frame3); | 1365 renderer_->BeginDrawingFrame(&frame3); |
1166 renderer_->FinishDrawingFrame(&frame3); | 1366 renderer_->FinishDrawingFrame(&frame3); |
1167 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); | 1367 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); |
1168 SwapBuffers(); | 1368 SwapBuffers(); |
1169 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); | 1369 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); |
1170 Mock::VerifyAndClearExpectations(&scheduler_); | 1370 Mock::VerifyAndClearExpectations(&scheduler_); |
1171 } | 1371 } |
1172 | 1372 |
1173 } // namespace | 1373 } // namespace |
1174 } // namespace cc | 1374 } // namespace cc |
OLD | NEW |