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