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

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

Issue 2860293002: Change cc::ElementId to be a uint64_t (Closed)
Patch Set: none Created 3 years, 7 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/base/filter_operation.h" 7 #include "cc/base/filter_operation.h"
8 #include "cc/base/filter_operations.h" 8 #include "cc/base/filter_operations.h"
9 #include "cc/layers/painted_scrollbar_layer_impl.h" 9 #include "cc/layers/painted_scrollbar_layer_impl.h"
10 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 10 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 host_impl.active_tree()->property_trees()->needs_rebuild = true; 218 host_impl.active_tree()->property_trees()->needs_rebuild = true;
219 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 219 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
220 220
221 root->SetMasksToBounds(true); 221 root->SetMasksToBounds(true);
222 host_impl.active_tree()->property_trees()->needs_rebuild = true; 222 host_impl.active_tree()->property_trees()->needs_rebuild = true;
223 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting(); 223 host_impl.active_tree()->BuildLayerListAndPropertyTreesForTesting();
224 224
225 // Changing these properties does not cause the layer to be marked as changed 225 // Changing these properties does not cause the layer to be marked as changed
226 // but does cause the layer to need to push properties. 226 // but does cause the layer to need to push properties.
227 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 227 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
228 root->SetElementId(ElementId(2, 0))); 228 root->SetElementId(20));
suzyh_UTC10 (ex-contributor) 2017/05/05 04:27:30 Typo '20' instead of '2'?
chrishtr 2017/05/05 05:34:52 It wasn't a typo, because 2 is apparently what it
229 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE( 229 EXECUTE_AND_VERIFY_NEEDS_PUSH_PROPERTIES_AND_SUBTREE_DID_NOT_CHANGE(
230 root->SetMutableProperties(MutableProperty::kOpacity); 230 root->SetMutableProperties(MutableProperty::kOpacity);
231 root->SetNeedsPushProperties()); 231 root->SetNeedsPushProperties());
232 232
233 // After setting all these properties already, setting to the exact same 233 // After setting all these properties already, setting to the exact same
234 // values again should not cause any change. 234 // values again should not cause any change.
235 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true)); 235 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetMasksToBounds(true));
236 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE( 236 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(
237 root->SetPosition(arbitrary_point_f)); 237 root->SetPosition(arbitrary_point_f));
238 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true)); 238 EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->SetContentsOpaque(true));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 host_impl.active_tree()->SetFilterMutated(layer->element_id(), 342 host_impl.active_tree()->SetFilterMutated(layer->element_id(),
343 arbitrary_filters)); 343 arbitrary_filters));
344 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true)); 344 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetMasksToBounds(true));
345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true)); 345 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetContentsOpaque(true));
346 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 346 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
347 layer2->SetPosition(arbitrary_point_f)); 347 layer2->SetPosition(arbitrary_point_f));
348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true)); 348 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetDrawsContent(true));
349 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 349 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
350 layer->SetBackgroundColor(arbitrary_color)); 350 layer->SetBackgroundColor(arbitrary_color));
351 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size)); 351 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetBounds(arbitrary_size));
352 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(ElementId(2, 0))); 352 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(layer->SetElementId(2));
353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES( 353 VERIFY_NO_NEEDS_UPDATE_DRAW_PROPERTIES(
354 layer->SetMutableProperties(MutableProperty::kTransform)); 354 layer->SetMutableProperties(MutableProperty::kTransform));
355 } 355 }
356 356
357 TEST(LayerImplTest, SafeOpaqueBackgroundColor) { 357 TEST(LayerImplTest, SafeOpaqueBackgroundColor) {
358 FakeImplTaskRunnerProvider task_runner_provider; 358 FakeImplTaskRunnerProvider task_runner_provider;
359 TestTaskGraphRunner task_graph_runner; 359 TestTaskGraphRunner task_graph_runner;
360 std::unique_ptr<CompositorFrameSink> compositor_frame_sink = 360 std::unique_ptr<CompositorFrameSink> compositor_frame_sink =
361 FakeCompositorFrameSink::Create3d(); 361 FakeCompositorFrameSink::Create3d();
362 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner); 362 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &task_graph_runner);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 569
570 pending_layer->PushPropertiesTo(layer()); 570 pending_layer->PushPropertiesTo(layer());
571 571
572 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset()); 572 EXPECT_VECTOR_EQ(gfx::Vector2dF(22, 23), layer()->CurrentScrollOffset());
573 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(), 573 EXPECT_VECTOR_EQ(layer()->CurrentScrollOffset(),
574 pending_layer->CurrentScrollOffset()); 574 pending_layer->CurrentScrollOffset());
575 } 575 }
576 576
577 } // namespace 577 } // namespace
578 } // namespace cc 578 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698