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

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

Issue 2171143002: cc: Get rid of non-delegated rendering in most cc unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@killdirecttests
Patch Set: fakeoutputsurface: cc-blink-tests Created 4 years, 5 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.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/threading/thread_task_runner_handle.h" 9 #include "base/threading/thread_task_runner_handle.h"
10 #include "cc/animation/animation_host.h" 10 #include "cc/animation/animation_host.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 namespace cc { 102 namespace cc {
103 103
104 // This class is a friend of Layer, and is used as a wrapper for all the tests 104 // This class is a friend of Layer, and is used as a wrapper for all the tests
105 // related to proto serialization. This is done so that it is unnecessary to 105 // related to proto serialization. This is done so that it is unnecessary to
106 // add FRIEND_TEST_ALL_PREFIXES in //cc/layers/layer.h for all the tests. 106 // add FRIEND_TEST_ALL_PREFIXES in //cc/layers/layer.h for all the tests.
107 // It is in the cc namespace so that it can be a friend of Layer. 107 // It is in the cc namespace so that it can be a friend of Layer.
108 // The tests still have helpful names, and a test with the name FooBar would 108 // The tests still have helpful names, and a test with the name FooBar would
109 // have a wrapper method in this class called RunFooBarTest. 109 // have a wrapper method in this class called RunFooBarTest.
110 class LayerSerializationTest : public testing::Test { 110 class LayerSerializationTest : public testing::Test {
111 public: 111 public:
112 LayerSerializationTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {} 112 LayerSerializationTest() = default;
vmpstr 2016/07/22 20:24:36 Do we need an explicit ctor here?
danakj 2016/07/22 20:34:57 Probly not! I don't see any non-default assignment
113 113
114 protected: 114 protected:
115 void SetUp() override { 115 void SetUp() override {
116 layer_tree_host_ = 116 layer_tree_host_ =
117 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); 117 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_);
118 } 118 }
119 119
120 void TearDown() override { 120 void TearDown() override {
121 layer_tree_host_->SetRootLayer(nullptr); 121 layer_tree_host_->SetRootLayer(nullptr);
122 layer_tree_host_ = nullptr; 122 layer_tree_host_ = nullptr;
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 MOCK_METHOD0(SetNeedsUpdateLayers, void()); 892 MOCK_METHOD0(SetNeedsUpdateLayers, void());
893 MOCK_METHOD0(SetNeedsFullTreeSync, void()); 893 MOCK_METHOD0(SetNeedsFullTreeSync, void());
894 }; 894 };
895 895
896 class LayerTest : public testing::Test { 896 class LayerTest : public testing::Test {
897 public: 897 public:
898 LayerTest() 898 LayerTest()
899 : host_impl_(LayerTreeSettings(), 899 : host_impl_(LayerTreeSettings(),
900 &task_runner_provider_, 900 &task_runner_provider_,
901 &shared_bitmap_manager_, 901 &shared_bitmap_manager_,
902 &task_graph_runner_), 902 &task_graph_runner_) {
903 fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {
904 timeline_impl_ = 903 timeline_impl_ =
905 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 904 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
906 timeline_impl_->set_is_impl_only(true); 905 timeline_impl_->set_is_impl_only(true);
907 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_); 906 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_);
908 } 907 }
909 908
910 const LayerTreeSettings& settings() { return settings_; } 909 const LayerTreeSettings& settings() { return settings_; }
911 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; } 910 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; }
912 911
913 protected: 912 protected:
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 1838
1840 child->SetReplicaLayer(replica_replacement.get()); 1839 child->SetReplicaLayer(replica_replacement.get());
1841 EXPECT_EQ(nullptr, replica->parent()); 1840 EXPECT_EQ(nullptr, replica->parent());
1842 EXPECT_EQ(child.get(), replica_replacement->parent()); 1841 EXPECT_EQ(child.get(), replica_replacement->parent());
1843 1842
1844 EXPECT_EQ(replica.get(), replica->mask_layer()->parent()); 1843 EXPECT_EQ(replica.get(), replica->mask_layer()->parent());
1845 } 1844 }
1846 1845
1847 class LayerTreeHostFactory { 1846 class LayerTreeHostFactory {
1848 public: 1847 public:
1849 LayerTreeHostFactory() : client_(FakeLayerTreeHostClient::DIRECT_3D) {}
1850
1851 std::unique_ptr<LayerTreeHost> Create() { 1848 std::unique_ptr<LayerTreeHost> Create() {
1852 return Create(LayerTreeSettings()); 1849 return Create(LayerTreeSettings());
1853 } 1850 }
1854 1851
1855 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { 1852 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings) {
1856 LayerTreeHost::InitParams params; 1853 LayerTreeHost::InitParams params;
1857 params.client = &client_; 1854 params.client = &client_;
1858 params.shared_bitmap_manager = &shared_bitmap_manager_; 1855 params.shared_bitmap_manager = &shared_bitmap_manager_;
1859 params.task_graph_runner = &task_graph_runner_; 1856 params.task_graph_runner = &task_graph_runner_;
1860 params.gpu_memory_buffer_manager = &gpu_memory_buffer_manager_; 1857 params.gpu_memory_buffer_manager = &gpu_memory_buffer_manager_;
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
2534 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 2531 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2535 2532
2536 test_layer->PushPropertiesTo(impl_layer.get()); 2533 test_layer->PushPropertiesTo(impl_layer.get());
2537 2534
2538 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); 2535 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id());
2539 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2536 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2540 } 2537 }
2541 2538
2542 } // namespace 2539 } // namespace
2543 } // namespace cc 2540 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698