| 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 23 matching lines...) Expand all Loading... |
| 34 RETURN_IF_EXPECTATION_FAILS( | 34 RETURN_IF_EXPECTATION_FAILS( |
| 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(EXPECT_EQ(layer_impl->have_wheel_event_handlers(), | |
| 45 layer->have_wheel_event_handlers())); | |
| 46 RETURN_IF_EXPECTATION_FAILS( | 44 RETURN_IF_EXPECTATION_FAILS( |
| 47 EXPECT_EQ(layer_impl->have_scroll_event_handlers(), | 45 EXPECT_EQ(layer_impl->have_scroll_event_handlers(), |
| 48 layer->have_scroll_event_handlers())); | 46 layer->have_scroll_event_handlers())); |
| 49 RETURN_IF_EXPECTATION_FAILS( | 47 RETURN_IF_EXPECTATION_FAILS( |
| 50 EXPECT_EQ(layer_impl->touch_event_handler_region(), | 48 EXPECT_EQ(layer_impl->touch_event_handler_region(), |
| 51 layer->touch_event_handler_region())); | 49 layer->touch_event_handler_region())); |
| 52 | 50 |
| 53 for (size_t i = 0; i < layer_impl->children().size(); ++i) { | 51 for (size_t i = 0; i < layer_impl->children().size(); ++i) { |
| 54 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRUE(LayerTreesMatch( | 52 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRUE(LayerTreesMatch( |
| 55 layer_impl->children()[i].get(), layer->children()[i].get()))); | 53 layer_impl->children()[i].get(), layer->children()[i].get()))); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 75 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); | 73 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); |
| 76 scoped_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); | 74 scoped_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); |
| 77 scoped_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); | 75 scoped_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); |
| 78 | 76 |
| 79 root_impl->SetBounds(gfx::Size(100, 100)); | 77 root_impl->SetBounds(gfx::Size(100, 100)); |
| 80 parent->SetBounds(gfx::Size(50, 50)); | 78 parent->SetBounds(gfx::Size(50, 50)); |
| 81 child->SetBounds(gfx::Size(40, 40)); | 79 child->SetBounds(gfx::Size(40, 40)); |
| 82 | 80 |
| 83 parent->SetPosition(gfx::PointF(25.f, 25.f)); | 81 parent->SetPosition(gfx::PointF(25.f, 25.f)); |
| 84 | 82 |
| 85 child->SetHaveWheelEventHandlers(true); | |
| 86 child->SetHaveScrollEventHandlers(true); | 83 child->SetHaveScrollEventHandlers(true); |
| 87 | 84 |
| 88 parent->AddChild(std::move(child)); | 85 parent->AddChild(std::move(child)); |
| 89 root_impl->AddChild(std::move(parent)); | 86 root_impl->AddChild(std::move(parent)); |
| 90 tree->SetRootLayer(std::move(root_impl)); | 87 tree->SetRootLayer(std::move(root_impl)); |
| 91 | 88 |
| 92 std::string json = host_impl.LayerTreeAsJson(); | 89 std::string json = host_impl.LayerTreeAsJson(); |
| 93 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 90 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
| 94 ASSERT_TRUE(root.get()); | 91 ASSERT_TRUE(root.get()); |
| 95 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); | 92 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 117 root_impl->AddChild(std::move(touch_layer)); | 114 root_impl->AddChild(std::move(touch_layer)); |
| 118 tree->SetRootLayer(std::move(root_impl)); | 115 tree->SetRootLayer(std::move(root_impl)); |
| 119 | 116 |
| 120 std::string json = host_impl.LayerTreeAsJson(); | 117 std::string json = host_impl.LayerTreeAsJson(); |
| 121 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 118 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
| 122 ASSERT_TRUE(root.get()); | 119 ASSERT_TRUE(root.get()); |
| 123 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); | 120 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); |
| 124 } | 121 } |
| 125 | 122 |
| 126 } // namespace cc | 123 } // namespace cc |
| OLD | NEW |