OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/layer_tree_json_parser.h" | 5 #include "cc/test/layer_tree_json_parser.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/test/fake_impl_task_runner_provider.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 EXPECT_EQ(layer_impl->position(), layer->position())); | 35 EXPECT_EQ(layer_impl->position(), layer->position())); |
36 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRANSFORMATION_MATRIX_EQ( | 36 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRANSFORMATION_MATRIX_EQ( |
37 layer_impl->transform(), layer->transform())); | 37 layer_impl->transform(), layer->transform())); |
38 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(), | 38 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(), |
39 layer->contents_opaque())); | 39 layer->contents_opaque())); |
40 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(), | 40 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(), |
41 layer->scrollable())); | 41 layer->scrollable())); |
42 RETURN_IF_EXPECTATION_FAILS(EXPECT_FLOAT_EQ(layer_impl->opacity(), | 42 RETURN_IF_EXPECTATION_FAILS(EXPECT_FLOAT_EQ(layer_impl->opacity(), |
43 layer->opacity())); | 43 layer->opacity())); |
44 RETURN_IF_EXPECTATION_FAILS( | 44 RETURN_IF_EXPECTATION_FAILS( |
45 EXPECT_EQ(layer_impl->have_scroll_event_handlers(), | |
46 layer->have_scroll_event_handlers())); | |
47 RETURN_IF_EXPECTATION_FAILS( | |
48 EXPECT_EQ(layer_impl->touch_event_handler_region(), | 45 EXPECT_EQ(layer_impl->touch_event_handler_region(), |
49 layer->touch_event_handler_region())); | 46 layer->touch_event_handler_region())); |
50 | 47 |
51 for (size_t i = 0; i < layer_impl->children().size(); ++i) { | 48 for (size_t i = 0; i < layer_impl->children().size(); ++i) { |
52 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRUE(LayerTreesMatch( | 49 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRUE(LayerTreesMatch( |
53 layer_impl->children()[i].get(), layer->children()[i].get()))); | 50 layer_impl->children()[i].get(), layer->children()[i].get()))); |
54 } | 51 } |
55 | 52 |
56 return true; | 53 return true; |
57 #undef RETURN_IF_EXPECTATION_FAILS | 54 #undef RETURN_IF_EXPECTATION_FAILS |
(...skipping 15 matching lines...) Expand all Loading... |
73 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); | 70 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); |
74 scoped_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); | 71 scoped_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); |
75 scoped_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); | 72 scoped_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); |
76 | 73 |
77 root_impl->SetBounds(gfx::Size(100, 100)); | 74 root_impl->SetBounds(gfx::Size(100, 100)); |
78 parent->SetBounds(gfx::Size(50, 50)); | 75 parent->SetBounds(gfx::Size(50, 50)); |
79 child->SetBounds(gfx::Size(40, 40)); | 76 child->SetBounds(gfx::Size(40, 40)); |
80 | 77 |
81 parent->SetPosition(gfx::PointF(25.f, 25.f)); | 78 parent->SetPosition(gfx::PointF(25.f, 25.f)); |
82 | 79 |
83 child->SetHaveScrollEventHandlers(true); | |
84 | |
85 parent->AddChild(std::move(child)); | 80 parent->AddChild(std::move(child)); |
86 root_impl->AddChild(std::move(parent)); | 81 root_impl->AddChild(std::move(parent)); |
87 tree->SetRootLayer(std::move(root_impl)); | 82 tree->SetRootLayer(std::move(root_impl)); |
88 | 83 |
89 std::string json = host_impl.LayerTreeAsJson(); | 84 std::string json = host_impl.LayerTreeAsJson(); |
90 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 85 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
91 ASSERT_TRUE(root.get()); | 86 ASSERT_TRUE(root.get()); |
92 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); | 87 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); |
93 } | 88 } |
94 | 89 |
(...skipping 19 matching lines...) Expand all Loading... |
114 root_impl->AddChild(std::move(touch_layer)); | 109 root_impl->AddChild(std::move(touch_layer)); |
115 tree->SetRootLayer(std::move(root_impl)); | 110 tree->SetRootLayer(std::move(root_impl)); |
116 | 111 |
117 std::string json = host_impl.LayerTreeAsJson(); | 112 std::string json = host_impl.LayerTreeAsJson(); |
118 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 113 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
119 ASSERT_TRUE(root.get()); | 114 ASSERT_TRUE(root.get()); |
120 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); | 115 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); |
121 } | 116 } |
122 | 117 |
123 } // namespace cc | 118 } // namespace cc |
OLD | NEW |