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

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

Issue 645853008: Standardize usage of virtual/override/final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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_single_on_top.h ('k') | cc/output/renderer_unittest.cc » ('j') | 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 "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
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 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 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 20 matching lines...) Expand all
96 size_t DefaultOverlayProcessor::GetStrategyCount() { 96 size_t DefaultOverlayProcessor::GetStrategyCount() {
97 return strategies_.size(); 97 return strategies_.size();
98 } 98 }
99 99
100 class OverlayOutputSurface : public OutputSurface { 100 class OverlayOutputSurface : public OutputSurface {
101 public: 101 public:
102 explicit OverlayOutputSurface(scoped_refptr<ContextProvider> context_provider) 102 explicit OverlayOutputSurface(scoped_refptr<ContextProvider> context_provider)
103 : OutputSurface(context_provider) {} 103 : OutputSurface(context_provider) {}
104 104
105 // OutputSurface implementation 105 // OutputSurface implementation
106 virtual void SwapBuffers(CompositorFrame* frame) override; 106 void SwapBuffers(CompositorFrame* frame) override;
107 107
108 void InitWithSingleOverlayValidator() { 108 void InitWithSingleOverlayValidator() {
109 overlay_candidate_validator_.reset(new SingleOverlayValidator); 109 overlay_candidate_validator_.reset(new SingleOverlayValidator);
110 } 110 }
111 }; 111 };
112 112
113 void OverlayOutputSurface::SwapBuffers(CompositorFrame* frame) { 113 void OverlayOutputSurface::SwapBuffers(CompositorFrame* frame) {
114 client_->DidSwapBuffers(); 114 client_->DidSwapBuffers();
115 client_->DidSwapBuffersComplete(); 115 client_->DidSwapBuffersComplete();
116 } 116 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 expect_overlays_ = expect_overlays; 561 expect_overlays_ = expect_overlays;
562 } 562 }
563 563
564 private: 564 private:
565 bool expect_overlays_; 565 bool expect_overlays_;
566 }; 566 };
567 567
568 class FakeRendererClient : public RendererClient { 568 class FakeRendererClient : public RendererClient {
569 public: 569 public:
570 // RendererClient methods. 570 // RendererClient methods.
571 virtual void SetFullRootLayerDamage() override {} 571 void SetFullRootLayerDamage() override {}
572 }; 572 };
573 573
574 class MockOverlayScheduler { 574 class MockOverlayScheduler {
575 public: 575 public:
576 MOCK_METHOD5(Schedule, 576 MOCK_METHOD5(Schedule,
577 void(int plane_z_order, 577 void(int plane_z_order,
578 gfx::OverlayTransform plane_transform, 578 gfx::OverlayTransform plane_transform,
579 unsigned overlay_texture_id, 579 unsigned overlay_texture_id,
580 const gfx::Rect& display_bounds, 580 const gfx::Rect& display_bounds,
581 const gfx::RectF& uv_rect)); 581 const gfx::RectF& uv_rect));
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 renderer_->set_expect_overlays(false); 797 renderer_->set_expect_overlays(false);
798 renderer_->FinishDrawingFrame(&frame3); 798 renderer_->FinishDrawingFrame(&frame3);
799 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1)); 799 EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
800 SwapBuffers(); 800 SwapBuffers();
801 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1)); 801 EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1));
802 Mock::VerifyAndClearExpectations(&scheduler_); 802 Mock::VerifyAndClearExpectations(&scheduler_);
803 } 803 }
804 804
805 } // namespace 805 } // namespace
806 } // namespace cc 806 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_strategy_single_on_top.h ('k') | cc/output/renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698