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

Side by Side Diff: cc/test/layer_tree_json_parser_unittest.cc

Issue 2100353002: cc: DCHECK that the OutputSurface was released in ~LayerTreeHostImpl(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: released-outputsurface: . 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 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->SetTransform(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->SetRootLayer(std::move(root_impl)); 88 tree->SetRootLayer(std::move(root_impl));
89 tree->BuildLayerListForTesting();
89 90
90 std::string json = host_impl.LayerTreeAsJson(); 91 std::string json = host_impl.LayerTreeAsJson();
91 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); 92 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL);
92 ASSERT_TRUE(root.get()); 93 ASSERT_TRUE(root.get());
93 EXPECT_TRUE( 94 EXPECT_TRUE(
94 LayerTreesMatch(host_impl.active_tree()->root_layer(), root.get())); 95 LayerTreesMatch(host_impl.active_tree()->root_layer(), root.get()));
95 } 96 }
96 97
97 TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) { 98 TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) {
98 FakeImplTaskRunnerProvider task_runner_provider; 99 FakeImplTaskRunnerProvider task_runner_provider;
99 TestSharedBitmapManager shared_bitmap_manager; 100 TestSharedBitmapManager shared_bitmap_manager;
100 TestTaskGraphRunner task_graph_runner; 101 TestTaskGraphRunner task_graph_runner;
101 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 102 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
102 &task_graph_runner); 103 &task_graph_runner);
103 LayerTreeImpl* tree = host_impl.active_tree(); 104 LayerTreeImpl* tree = host_impl.active_tree();
104 105
105 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); 106 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
106 std::unique_ptr<LayerImpl> touch_layer(LayerImpl::Create(tree, 2)); 107 std::unique_ptr<LayerImpl> touch_layer(LayerImpl::Create(tree, 2));
107 108
108 root_impl->SetBounds(gfx::Size(100, 100)); 109 root_impl->SetBounds(gfx::Size(100, 100));
109 touch_layer->SetBounds(gfx::Size(50, 50)); 110 touch_layer->SetBounds(gfx::Size(50, 50));
110 111
111 Region touch_region; 112 Region touch_region;
112 touch_region.Union(gfx::Rect(10, 10, 20, 30)); 113 touch_region.Union(gfx::Rect(10, 10, 20, 30));
113 touch_region.Union(gfx::Rect(40, 10, 20, 20)); 114 touch_region.Union(gfx::Rect(40, 10, 20, 20));
114 touch_layer->SetTouchEventHandlerRegion(touch_region); 115 touch_layer->SetTouchEventHandlerRegion(touch_region);
115 116
116 root_impl->test_properties()->AddChild(std::move(touch_layer)); 117 root_impl->test_properties()->AddChild(std::move(touch_layer));
117 tree->SetRootLayer(std::move(root_impl)); 118 tree->SetRootLayer(std::move(root_impl));
119 tree->BuildLayerListForTesting();
118 120
119 std::string json = host_impl.LayerTreeAsJson(); 121 std::string json = host_impl.LayerTreeAsJson();
120 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); 122 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL);
121 ASSERT_TRUE(root.get()); 123 ASSERT_TRUE(root.get());
122 EXPECT_TRUE( 124 EXPECT_TRUE(
123 LayerTreesMatch(host_impl.active_tree()->root_layer(), root.get())); 125 LayerTreesMatch(host_impl.active_tree()->root_layer(), root.get()));
124 } 126 }
125 127
126 } // namespace cc 128 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698