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

Side by Side Diff: cc/layers/layer_impl_unittest.cc

Issue 609663003: cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cc-passas: PassAs-presubmit-warning 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/layers/layer_impl.cc ('k') | cc/layers/layer_perftest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "cc/layers/painted_scrollbar_layer_impl.h" 7 #include "cc/layers/painted_scrollbar_layer_impl.h"
8 #include "cc/output/filter_operation.h" 8 #include "cc/output/filter_operation.h"
9 #include "cc/output/filter_operations.h" 9 #include "cc/output/filter_operations.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { 79 TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
80 // 80 //
81 // This test checks that layerPropertyChanged() has the correct behavior. 81 // This test checks that layerPropertyChanged() has the correct behavior.
82 // 82 //
83 83
84 // The constructor on this will fake that we are on the correct thread. 84 // The constructor on this will fake that we are on the correct thread.
85 // Create a simple LayerImpl tree: 85 // Create a simple LayerImpl tree:
86 FakeImplProxy proxy; 86 FakeImplProxy proxy;
87 TestSharedBitmapManager shared_bitmap_manager; 87 TestSharedBitmapManager shared_bitmap_manager;
88 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 88 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
89 EXPECT_TRUE(host_impl.InitializeRenderer( 89 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
90 FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
91 scoped_ptr<LayerImpl> root_clip = 90 scoped_ptr<LayerImpl> root_clip =
92 LayerImpl::Create(host_impl.active_tree(), 1); 91 LayerImpl::Create(host_impl.active_tree(), 1);
93 scoped_ptr<LayerImpl> root_ptr = 92 scoped_ptr<LayerImpl> root_ptr =
94 LayerImpl::Create(host_impl.active_tree(), 2); 93 LayerImpl::Create(host_impl.active_tree(), 2);
95 LayerImpl* root = root_ptr.get(); 94 LayerImpl* root = root_ptr.get();
96 root_clip->AddChild(root_ptr.Pass()); 95 root_clip->AddChild(root_ptr.Pass());
97 scoped_ptr<LayerImpl> scroll_parent = 96 scoped_ptr<LayerImpl> scroll_parent =
98 LayerImpl::Create(host_impl.active_tree(), 3); 97 LayerImpl::Create(host_impl.active_tree(), 3);
99 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get(); 98 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get();
100 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>(); 99 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 239 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
241 root->SetClipParent(clip_parent.get())); 240 root->SetClipParent(clip_parent.get()));
242 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 241 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
243 root->SetClipChildren(clip_children)); 242 root->SetClipChildren(clip_children));
244 } 243 }
245 244
246 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { 245 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
247 FakeImplProxy proxy; 246 FakeImplProxy proxy;
248 TestSharedBitmapManager shared_bitmap_manager; 247 TestSharedBitmapManager shared_bitmap_manager;
249 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 248 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
250 EXPECT_TRUE(host_impl.InitializeRenderer( 249 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
251 FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
252 host_impl.active_tree()->SetRootLayer( 250 host_impl.active_tree()->SetRootLayer(
253 LayerImpl::Create(host_impl.active_tree(), 1)); 251 LayerImpl::Create(host_impl.active_tree(), 1));
254 LayerImpl* root = host_impl.active_tree()->root_layer(); 252 LayerImpl* root = host_impl.active_tree()->root_layer();
255 scoped_ptr<LayerImpl> layer_ptr = 253 scoped_ptr<LayerImpl> layer_ptr =
256 LayerImpl::Create(host_impl.active_tree(), 2); 254 LayerImpl::Create(host_impl.active_tree(), 2);
257 LayerImpl* layer = layer_ptr.get(); 255 LayerImpl* layer = layer_ptr.get();
258 root->AddChild(layer_ptr.Pass()); 256 root->AddChild(layer_ptr.Pass());
259 layer->SetScrollClipLayer(root->id()); 257 layer->SetScrollClipLayer(root->id());
260 DCHECK(host_impl.CanDraw()); 258 DCHECK(host_impl.CanDraw());
261 259
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 layer->SetIsRootForIsolatedGroup(true)); 348 layer->SetIsRootForIsolatedGroup(true));
351 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 349 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
352 layer->SetTransform(arbitrary_transform)); 350 layer->SetTransform(arbitrary_transform));
353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 351 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
354 } 352 }
355 353
356 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 354 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
357 FakeImplProxy proxy; 355 FakeImplProxy proxy;
358 TestSharedBitmapManager shared_bitmap_manager; 356 TestSharedBitmapManager shared_bitmap_manager;
359 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 357 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
360 EXPECT_TRUE(host_impl.InitializeRenderer( 358 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
361 FakeOutputSurface::Create3d().PassAs<OutputSurface>()));
362 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1); 359 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
363 360
364 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { 361 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) {
365 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) { 362 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) {
366 for (int host_opaque = 0; host_opaque < 2; ++host_opaque) { 363 for (int host_opaque = 0; host_opaque < 2; ++host_opaque) {
367 layer->SetContentsOpaque(!!contents_opaque); 364 layer->SetContentsOpaque(!!contents_opaque);
368 layer->SetBackgroundColor(layer_opaque ? SK_ColorRED 365 layer->SetBackgroundColor(layer_opaque ? SK_ColorRED
369 : SK_ColorTRANSPARENT); 366 : SK_ColorTRANSPARENT);
370 host_impl.active_tree()->set_background_color( 367 host_impl.active_tree()->set_background_color(
371 host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT); 368 host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 layer()->id(), tree()->root_layer()->id()); 681 layer()->id(), tree()->root_layer()->id());
685 682
686 int expected_horizontal_maximum = 683 int expected_horizontal_maximum =
687 layer()->bounds().width() - tree()->root_layer()->bounds().width(); 684 layer()->bounds().width() - tree()->root_layer()->bounds().width();
688 EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum()); 685 EXPECT_EQ(expected_horizontal_maximum, horizontal_scrollbar->maximum());
689 EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos()); 686 EXPECT_EQ(scroll_offset.x(), horizontal_scrollbar->current_pos());
690 } 687 }
691 688
692 } // namespace 689 } // namespace
693 } // namespace cc 690 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/layers/layer_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698