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

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

Issue 1356463002: Revert of cc: Implement shared worker contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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();
93 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, 92 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
94 &task_graph_runner); 93 &task_graph_runner);
95 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); 94 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
96 scoped_ptr<LayerImpl> root_clip = 95 scoped_ptr<LayerImpl> root_clip =
97 LayerImpl::Create(host_impl.active_tree(), 1); 96 LayerImpl::Create(host_impl.active_tree(), 1);
98 scoped_ptr<LayerImpl> root_ptr = 97 scoped_ptr<LayerImpl> root_ptr =
99 LayerImpl::Create(host_impl.active_tree(), 2); 98 LayerImpl::Create(host_impl.active_tree(), 2);
100 LayerImpl* root = root_ptr.get(); 99 LayerImpl* root = root_ptr.get();
101 root_clip->AddChild(root_ptr.Pass()); 100 root_clip->AddChild(root_ptr.Pass());
102 scoped_ptr<LayerImpl> scroll_parent = 101 scoped_ptr<LayerImpl> scroll_parent =
103 LayerImpl::Create(host_impl.active_tree(), 3); 102 LayerImpl::Create(host_impl.active_tree(), 3);
104 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get(); 103 LayerImpl* scroll_child = LayerImpl::Create(host_impl.active_tree(), 4).get();
105 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>(); 104 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 240 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
242 root->SetClipParent(clip_parent.get())); 241 root->SetClipParent(clip_parent.get()));
243 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 242 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
244 root->SetClipChildren(clip_children)); 243 root->SetClipChildren(clip_children));
245 } 244 }
246 245
247 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) { 246 TEST(LayerImplTest, VerifyNeedsUpdateDrawProperties) {
248 FakeImplProxy proxy; 247 FakeImplProxy proxy;
249 TestSharedBitmapManager shared_bitmap_manager; 248 TestSharedBitmapManager shared_bitmap_manager;
250 TestTaskGraphRunner task_graph_runner; 249 TestTaskGraphRunner task_graph_runner;
251 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
252 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, 250 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
253 &task_graph_runner); 251 &task_graph_runner);
254 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); 252 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
255 host_impl.active_tree()->SetRootLayer( 253 host_impl.active_tree()->SetRootLayer(
256 LayerImpl::Create(host_impl.active_tree(), 1)); 254 LayerImpl::Create(host_impl.active_tree(), 1));
257 LayerImpl* root = host_impl.active_tree()->root_layer(); 255 LayerImpl* root = host_impl.active_tree()->root_layer();
258 root->SetHasRenderSurface(true); 256 root->SetHasRenderSurface(true);
259 scoped_ptr<LayerImpl> layer_ptr = 257 scoped_ptr<LayerImpl> layer_ptr =
260 LayerImpl::Create(host_impl.active_tree(), 2); 258 LayerImpl::Create(host_impl.active_tree(), 2);
261 LayerImpl* layer = layer_ptr.get(); 259 LayerImpl* layer = layer_ptr.get();
262 root->AddChild(layer_ptr.Pass()); 260 root->AddChild(layer_ptr.Pass());
263 layer->SetScrollClipLayer(root->id()); 261 layer->SetScrollClipLayer(root->id());
264 DCHECK(host_impl.CanDraw()); 262 DCHECK(host_impl.CanDraw());
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 layer->SetIsRootForIsolatedGroup(true)); 354 layer->SetIsRootForIsolatedGroup(true));
357 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
358 layer->SetTransform(arbitrary_transform)); 356 layer->SetTransform(arbitrary_transform));
359 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 357 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
360 } 358 }
361 359
362 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 360 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
363 FakeImplProxy proxy; 361 FakeImplProxy proxy;
364 TestSharedBitmapManager shared_bitmap_manager; 362 TestSharedBitmapManager shared_bitmap_manager;
365 TestTaskGraphRunner task_graph_runner; 363 TestTaskGraphRunner task_graph_runner;
366 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
367 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager, 364 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager,
368 &task_graph_runner); 365 &task_graph_runner);
369 EXPECT_TRUE(host_impl.InitializeRenderer(output_surface.get())); 366 EXPECT_TRUE(host_impl.InitializeRenderer(FakeOutputSurface::Create3d()));
370 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1); 367 scoped_ptr<LayerImpl> layer = LayerImpl::Create(host_impl.active_tree(), 1);
371 368
372 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) { 369 for (int contents_opaque = 0; contents_opaque < 2; ++contents_opaque) {
373 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) { 370 for (int layer_opaque = 0; layer_opaque < 2; ++layer_opaque) {
374 for (int host_opaque = 0; host_opaque < 2; ++host_opaque) { 371 for (int host_opaque = 0; host_opaque < 2; ++host_opaque) {
375 layer->SetContentsOpaque(!!contents_opaque); 372 layer->SetContentsOpaque(!!contents_opaque);
376 layer->SetBackgroundColor(layer_opaque ? SK_ColorRED 373 layer->SetBackgroundColor(layer_opaque ? SK_ColorRED
377 : SK_ColorTRANSPARENT); 374 : SK_ColorTRANSPARENT);
378 host_impl.active_tree()->set_background_color( 375 host_impl.active_tree()->set_background_color(
379 host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT); 376 host_opaque ? SK_ColorRED : SK_ColorTRANSPARENT);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 721
725 ASSERT_TRUE(layer(IV_SCROLL, ACTIVE)->scrollable()); 722 ASSERT_TRUE(layer(IV_SCROLL, ACTIVE)->scrollable());
726 723
727 ASSERT_TRUE(LayerHasScrollbar(OV_SCROLL, ACTIVE)); 724 ASSERT_TRUE(LayerHasScrollbar(OV_SCROLL, ACTIVE));
728 ASSERT_TRUE(LayerHasScrollbar(IV_CLIP, ACTIVE)); 725 ASSERT_TRUE(LayerHasScrollbar(IV_CLIP, ACTIVE));
729 ASSERT_TRUE(LayerHasScrollbar(IV_SCROLL, ACTIVE)); 726 ASSERT_TRUE(LayerHasScrollbar(IV_SCROLL, ACTIVE));
730 } 727 }
731 728
732 } // namespace 729 } // namespace
733 } // namespace cc 730 } // 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