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

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: fix rebase error. Created 5 years 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/layers/layer_settings.h" 12 #include "cc/layers/layer_settings.h"
12 #include "cc/output/copy_output_request.h" 13 #include "cc/output/copy_output_request.h"
13 #include "cc/output/copy_output_result.h" 14 #include "cc/output/copy_output_result.h"
14 #include "cc/proto/layer.pb.h" 15 #include "cc/proto/layer.pb.h"
15 #include "cc/test/animation_test_common.h" 16 #include "cc/test/animation_test_common.h"
16 #include "cc/test/fake_impl_task_runner_provider.h" 17 #include "cc/test/fake_impl_task_runner_provider.h"
17 #include "cc/test/fake_layer_tree_host_client.h" 18 #include "cc/test/fake_layer_tree_host_client.h"
18 #include "cc/test/fake_layer_tree_host_impl.h" 19 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 Region(gfx::Rect(1, 1, 2, 2)))); 630 Region(gfx::Rect(1, 1, 2, 2))));
630 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveWheelEventHandlers(true)); 631 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveWheelEventHandlers(true));
631 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveScrollEventHandlers(true)); 632 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHaveScrollEventHandlers(true));
632 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform( 633 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTransform(
633 gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0))); 634 gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)));
634 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetDoubleSided(false)); 635 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetDoubleSided(false));
635 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTouchEventHandlerRegion( 636 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetTouchEventHandlerRegion(
636 gfx::Rect(10, 10))); 637 gfx::Rect(10, 10)));
637 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetForceRenderSurface(true)); 638 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetForceRenderSurface(true));
638 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHideLayerAndSubtree(true)); 639 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetHideLayerAndSubtree(true));
640 EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetElementId(2));
641 EXPECT_SET_NEEDS_COMMIT(
642 1, test_layer->SetMutableProperties(kMutablePropertyTransform));
639 643
640 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetMaskLayer( 644 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetMaskLayer(
641 dummy_layer1.get())); 645 dummy_layer1.get()));
642 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetReplicaLayer( 646 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, test_layer->SetReplicaLayer(
643 dummy_layer2.get())); 647 dummy_layer2.get()));
644 648
645 // The above tests should not have caused a change to the needs_display flag. 649 // The above tests should not have caused a change to the needs_display flag.
646 EXPECT_FALSE(test_layer->NeedsDisplayForTesting()); 650 EXPECT_FALSE(test_layer->NeedsDisplayForTesting());
647 651
648 // As layers are removed from the tree, they will cause a tree sync. 652 // As layers are removed from the tree, they will cause a tree sync.
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 EXPECT_FALSE(layer->needs_push_properties()); 1701 EXPECT_FALSE(layer->needs_push_properties());
1698 EXPECT_FALSE(layer->descendant_needs_push_properties()); 1702 EXPECT_FALSE(layer->descendant_needs_push_properties());
1699 1703
1700 properties.set_needs_push_properties(true); 1704 properties.set_needs_push_properties(true);
1701 properties.mutable_base(); 1705 properties.mutable_base();
1702 layer->FromLayerPropertiesProto(properties); 1706 layer->FromLayerPropertiesProto(properties);
1703 EXPECT_TRUE(layer->needs_push_properties()); 1707 EXPECT_TRUE(layer->needs_push_properties());
1704 EXPECT_FALSE(layer->descendant_needs_push_properties()); 1708 EXPECT_FALSE(layer->descendant_needs_push_properties());
1705 } 1709 }
1706 1710
1711 TEST_F(LayerTest, ElementIdAndMutablePropertiesArePushed) {
1712 scoped_refptr<Layer> test_layer = Layer::Create(layer_settings_);
1713 scoped_ptr<LayerImpl> impl_layer =
1714 LayerImpl::Create(host_impl_.active_tree(), 1);
1715
1716 EXPECT_SET_NEEDS_FULL_TREE_SYNC(1,
1717 layer_tree_host_->SetRootLayer(test_layer));
1718
1719 EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(2);
1720
1721 test_layer->SetElementId(2);
1722 test_layer->SetMutableProperties(kMutablePropertyTransform);
1723
1724 EXPECT_EQ(0lu, impl_layer->element_id());
1725 EXPECT_EQ(kMutablePropertyNone, impl_layer->mutable_properties());
1726
1727 test_layer->PushPropertiesTo(impl_layer.get());
1728
1729 EXPECT_EQ(2lu, impl_layer->element_id());
1730 EXPECT_EQ(kMutablePropertyTransform, impl_layer->mutable_properties());
1731 }
1732
1707 } // namespace 1733 } // namespace
1708 } // namespace cc 1734 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl_unittest.cc ('k') | third_party/WebKit/LayoutTests/media/track/track-delete-during-setup.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698