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

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

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | cc/test/layer_tree_pixel_resource_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 }; 60 };
61 61
62 TEST_F(LayerTreeJsonParserSanityCheck, Basic) { 62 TEST_F(LayerTreeJsonParserSanityCheck, Basic) {
63 FakeImplTaskRunnerProvider task_runner_provider; 63 FakeImplTaskRunnerProvider task_runner_provider;
64 TestSharedBitmapManager shared_bitmap_manager; 64 TestSharedBitmapManager shared_bitmap_manager;
65 TestTaskGraphRunner task_graph_runner; 65 TestTaskGraphRunner task_graph_runner;
66 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 66 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
67 &task_graph_runner); 67 &task_graph_runner);
68 LayerTreeImpl* tree = host_impl.active_tree(); 68 LayerTreeImpl* tree = host_impl.active_tree();
69 69
70 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); 70 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
71 scoped_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2)); 71 std::unique_ptr<LayerImpl> parent(LayerImpl::Create(tree, 2));
72 scoped_ptr<LayerImpl> child(LayerImpl::Create(tree, 3)); 72 std::unique_ptr<LayerImpl> child(LayerImpl::Create(tree, 3));
73 73
74 root_impl->SetBounds(gfx::Size(100, 100)); 74 root_impl->SetBounds(gfx::Size(100, 100));
75 parent->SetBounds(gfx::Size(50, 50)); 75 parent->SetBounds(gfx::Size(50, 50));
76 child->SetBounds(gfx::Size(40, 40)); 76 child->SetBounds(gfx::Size(40, 40));
77 77
78 parent->SetPosition(gfx::PointF(25.f, 25.f)); 78 parent->SetPosition(gfx::PointF(25.f, 25.f));
79 79
80 parent->AddChild(std::move(child)); 80 parent->AddChild(std::move(child));
81 root_impl->AddChild(std::move(parent)); 81 root_impl->AddChild(std::move(parent));
82 tree->SetRootLayer(std::move(root_impl)); 82 tree->SetRootLayer(std::move(root_impl));
83 83
84 std::string json = host_impl.LayerTreeAsJson(); 84 std::string json = host_impl.LayerTreeAsJson();
85 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); 85 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL);
86 ASSERT_TRUE(root.get()); 86 ASSERT_TRUE(root.get());
87 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); 87 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get()));
88 } 88 }
89 89
90 TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) { 90 TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) {
91 FakeImplTaskRunnerProvider task_runner_provider; 91 FakeImplTaskRunnerProvider task_runner_provider;
92 TestSharedBitmapManager shared_bitmap_manager; 92 TestSharedBitmapManager shared_bitmap_manager;
93 TestTaskGraphRunner task_graph_runner; 93 TestTaskGraphRunner task_graph_runner;
94 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 94 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
95 &task_graph_runner); 95 &task_graph_runner);
96 LayerTreeImpl* tree = host_impl.active_tree(); 96 LayerTreeImpl* tree = host_impl.active_tree();
97 97
98 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); 98 std::unique_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
99 scoped_ptr<LayerImpl> touch_layer(LayerImpl::Create(tree, 2)); 99 std::unique_ptr<LayerImpl> touch_layer(LayerImpl::Create(tree, 2));
100 100
101 root_impl->SetBounds(gfx::Size(100, 100)); 101 root_impl->SetBounds(gfx::Size(100, 100));
102 touch_layer->SetBounds(gfx::Size(50, 50)); 102 touch_layer->SetBounds(gfx::Size(50, 50));
103 103
104 Region touch_region; 104 Region touch_region;
105 touch_region.Union(gfx::Rect(10, 10, 20, 30)); 105 touch_region.Union(gfx::Rect(10, 10, 20, 30));
106 touch_region.Union(gfx::Rect(40, 10, 20, 20)); 106 touch_region.Union(gfx::Rect(40, 10, 20, 20));
107 touch_layer->SetTouchEventHandlerRegion(touch_region); 107 touch_layer->SetTouchEventHandlerRegion(touch_region);
108 108
109 root_impl->AddChild(std::move(touch_layer)); 109 root_impl->AddChild(std::move(touch_layer));
110 tree->SetRootLayer(std::move(root_impl)); 110 tree->SetRootLayer(std::move(root_impl));
111 111
112 std::string json = host_impl.LayerTreeAsJson(); 112 std::string json = host_impl.LayerTreeAsJson();
113 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); 113 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL);
114 ASSERT_TRUE(root.get()); 114 ASSERT_TRUE(root.get());
115 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); 115 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get()));
116 } 116 }
117 117
118 } // namespace cc 118 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_json_parser.cc ('k') | cc/test/layer_tree_pixel_resource_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698