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

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

Issue 1405993008: compositor-worker: plumb element id and mutable properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed layout test (and logged bug) Created 5 years, 1 month 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/animation/mutable_properties.h"
7 #include "cc/layers/painted_scrollbar_layer_impl.h" 8 #include "cc/layers/painted_scrollbar_layer_impl.h"
8 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
9 #include "cc/output/filter_operation.h" 10 #include "cc/output/filter_operation.h"
10 #include "cc/output/filter_operations.h" 11 #include "cc/output/filter_operations.h"
11 #include "cc/test/fake_impl_task_runner_provider.h" 12 #include "cc/test/fake_impl_task_runner_provider.h"
12 #include "cc/test/fake_layer_tree_host_impl.h" 13 #include "cc/test/fake_layer_tree_host_impl.h"
13 #include "cc/test/fake_output_surface.h" 14 #include "cc/test/fake_output_surface.h"
14 #include "cc/test/geometry_test_utils.h" 15 #include "cc/test/geometry_test_utils.h"
15 #include "cc/test/test_shared_bitmap_manager.h" 16 #include "cc/test/test_shared_bitmap_manager.h"
16 #include "cc/test/test_task_graph_runner.h" 17 #include "cc/test/test_task_graph_runner.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 185
185 // Special case: check that SetBounds changes behavior depending on 186 // Special case: check that SetBounds changes behavior depending on
186 // masksToBounds. 187 // masksToBounds.
187 root->SetMasksToBounds(false); 188 root->SetMasksToBounds(false);
188 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246))); 189 EXECUTE_AND_VERIFY_ONLY_LAYER_CHANGED(root->SetBounds(gfx::Size(135, 246)));
189 root->SetMasksToBounds(true); 190 root->SetMasksToBounds(true);
190 // Should be a different size than previous call, to ensure it marks tree 191 // Should be a different size than previous call, to ensure it marks tree
191 // changed. 192 // changed.
192 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size)); 193 EXECUTE_AND_VERIFY_SUBTREE_CHANGED(root->SetBounds(arbitrary_size));
193 194
194 // Changing this property does not cause the layer to be marked as changed 195 // Changing these properties does not cause the layer to be marked as changed
195 // but does cause the layer to need to push properties. 196 // but does cause the layer to need to push properties.
196 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 197 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
197 root->SetIsRootForIsolatedGroup(true)); 198 root->SetIsRootForIsolatedGroup(true));
198 199 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
199 // Changing these properties should cause the layer to need to push properties 200 root->SetElementId(2));
201 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
202 root->SetMutableProperties(kMutablePropertyOpacity));
200 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 203 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
201 root->SetScrollParent(scroll_parent.get())); 204 root->SetScrollParent(scroll_parent.get()));
202 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 205 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
203 root->SetScrollChildren(scroll_children)); 206 root->SetScrollChildren(scroll_children));
204 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 207 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
205 root->SetClipParent(clip_parent.get())); 208 root->SetClipParent(clip_parent.get()));
206 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 209 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
207 root->SetClipChildren(clip_children)); 210 root->SetClipChildren(clip_children));
208 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 211 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
209 root->SetNumDescendantsThatDrawContent(10)); 212 root->SetNumDescendantsThatDrawContent(10));
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
354 layer->SetBackgroundFilters(arbitrary_filters)); 357 layer->SetBackgroundFilters(arbitrary_filters));
355 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number)); 358 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetOpacity(arbitrary_number));
356 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 359 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
357 layer->SetBlendMode(arbitrary_blend_mode)); 360 layer->SetBlendMode(arbitrary_blend_mode));
358 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 361 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
359 layer->SetIsRootForIsolatedGroup(true)); 362 layer->SetIsRootForIsolatedGroup(true));
360 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 363 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
361 layer->SetTransform(arbitrary_transform)); 364 layer->SetTransform(arbitrary_transform));
362 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 365 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
366 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2));
367 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
368 layer->SetMutableProperties(kMutablePropertyTransform));
363 } 369 }
364 370
365 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 371 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
366 FakeImplTaskRunnerProvider task_runner_provider; 372 FakeImplTaskRunnerProvider task_runner_provider;
367 TestSharedBitmapManager shared_bitmap_manager; 373 TestSharedBitmapManager shared_bitmap_manager;
368 TestTaskGraphRunner task_graph_runner; 374 TestTaskGraphRunner task_graph_runner;
369 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d(); 375 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d();
370 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 376 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
371 &task_graph_runner); 377 &task_graph_runner);
372 host_impl.SetVisible(true); 378 host_impl.SetVisible(true);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 580
575 pending_layer->PushPropertiesTo(layer()); 581 pending_layer->PushPropertiesTo(layer());
576 582
577 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 583 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
578 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 584 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
579 pending_layer->CurrentScrollOffset()); 585 pending_layer->CurrentScrollOffset());
580 } 586 }
581 587
582 } // namespace 588 } // namespace
583 } // namespace cc 589 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698