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

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

Issue 1895873008: cc : Replace LayerImpl::children calls with LayerById (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/layers/texture_layer_unittest.cc ('k') | no next file » | 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 "cc/layers/render_surface_impl.h" 7 #include "cc/layers/render_surface_impl.h"
8 #include "cc/layers/video_layer.h" 8 #include "cc/layers/video_layer.h"
9 #include "cc/layers/video_layer_impl.h" 9 #include "cc/layers/video_layer_impl.h"
10 #include "cc/test/fake_video_frame_provider.h" 10 #include "cc/test/fake_video_frame_provider.h"
(...skipping 14 matching lines...) Expand all
25 scoped_refptr<Layer> root = Layer::Create(); 25 scoped_refptr<Layer> root = Layer::Create();
26 root->SetBounds(gfx::Size(10, 10)); 26 root->SetBounds(gfx::Size(10, 10));
27 root->SetIsDrawable(true); 27 root->SetIsDrawable(true);
28 28
29 scoped_refptr<VideoLayer> video = 29 scoped_refptr<VideoLayer> video =
30 VideoLayer::Create(&video_frame_provider_, media::VIDEO_ROTATION_90); 30 VideoLayer::Create(&video_frame_provider_, media::VIDEO_ROTATION_90);
31 video->SetPosition(gfx::PointF(3.f, 3.f)); 31 video->SetPosition(gfx::PointF(3.f, 3.f));
32 video->SetBounds(gfx::Size(4, 5)); 32 video->SetBounds(gfx::Size(4, 5));
33 video->SetIsDrawable(true); 33 video->SetIsDrawable(true);
34 root->AddChild(video); 34 root->AddChild(video);
35 video_layer_id_ = video->id();
35 36
36 layer_tree_host()->SetRootLayer(root); 37 layer_tree_host()->SetRootLayer(root);
37 layer_tree_host()->SetDeviceScaleFactor(2.f); 38 layer_tree_host()->SetDeviceScaleFactor(2.f);
38 LayerTreeHostVideoTest::SetupTree(); 39 LayerTreeHostVideoTest::SetupTree();
39 } 40 }
40 41
41 void BeginTest() override { 42 void BeginTest() override {
42 num_draws_ = 0; 43 num_draws_ = 0;
43 PostSetNeedsCommitToMainThread(); 44 PostSetNeedsCommitToMainThread();
44 } 45 }
(...skipping 17 matching lines...) Expand all
62 EndTest(); 63 EndTest();
63 break; 64 break;
64 } 65 }
65 66
66 EXPECT_EQ(DRAW_SUCCESS, draw_result); 67 EXPECT_EQ(DRAW_SUCCESS, draw_result);
67 return draw_result; 68 return draw_result;
68 } 69 }
69 70
70 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { 71 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override {
71 VideoLayerImpl* video = static_cast<VideoLayerImpl*>( 72 VideoLayerImpl* video = static_cast<VideoLayerImpl*>(
72 host_impl->active_tree()->root_layer()->children()[0]); 73 host_impl->active_tree()->LayerById(video_layer_id_));
73 74
74 EXPECT_EQ(media::VIDEO_ROTATION_90, video->video_rotation()); 75 EXPECT_EQ(media::VIDEO_ROTATION_90, video->video_rotation());
75 76
76 if (num_draws_ == 0) 77 if (num_draws_ == 0)
77 video->SetNeedsRedraw(); 78 video->SetNeedsRedraw();
78 79
79 ++num_draws_; 80 ++num_draws_;
80 } 81 }
81 82
82 void AfterTest() override { EXPECT_EQ(2, num_draws_); } 83 void AfterTest() override { EXPECT_EQ(2, num_draws_); }
83 84
84 private: 85 private:
85 int num_draws_; 86 int num_draws_;
87 int video_layer_id_;
86 88
87 FakeVideoFrameProvider video_frame_provider_; 89 FakeVideoFrameProvider video_frame_provider_;
88 }; 90 };
89 91
90 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostVideoTestSetNeedsDisplay); 92 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostVideoTestSetNeedsDisplay);
91 93
92 } // namespace 94 } // namespace
93 } // namespace cc 95 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/texture_layer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698