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

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: no-constructor 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
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:
112 LayerSerializationTest() : fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {}
113
114 protected: 111 protected:
115 void SetUp() override { 112 void SetUp() override {
116 layer_tree_host_ = 113 layer_tree_host_ =
117 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_); 114 FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_);
118 } 115 }
119 116
120 void TearDown() override { 117 void TearDown() override {
121 layer_tree_host_->SetRootLayer(nullptr); 118 layer_tree_host_->SetRootLayer(nullptr);
122 layer_tree_host_ = nullptr; 119 layer_tree_host_ = nullptr;
123 } 120 }
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 MOCK_METHOD0(SetNeedsUpdateLayers, void()); 889 MOCK_METHOD0(SetNeedsUpdateLayers, void());
893 MOCK_METHOD0(SetNeedsFullTreeSync, void()); 890 MOCK_METHOD0(SetNeedsFullTreeSync, void());
894 }; 891 };
895 892
896 class LayerTest : public testing::Test { 893 class LayerTest : public testing::Test {
897 public: 894 public:
898 LayerTest() 895 LayerTest()
899 : host_impl_(LayerTreeSettings(), 896 : host_impl_(LayerTreeSettings(),
900 &task_runner_provider_, 897 &task_runner_provider_,
901 &shared_bitmap_manager_, 898 &shared_bitmap_manager_,
902 &task_graph_runner_), 899 &task_graph_runner_) {
903 fake_client_(FakeLayerTreeHostClient::DIRECT_3D) {
904 timeline_impl_ = 900 timeline_impl_ =
905 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 901 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
906 timeline_impl_->set_is_impl_only(true); 902 timeline_impl_->set_is_impl_only(true);
907 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_); 903 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_);
908 } 904 }
909 905
910 const LayerTreeSettings& settings() { return settings_; } 906 const LayerTreeSettings& settings() { return settings_; }
911 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; } 907 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; }
912 908
913 protected: 909 protected:
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 1835
1840 child->SetReplicaLayer(replica_replacement.get()); 1836 child->SetReplicaLayer(replica_replacement.get());
1841 EXPECT_EQ(nullptr, replica->parent()); 1837 EXPECT_EQ(nullptr, replica->parent());
1842 EXPECT_EQ(child.get(), replica_replacement->parent()); 1838 EXPECT_EQ(child.get(), replica_replacement->parent());
1843 1839
1844 EXPECT_EQ(replica.get(), replica->mask_layer()->parent()); 1840 EXPECT_EQ(replica.get(), replica->mask_layer()->parent());
1845 } 1841 }
1846 1842
1847 class LayerTreeHostFactory { 1843 class LayerTreeHostFactory {
1848 public: 1844 public:
1849 LayerTreeHostFactory() : client_(FakeLayerTreeHostClient::DIRECT_3D) {}
1850
1851 std::unique_ptr<LayerTreeHost> Create() { 1845 std::unique_ptr<LayerTreeHost> Create() {
1852 return Create(LayerTreeSettings()); 1846 return Create(LayerTreeSettings());
1853 } 1847 }
1854 1848
1855 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings) { 1849 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings) {
1856 LayerTreeHost::InitParams params; 1850 LayerTreeHost::InitParams params;
1857 params.client = &client_; 1851 params.client = &client_;
1858 params.shared_bitmap_manager = &shared_bitmap_manager_; 1852 params.shared_bitmap_manager = &shared_bitmap_manager_;
1859 params.task_graph_runner = &task_graph_runner_; 1853 params.task_graph_runner = &task_graph_runner_;
1860 params.gpu_memory_buffer_manager = &gpu_memory_buffer_manager_; 1854 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()); 2528 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
2535 2529
2536 test_layer->PushPropertiesTo(impl_layer.get()); 2530 test_layer->PushPropertiesTo(impl_layer.get());
2537 2531
2538 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); 2532 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id());
2539 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 2533 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
2540 } 2534 }
2541 2535
2542 } // namespace 2536 } // namespace
2543 } // namespace cc 2537 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_proto_converter_unittest.cc ('k') | cc/layers/nine_patch_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698