| 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 17 matching lines...) Expand all Loading... |
| 28 return false; \ | 28 return false; \ |
| 29 } while (0) | 29 } while (0) |
| 30 | 30 |
| 31 RETURN_IF_EXPECTATION_FAILS( | 31 RETURN_IF_EXPECTATION_FAILS( |
| 32 EXPECT_EQ(layer_impl->test_properties()->children.size(), | 32 EXPECT_EQ(layer_impl->test_properties()->children.size(), |
| 33 layer->children().size())); | 33 layer->children().size())); |
| 34 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->bounds(), layer->bounds())); | 34 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->bounds(), layer->bounds())); |
| 35 RETURN_IF_EXPECTATION_FAILS( | 35 RETURN_IF_EXPECTATION_FAILS( |
| 36 EXPECT_EQ(layer_impl->position(), layer->position())); | 36 EXPECT_EQ(layer_impl->position(), layer->position())); |
| 37 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRANSFORMATION_MATRIX_EQ( | 37 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 38 layer_impl->transform(), layer->transform())); | 38 layer_impl->test_properties()->transform, layer->transform())); |
| 39 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(), | 39 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->contents_opaque(), |
| 40 layer->contents_opaque())); | 40 layer->contents_opaque())); |
| 41 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(), | 41 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->scrollable(), |
| 42 layer->scrollable())); | 42 layer->scrollable())); |
| 43 RETURN_IF_EXPECTATION_FAILS( | 43 RETURN_IF_EXPECTATION_FAILS( |
| 44 EXPECT_FLOAT_EQ(layer_impl->Opacity(), layer->opacity())); | 44 EXPECT_FLOAT_EQ(layer_impl->Opacity(), layer->opacity())); |
| 45 RETURN_IF_EXPECTATION_FAILS( | 45 RETURN_IF_EXPECTATION_FAILS( |
| 46 EXPECT_EQ(layer_impl->touch_event_handler_region(), | 46 EXPECT_EQ(layer_impl->touch_event_handler_region(), |
| 47 layer->touch_event_handler_region())); | 47 layer->touch_event_handler_region())); |
| 48 | 48 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 72 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); | 72 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); |
| 73 std::unique_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); | 73 std::unique_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); |
| 74 std::unique_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); | 74 std::unique_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); |
| 75 | 75 |
| 76 root_impl->SetBounds(gfx::Size(100, 100)); | 76 root_impl->SetBounds(gfx::Size(100, 100)); |
| 77 parent->SetBounds(gfx::Size(50, 50)); | 77 parent->SetBounds(gfx::Size(50, 50)); |
| 78 child->SetBounds(gfx::Size(40, 40)); | 78 child->SetBounds(gfx::Size(40, 40)); |
| 79 | 79 |
| 80 gfx::Transform translate; | 80 gfx::Transform translate; |
| 81 translate.Translate(10, 15); | 81 translate.Translate(10, 15); |
| 82 child->SetTransform(translate); | 82 child->test_properties()->transform = translate; |
| 83 | 83 |
| 84 parent->SetPosition(gfx::PointF(25.f, 25.f)); | 84 parent->SetPosition(gfx::PointF(25.f, 25.f)); |
| 85 | 85 |
| 86 parent->test_properties()->AddChild(std::move(child)); | 86 parent->test_properties()->AddChild(std::move(child)); |
| 87 root_impl->test_properties()->AddChild(std::move(parent)); | 87 root_impl->test_properties()->AddChild(std::move(parent)); |
| 88 tree->SetRootLayerForTesting(std::move(root_impl)); | 88 tree->SetRootLayerForTesting(std::move(root_impl)); |
| 89 | 89 |
| 90 std::string json = host_impl.LayerTreeAsJson(); | 90 std::string json = host_impl.LayerTreeAsJson(); |
| 91 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 91 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
| 92 ASSERT_TRUE(root.get()); | 92 ASSERT_TRUE(root.get()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 117 tree->SetRootLayerForTesting(std::move(root_impl)); | 117 tree->SetRootLayerForTesting(std::move(root_impl)); |
| 118 | 118 |
| 119 std::string json = host_impl.LayerTreeAsJson(); | 119 std::string json = host_impl.LayerTreeAsJson(); |
| 120 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); | 120 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); |
| 121 ASSERT_TRUE(root.get()); | 121 ASSERT_TRUE(root.get()); |
| 122 EXPECT_TRUE(LayerTreesMatch(host_impl.active_tree()->root_layer_for_testing(), | 122 EXPECT_TRUE(LayerTreesMatch(host_impl.active_tree()->root_layer_for_testing(), |
| 123 root.get())); | 123 root.get())); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace cc | 126 } // namespace cc |
| OLD | NEW |