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/gl_renderer.h" | 6 #include "cc/output/gl_renderer.h" |
7 #include "cc/output/output_surface.h" | 7 #include "cc/output/output_surface.h" |
8 #include "cc/output/output_surface_client.h" | 8 #include "cc/output/output_surface_client.h" |
9 #include "cc/output/overlay_candidate_validator.h" | 9 #include "cc/output/overlay_candidate_validator.h" |
10 #include "cc/output/overlay_processor.h" | 10 #include "cc/output/overlay_processor.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 const gfx::PointF kUVTopLeft(0.1f, 0.2f); | 33 const gfx::PointF kUVTopLeft(0.1f, 0.2f); |
34 const gfx::PointF kUVBottomRight(1.0f, 1.0f); | 34 const gfx::PointF kUVBottomRight(1.0f, 1.0f); |
35 | 35 |
36 void MailboxReleased(unsigned sync_point, | 36 void MailboxReleased(unsigned sync_point, |
37 bool lost_resource, | 37 bool lost_resource, |
38 BlockingTaskRunner* main_thread_task_runner) { | 38 BlockingTaskRunner* main_thread_task_runner) { |
39 } | 39 } |
40 | 40 |
41 class SingleOverlayValidator : public OverlayCandidateValidator { | 41 class SingleOverlayValidator : public OverlayCandidateValidator { |
42 public: | 42 public: |
43 virtual void CheckOverlaySupport(OverlayCandidateList* surfaces) OVERRIDE; | 43 virtual void CheckOverlaySupport(OverlayCandidateList* surfaces) override; |
44 }; | 44 }; |
45 | 45 |
46 void SingleOverlayValidator::CheckOverlaySupport( | 46 void SingleOverlayValidator::CheckOverlaySupport( |
47 OverlayCandidateList* surfaces) { | 47 OverlayCandidateList* surfaces) { |
48 ASSERT_EQ(2U, surfaces->size()); | 48 ASSERT_EQ(2U, surfaces->size()); |
49 | 49 |
50 OverlayCandidate& candidate = surfaces->back(); | 50 OverlayCandidate& candidate = surfaces->back(); |
51 if (candidate.display_rect.width() == 64) | 51 if (candidate.display_rect.width() == 64) |
52 EXPECT_EQ(kOverlayBottomRightRect, candidate.display_rect); | 52 EXPECT_EQ(kOverlayBottomRightRect, candidate.display_rect); |
53 else | 53 else |
54 EXPECT_EQ(kOverlayRect, candidate.display_rect); | 54 EXPECT_EQ(kOverlayRect, candidate.display_rect); |
55 EXPECT_EQ(BoundingRect(kUVTopLeft, kUVBottomRight).ToString(), | 55 EXPECT_EQ(BoundingRect(kUVTopLeft, kUVBottomRight).ToString(), |
56 candidate.uv_rect.ToString()); | 56 candidate.uv_rect.ToString()); |
57 candidate.overlay_handled = true; | 57 candidate.overlay_handled = true; |
58 } | 58 } |
59 | 59 |
60 class SingleOverlayProcessor : public OverlayProcessor { | 60 class SingleOverlayProcessor : public OverlayProcessor { |
61 public: | 61 public: |
62 SingleOverlayProcessor(OutputSurface* surface, | 62 SingleOverlayProcessor(OutputSurface* surface, |
63 ResourceProvider* resource_provider); | 63 ResourceProvider* resource_provider); |
64 // Virtual to allow testing different strategies. | 64 // Virtual to allow testing different strategies. |
65 virtual void Initialize() OVERRIDE; | 65 virtual void Initialize() override; |
66 }; | 66 }; |
67 | 67 |
68 SingleOverlayProcessor::SingleOverlayProcessor( | 68 SingleOverlayProcessor::SingleOverlayProcessor( |
69 OutputSurface* surface, | 69 OutputSurface* surface, |
70 ResourceProvider* resource_provider) | 70 ResourceProvider* resource_provider) |
71 : OverlayProcessor(surface, resource_provider) { | 71 : OverlayProcessor(surface, resource_provider) { |
72 EXPECT_EQ(surface, surface_); | 72 EXPECT_EQ(surface, surface_); |
73 EXPECT_EQ(resource_provider, resource_provider_); | 73 EXPECT_EQ(resource_provider, resource_provider_); |
74 } | 74 } |
75 | 75 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 : GLRenderer(client, | 522 : GLRenderer(client, |
523 settings, | 523 settings, |
524 output_surface, | 524 output_surface, |
525 resource_provider, | 525 resource_provider, |
526 NULL, | 526 NULL, |
527 0), | 527 0), |
528 expect_overlays_(false) {} | 528 expect_overlays_(false) {} |
529 | 529 |
530 MOCK_METHOD2(DoDrawQuad, void(DrawingFrame* frame, const DrawQuad* quad)); | 530 MOCK_METHOD2(DoDrawQuad, void(DrawingFrame* frame, const DrawQuad* quad)); |
531 | 531 |
532 virtual void FinishDrawingFrame(DrawingFrame* frame) OVERRIDE { | 532 virtual void FinishDrawingFrame(DrawingFrame* frame) override { |
533 GLRenderer::FinishDrawingFrame(frame); | 533 GLRenderer::FinishDrawingFrame(frame); |
534 | 534 |
535 if (!expect_overlays_) { | 535 if (!expect_overlays_) { |
536 EXPECT_EQ(0U, frame->overlay_list.size()); | 536 EXPECT_EQ(0U, frame->overlay_list.size()); |
537 return; | 537 return; |
538 } | 538 } |
539 | 539 |
540 ASSERT_EQ(2U, frame->overlay_list.size()); | 540 ASSERT_EQ(2U, frame->overlay_list.size()); |
541 EXPECT_NE(0U, frame->overlay_list.back().resource_id); | 541 EXPECT_NE(0U, frame->overlay_list.back().resource_id); |
542 } | 542 } |
543 | 543 |
544 void set_expect_overlays(bool expect_overlays) { | 544 void set_expect_overlays(bool expect_overlays) { |
545 expect_overlays_ = expect_overlays; | 545 expect_overlays_ = expect_overlays; |
546 } | 546 } |
547 | 547 |
548 private: | 548 private: |
549 bool expect_overlays_; | 549 bool expect_overlays_; |
550 }; | 550 }; |
551 | 551 |
552 class FakeRendererClient : public RendererClient { | 552 class FakeRendererClient : public RendererClient { |
553 public: | 553 public: |
554 // RendererClient methods. | 554 // RendererClient methods. |
555 virtual void SetFullRootLayerDamage() OVERRIDE {} | 555 virtual void SetFullRootLayerDamage() override {} |
556 }; | 556 }; |
557 | 557 |
558 class MockOverlayScheduler { | 558 class MockOverlayScheduler { |
559 public: | 559 public: |
560 MOCK_METHOD5(Schedule, | 560 MOCK_METHOD5(Schedule, |
561 void(int plane_z_order, | 561 void(int plane_z_order, |
562 gfx::OverlayTransform plane_transform, | 562 gfx::OverlayTransform plane_transform, |
563 unsigned overlay_texture_id, | 563 unsigned overlay_texture_id, |
564 const gfx::Rect& display_bounds, | 564 const gfx::Rect& display_bounds, |
565 const gfx::RectF& uv_rect)); | 565 const gfx::RectF& uv_rect)); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 renderer_->set_expect_overlays(false); | 781 renderer_->set_expect_overlays(false); |
782 renderer_->FinishDrawingFrame(&frame3); | 782 renderer_->FinishDrawingFrame(&frame3); |
783 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); | 783 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); |
784 SwapBuffers(); | 784 SwapBuffers(); |
785 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); | 785 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); |
786 Mock::VerifyAndClearExpectations(&scheduler_); | 786 Mock::VerifyAndClearExpectations(&scheduler_); |
787 } | 787 } |
788 | 788 |
789 } // namespace | 789 } // namespace |
790 } // namespace cc | 790 } // namespace cc |
OLD | NEW |