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

Side by Side Diff: cc/trees/layer_tree_host_unittest_video.cc

Issue 628443002: replace OVERRIDE and FINAL with override and final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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/trees/layer_tree_host_unittest_scroll.cc ('k') | cc/trees/layer_tree_impl.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/render_surface_impl.h" 8 #include "cc/layers/render_surface_impl.h"
9 #include "cc/layers/video_layer.h" 9 #include "cc/layers/video_layer.h"
10 #include "cc/layers/video_layer_impl.h" 10 #include "cc/layers/video_layer_impl.h"
11 #include "cc/test/fake_video_frame_provider.h" 11 #include "cc/test/fake_video_frame_provider.h"
12 #include "cc/test/layer_tree_test.h" 12 #include "cc/test/layer_tree_test.h"
13 #include "cc/trees/damage_tracker.h" 13 #include "cc/trees/damage_tracker.h"
14 #include "cc/trees/layer_tree_impl.h" 14 #include "cc/trees/layer_tree_impl.h"
15 15
16 namespace cc { 16 namespace cc {
17 namespace { 17 namespace {
18 18
19 // These tests deal with compositing video. 19 // These tests deal with compositing video.
20 class LayerTreeHostVideoTest : public LayerTreeTest {}; 20 class LayerTreeHostVideoTest : public LayerTreeTest {};
21 21
22 class LayerTreeHostVideoTestSetNeedsDisplay 22 class LayerTreeHostVideoTestSetNeedsDisplay
23 : public LayerTreeHostVideoTest { 23 : public LayerTreeHostVideoTest {
24 public: 24 public:
25 virtual void SetupTree() OVERRIDE { 25 virtual void SetupTree() override {
26 scoped_refptr<Layer> root = Layer::Create(); 26 scoped_refptr<Layer> root = Layer::Create();
27 root->SetBounds(gfx::Size(10, 10)); 27 root->SetBounds(gfx::Size(10, 10));
28 root->SetIsDrawable(true); 28 root->SetIsDrawable(true);
29 29
30 scoped_refptr<VideoLayer> video = 30 scoped_refptr<VideoLayer> video =
31 VideoLayer::Create(&video_frame_provider_, media::VIDEO_ROTATION_90); 31 VideoLayer::Create(&video_frame_provider_, media::VIDEO_ROTATION_90);
32 video->SetPosition(gfx::PointF(3.f, 3.f)); 32 video->SetPosition(gfx::PointF(3.f, 3.f));
33 video->SetBounds(gfx::Size(4, 5)); 33 video->SetBounds(gfx::Size(4, 5));
34 video->SetIsDrawable(true); 34 video->SetIsDrawable(true);
35 root->AddChild(video); 35 root->AddChild(video);
36 36
37 layer_tree_host()->SetRootLayer(root); 37 layer_tree_host()->SetRootLayer(root);
38 layer_tree_host()->SetDeviceScaleFactor(2.f); 38 layer_tree_host()->SetDeviceScaleFactor(2.f);
39 LayerTreeHostVideoTest::SetupTree(); 39 LayerTreeHostVideoTest::SetupTree();
40 } 40 }
41 41
42 virtual void BeginTest() OVERRIDE { 42 virtual void BeginTest() override {
43 num_draws_ = 0; 43 num_draws_ = 0;
44 PostSetNeedsCommitToMainThread(); 44 PostSetNeedsCommitToMainThread();
45 } 45 }
46 46
47 virtual DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl, 47 virtual DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
48 LayerTreeHostImpl::FrameData* frame, 48 LayerTreeHostImpl::FrameData* frame,
49 DrawResult draw_result) OVERRIDE { 49 DrawResult draw_result) override {
50 LayerImpl* root_layer = host_impl->active_tree()->root_layer(); 50 LayerImpl* root_layer = host_impl->active_tree()->root_layer();
51 RenderSurfaceImpl* root_surface = root_layer->render_surface(); 51 RenderSurfaceImpl* root_surface = root_layer->render_surface();
52 gfx::RectF damage_rect = 52 gfx::RectF damage_rect =
53 root_surface->damage_tracker()->current_damage_rect(); 53 root_surface->damage_tracker()->current_damage_rect();
54 54
55 switch (num_draws_) { 55 switch (num_draws_) {
56 case 0: 56 case 0:
57 // First frame the whole viewport is damaged. 57 // First frame the whole viewport is damaged.
58 EXPECT_EQ(gfx::RectF(0.f, 0.f, 20.f, 20.f).ToString(), 58 EXPECT_EQ(gfx::RectF(0.f, 0.f, 20.f, 20.f).ToString(),
59 damage_rect.ToString()); 59 damage_rect.ToString());
60 break; 60 break;
61 case 1: 61 case 1:
62 // Second frame the video layer is damaged. 62 // Second frame the video layer is damaged.
63 EXPECT_EQ(gfx::RectF(6.f, 6.f, 8.f, 10.f).ToString(), 63 EXPECT_EQ(gfx::RectF(6.f, 6.f, 8.f, 10.f).ToString(),
64 damage_rect.ToString()); 64 damage_rect.ToString());
65 EndTest(); 65 EndTest();
66 break; 66 break;
67 } 67 }
68 68
69 EXPECT_EQ(DRAW_SUCCESS, draw_result); 69 EXPECT_EQ(DRAW_SUCCESS, draw_result);
70 return draw_result; 70 return draw_result;
71 } 71 }
72 72
73 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { 73 virtual void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
74 VideoLayerImpl* video = static_cast<VideoLayerImpl*>( 74 VideoLayerImpl* video = static_cast<VideoLayerImpl*>(
75 host_impl->active_tree()->root_layer()->children()[0]); 75 host_impl->active_tree()->root_layer()->children()[0]);
76 76
77 EXPECT_EQ(media::VIDEO_ROTATION_90, video->video_rotation()); 77 EXPECT_EQ(media::VIDEO_ROTATION_90, video->video_rotation());
78 78
79 if (num_draws_ == 0) 79 if (num_draws_ == 0)
80 video->SetNeedsRedraw(); 80 video->SetNeedsRedraw();
81 81
82 ++num_draws_; 82 ++num_draws_;
83 } 83 }
84 84
85 virtual void AfterTest() OVERRIDE { 85 virtual void AfterTest() override {
86 EXPECT_EQ(2, num_draws_); 86 EXPECT_EQ(2, num_draws_);
87 } 87 }
88 88
89 private: 89 private:
90 int num_draws_; 90 int num_draws_;
91 91
92 FakeVideoFrameProvider video_frame_provider_; 92 FakeVideoFrameProvider video_frame_provider_;
93 }; 93 };
94 94
95 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostVideoTestSetNeedsDisplay); 95 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostVideoTestSetNeedsDisplay);
96 96
97 } // namespace 97 } // namespace
98 } // namespace cc 98 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_scroll.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698