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

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

Issue 1336733002: Re-land: cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix LayerTreeHostClientTakeAwayOutputSurface test. Content provider is always destroyed on the clie… Created 5 years, 3 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
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/layers/solid_color_scrollbar_layer_impl.h" 8 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
9 #include "cc/output/filter_operation.h" 9 #include "cc/output/filter_operation.h"
10 #include "cc/output/filter_operations.h" 10 #include "cc/output/filter_operations.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) { 82 TEST(LayerImplTest, VerifyLayerChangesAreTrackedProperly) {
83 // 83 //
84 // This test checks that layerPropertyChanged() has the correct behavior. 84 // This test checks that layerPropertyChanged() has the correct behavior.
85 // 85 //
86 86
87 // The constructor on this will fake that we are on the correct thread. 87 // The constructor on this will fake that we are on the correct thread.
88 // Create a simple LayerImpl tree: 88 // Create a simple LayerImpl tree:
89 FakeImplProxy proxy; 89 FakeImplProxy proxy;
90 TestSharedBitmapManager shared_bitmap_manager; 90 TestSharedBitmapManager shared_bitmap_manager;
91 TestTaskGraphRunner task_graph_runner; 91 TestTaskGraphRunner task_graph_runner;
92 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
92 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, 93 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
93 &task_graph_runner); 94 &task_graph_runner);
94 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d())); 95 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
95 scoped_ptr<LayerImpl> root_clip = 96 scoped_ptr<LayerImpl> root_clip =
96 LayerImpl::Create(host_impl.active_tree(), 1); 97 LayerImpl::Create(host_impl.active_tree(), 1);
97 scoped_ptr<LayerImpl> root_ptr = 98 scoped_ptr<LayerImpl> root_ptr =
98 LayerImpl::Create(host_impl.active_tree(), 2); 99 LayerImpl::Create(host_impl.active_tree(), 2);
99 LayerImpl* root = root_ptr.get(); 100 LayerImpl* root = root_ptr.get();
100 root_clip->AddChild(root_ptr.Pass()); 101 root_clip->AddChild(root_ptr.Pass());
101 scoped_ptr<LayerImpl> scroll_parent = 102 scoped_ptr<LayerImpl> scroll_parent =
102 LayerImpl::Create(host_impl.active_tree(), 3); 103 LayerImpl::Create(host_impl.active_tree(), 3);
103 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get(); 104 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get();
104 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>(); 105 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 241 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
241 root->SetClipParent(clip_parent.get())); 242 root->SetClipParent(clip_parent.get()));
242 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 243 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
243 root->SetClipChildren(clip_children)); 244 root->SetClipChildren(clip_children));
244 } 245 }
245 246
246 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { 247 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
247 FakeImplProxy proxy; 248 FakeImplProxy proxy;
248 TestSharedBitmapManager shared_bitmap_manager; 249 TestSharedBitmapManager shared_bitmap_manager;
249 TestTaskGraphRunner task_graph_runner; 250 TestTaskGraphRunner task_graph_runner;
251 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
250 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, 252 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
251 &task_graph_runner); 253 &task_graph_runner);
252 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d())); 254 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
253 host_impl.active_tree()->SetRootLayer( 255 host_impl.active_tree()->SetRootLayer(
254 LayerImpl::Create(host_impl.active_tree(), 1)); 256 LayerImpl::Create(host_impl.active_tree(), 1));
255 LayerImpl* root = host_impl.active_tree()->root_layer(); 257 LayerImpl* root = host_impl.active_tree()->root_layer();
256 root->SetHasRenderSurface(true); 258 root->SetHasRenderSurface(true);
257 scoped_ptr<LayerImpl> layer_ptr = 259 scoped_ptr<LayerImpl> layer_ptr =
258 LayerImpl::Create(host_impl.active_tree(), 2); 260 LayerImpl::Create(host_impl.active_tree(), 2);
259 LayerImpl* layer = layer_ptr.get(); 261 LayerImpl* layer = layer_ptr.get();
260 root->AddChild(layer_ptr.Pass()); 262 root->AddChild(layer_ptr.Pass());
261 layer->SetScrollClipLayer(root->id()); 263 layer->SetScrollClipLayer(root->id());
262 DCHECK(host_impl.CanDraw()); 264 DCHECK(host_impl.CanDraw());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 layer->SetIsRootForIsolatedGroup(true)); 356 layer->SetIsRootForIsolatedGroup(true));
355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 357 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
356 layer->SetTransform(arbitrary_transform)); 358 layer->SetTransform(arbitrary_transform));
357 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 359 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
358 } 360 }
359 361
360 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 362 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
361 FakeImplProxy proxy; 363 FakeImplProxy proxy;
362 TestSharedBitmapManager shared_bitmap_manager; 364 TestSharedBitmapManager shared_bitmap_manager;
363 TestTaskGraphRunner task_graph_runner; 365 TestTaskGraphRunner task_graph_runner;
366 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
364 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, 367 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
365 &task_graph_runner); 368 &task_graph_runner);
366 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d())); 369 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get()));
367 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1); 370 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
368 371
369 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { 372 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) {
370 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) { 373 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) {
371 for (int host_opaque = 0; host_opaque < 2; ++host_opaque) { 374 for (int host_opaque = 0; host_opaque < 2; ++host_opaque) {
372 layer->SetContentsOpaque(!!contents_opaque); 375 layer->SetContentsOpaque(!!contents_opaque);
373 layer->SetBackgroundColor(layer_opaque ? SK_ColorRED 376 layer->SetBackgroundColor(layer_opaque ? SK_ColorRED
374 : SK_ColorTRANSPARENT); 377 : SK_ColorTRANSPARENT);
375 host_impl.active_tree()->set_background_color( 378 host_impl.active_tree()->set_background_color(
376 host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT); 379 host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 724
722 ASSERT_TRUE(layer(IV_SCROLL, ACTIVE)->scrollable()); 725 ASSERT_TRUE(layer(IV_SCROLL, ACTIVE)->scrollable());
723 726
724 ASSERT_TRUE(LayerHasScrollbar(OV_SCROLL, ACTIVE)); 727 ASSERT_TRUE(LayerHasScrollbar(OV_SCROLL, ACTIVE));
725 ASSERT_TRUE(LayerHasScrollbar(IV_CLIP, ACTIVE)); 728 ASSERT_TRUE(LayerHasScrollbar(IV_CLIP, ACTIVE));
726 ASSERT_TRUE(LayerHasScrollbar(IV_SCROLL, ACTIVE)); 729 ASSERT_TRUE(LayerHasScrollbar(IV_SCROLL, ACTIVE));
727 } 730 }
728 731
729 } // namespace 732 } // namespace
730 } // namespace cc 733 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/heads_up_display_layer_impl_unittest.cc ('k') | cc/layers/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698