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

Side by Side Diff: cc/layers/layer_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.h" 5 #include "cc/layers/layer.h"
6 6
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "cc/animation/keyframed_animation_curve.h" 8 #include "cc/animation/keyframed_animation_curve.h"
9 #include "cc/animation/mutable_properties.h"
9 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
10 #include "cc/layers/layer_impl.h" 11 #include "cc/layers/layer_impl.h"
11 #include "cc/output/copy_output_request.h" 12 #include "cc/output/copy_output_request.h"
12 #include "cc/output/copy_output_result.h" 13 #include "cc/output/copy_output_result.h"
13 #include "cc/proto/layer.pb.h" 14 #include "cc/proto/layer.pb.h"
14 #include "cc/test/animation_test_common.h" 15 #include "cc/test/animation_test_common.h"
15 #include "cc/test/fake_impl_task_runner_provider.h" 16 #include "cc/test/fake_impl_task_runner_provider.h"
16 #include "cc/test/fake_layer_tree_host_client.h" 17 #include "cc/test/fake_layer_tree_host_client.h"
17 #include "cc/test/fake_layer_tree_host_impl.h" 18 #include "cc/test/fake_layer_tree_host_impl.h"
18 #include "cc/test/geometry_test_utils.h" 19 #include "cc/test/geometry_test_utils.h"
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 Region(gfx::Rect(1, 1, 2, 2)))); 629 Region(gfx::Rect(1, 1, 2, 2))));
629 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveWheelEventHandlers(true)); 630 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveWheelEventHandlers(true));
630 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveScrollEventHandlers(true)); 631 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveScrollEventHandlers(true));
631 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform( 632 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(
632 gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0))); 633 gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)));
633 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetDoubleSided(false)); 634 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetDoubleSided(false));
634 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTouchEventHandlerRegion( 635 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTouchEventHandlerRegion(
635 gfx::Rect(10, 10))); 636 gfx::Rect(10, 10)));
636 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetForceRenderSurface(true)); 637 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetForceRenderSurface(true));
637 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHideLayerAndSubtree(true)); 638 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHideLayerAndSubtree(true));
639 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetElementId(2));
640 EXPECT_SET_NEEDS_COMMIT(
641 1, test_layer->SetMutableProperties(kMutablePropertyTransform));
638 642
639 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetMaskLayer( 643 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetMaskLayer(
640 dummy_layer1.get())); 644 dummy_layer1.get()));
641 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetReplicaLayer( 645 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetReplicaLayer(
642 dummy_layer2.get())); 646 dummy_layer2.get()));
643 647
644 // The above tests should not have caused a change to the needs_display flag. 648 // The above tests should not have caused a change to the needs_display flag.
645 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); 649 EXPECT_FALSE(test_layer->NeedsDisplayForTesting());
646 650
647 // As layers are removed from the tree, they will cause a tree sync. 651 // As layers are removed from the tree, they will cause a tree sync.
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 proto::LayerNode proto2; 1564 proto::LayerNode proto2;
1561 layer_src_root->ToLayerNodeProto(&proto2); 1565 layer_src_root->ToLayerNodeProto(&proto2);
1562 1566
1563 // Deserialization 2. 1567 // Deserialization 2.
1564 layer_dest_root->FromLayerNodeProto(proto2, dest_layer_map); 1568 layer_dest_root->FromLayerNodeProto(proto2, dest_layer_map);
1565 1569
1566 EXPECT_EQ(nullptr, layer_dest_root->mask_layer()); 1570 EXPECT_EQ(nullptr, layer_dest_root->mask_layer());
1567 EXPECT_EQ(nullptr, layer_dest_root->replica_layer()); 1571 EXPECT_EQ(nullptr, layer_dest_root->replica_layer());
1568 } 1572 }
1569 1573
1574 TEST_F(LayerTest, ElementIdAndMutablePropertiesArePushed) {
1575 scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_);
1576 scoped_ptr<LayerImpl> impl_layer =
1577 LayerImpl::Create(host_impl_.active_tree(), 1);
1578
1579 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1,
1580 layer_tree_host_->SetRootLayer(test_layer));
1581
1582 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(2);
1583
1584 test_layer->SetElementId(2);
1585 test_layer->SetMutableProperties(kMutablePropertyTransform);
1586
1587 EXPECT_EQ(0lu, impl_layer->element_id());
1588 EXPECT_EQ(kMutablePropertyNone, impl_layer->mutable_properties());
1589
1590 test_layer->PushPropertiesTo(impl_layer.get());
1591
1592 EXPECT_EQ(2lu, impl_layer->element_id());
1593 EXPECT_EQ(kMutablePropertyTransform, impl_layer->mutable_properties());
1594 }
1595
1570 } // namespace 1596 } // namespace
1571 } // namespace cc 1597 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698