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

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

Issue 502203003: Remove implicit conversions from scoped_refptr to T* in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change to use .get() instead of rewriting local variable Created 6 years, 4 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/scheduler/scheduler_unittest.cc ('k') | no next file » | 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 "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host.h" 9 #include "cc/test/fake_layer_tree_host.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->have_wheel_event_handlers(), 43 RETURN_IF_EXPECTATION_FAILS(EXPECT_EQ(layer_impl->have_wheel_event_handlers(),
44 layer->have_wheel_event_handlers())); 44 layer->have_wheel_event_handlers()));
45 RETURN_IF_EXPECTATION_FAILS( 45 RETURN_IF_EXPECTATION_FAILS(
46 EXPECT_EQ(layer_impl->have_scroll_event_handlers(), 46 EXPECT_EQ(layer_impl->have_scroll_event_handlers(),
47 layer->have_scroll_event_handlers())); 47 layer->have_scroll_event_handlers()));
48 RETURN_IF_EXPECTATION_FAILS( 48 RETURN_IF_EXPECTATION_FAILS(
49 EXPECT_EQ(layer_impl->touch_event_handler_region(), 49 EXPECT_EQ(layer_impl->touch_event_handler_region(),
50 layer->touch_event_handler_region())); 50 layer->touch_event_handler_region()));
51 51
52 for (size_t i = 0; i < layer_impl->children().size(); ++i) { 52 for (size_t i = 0; i < layer_impl->children().size(); ++i) {
53 RETURN_IF_EXPECTATION_FAILS( 53 RETURN_IF_EXPECTATION_FAILS(EXPECT_TRUE(LayerTreesMatch(
54 EXPECT_TRUE(LayerTreesMatch(layer_impl->children()[i], 54 layer_impl->children()[i], layer->children()[i].get())));
55 layer->children()[i])));
56 } 55 }
57 56
58 return true; 57 return true;
59 #undef RETURN_IF_EXPECTATION_FAILS 58 #undef RETURN_IF_EXPECTATION_FAILS
60 } 59 }
61 60
62 } // namespace 61 } // namespace
63 62
64 class LayerTreeJsonParserSanityCheck : public testing::Test { 63 class LayerTreeJsonParserSanityCheck : public testing::Test {
65 }; 64 };
(...skipping 16 matching lines...) Expand all
82 81
83 child->SetHaveWheelEventHandlers(true); 82 child->SetHaveWheelEventHandlers(true);
84 child->SetHaveScrollEventHandlers(true); 83 child->SetHaveScrollEventHandlers(true);
85 84
86 parent->AddChild(child.Pass()); 85 parent->AddChild(child.Pass());
87 root_impl->AddChild(parent.Pass()); 86 root_impl->AddChild(parent.Pass());
88 tree->SetRootLayer(root_impl.Pass()); 87 tree->SetRootLayer(root_impl.Pass());
89 88
90 std::string json = host_impl.LayerTreeAsJson(); 89 std::string json = host_impl.LayerTreeAsJson();
91 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); 90 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL);
92 ASSERT_TRUE(root); 91 ASSERT_TRUE(root.get());
93 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); 92 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get()));
94 } 93 }
95 94
96 TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) { 95 TEST_F(LayerTreeJsonParserSanityCheck, EventHandlerRegions) {
97 FakeImplProxy proxy; 96 FakeImplProxy proxy;
98 TestSharedBitmapManager shared_bitmap_manager; 97 TestSharedBitmapManager shared_bitmap_manager;
99 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager); 98 FakeLayerTreeHostImpl host_impl(&proxy, &shared_bitmap_manager);
100 LayerTreeImpl* tree = host_impl.active_tree(); 99 LayerTreeImpl* tree = host_impl.active_tree();
101 100
102 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1)); 101 scoped_ptr<LayerImpl> root_impl(LayerImpl::Create(tree, 1));
103 scoped_ptr<LayerImpl> touch_layer(LayerImpl::Create(tree, 2)); 102 scoped_ptr<LayerImpl> touch_layer(LayerImpl::Create(tree, 2));
104 103
105 root_impl->SetBounds(gfx::Size(100, 100)); 104 root_impl->SetBounds(gfx::Size(100, 100));
106 touch_layer->SetBounds(gfx::Size(50, 50)); 105 touch_layer->SetBounds(gfx::Size(50, 50));
107 106
108 Region touch_region; 107 Region touch_region;
109 touch_region.Union(gfx::Rect(10, 10, 20, 30)); 108 touch_region.Union(gfx::Rect(10, 10, 20, 30));
110 touch_region.Union(gfx::Rect(40, 10, 20, 20)); 109 touch_region.Union(gfx::Rect(40, 10, 20, 20));
111 touch_layer->SetTouchEventHandlerRegion(touch_region); 110 touch_layer->SetTouchEventHandlerRegion(touch_region);
112 111
113 root_impl->AddChild(touch_layer.Pass()); 112 root_impl->AddChild(touch_layer.Pass());
114 tree->SetRootLayer(root_impl.Pass()); 113 tree->SetRootLayer(root_impl.Pass());
115 114
116 std::string json = host_impl.LayerTreeAsJson(); 115 std::string json = host_impl.LayerTreeAsJson();
117 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL); 116 scoped_refptr<Layer> root = ParseTreeFromJson(json, NULL);
118 ASSERT_TRUE(root); 117 ASSERT_TRUE(root.get());
119 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get())); 118 EXPECT_TRUE(LayerTreesMatch(host_impl.RootLayer(), root.get()));
120 } 119 }
121 120
122 } // namespace cc 121 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698