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

Side by Side Diff: cc/layers/layer_proto_converter_unittest.cc

Issue 2331983002: cc: Make LayerTreeHost a protected Layer member. (Closed)
Patch Set: settings Created 4 years, 3 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/layers/layer.h ('k') | cc/layers/layer_unittest.cc » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/layers/layer_proto_converter.h" 5 #include "cc/layers/layer_proto_converter.h"
6 6
7 #include "cc/layers/empty_content_layer_client.h" 7 #include "cc/layers/empty_content_layer_client.h"
8 #include "cc/layers/heads_up_display_layer.h" 8 #include "cc/layers/heads_up_display_layer.h"
9 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
10 #include "cc/layers/picture_layer.h" 10 #include "cc/layers/picture_layer.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 layer_src_root->SetLayerTreeHost(layer_tree_host_.get()); 189 layer_src_root->SetLayerTreeHost(layer_tree_host_.get());
190 layer_src_root->AddChild(layer_src_a); 190 layer_src_root->AddChild(layer_src_a);
191 layer_src_root->AddChild(layer_src_b); 191 layer_src_root->AddChild(layer_src_b);
192 layer_src_a->AddChild(layer_src_c); 192 layer_src_a->AddChild(layer_src_c);
193 layer_src_b->AddChild(layer_src_d); 193 layer_src_b->AddChild(layer_src_d);
194 layer_src_b->SetMaskLayer(layer_src_b_mask.get()); 194 layer_src_b->SetMaskLayer(layer_src_b_mask.get());
195 layer_src_b->SetReplicaLayer(layer_src_b_replica.get()); 195 layer_src_b->SetReplicaLayer(layer_src_b_replica.get());
196 196
197 proto::LayerUpdate layer_update; 197 proto::LayerUpdate layer_update;
198 LayerProtoConverter::SerializeLayerProperties( 198 LayerProtoConverter::SerializeLayerProperties(
199 layer_src_root->layer_tree_host(), &layer_update); 199 layer_src_root->GetLayerTreeHostForTesting(), &layer_update);
200 200
201 // All flags for pushing properties should have been cleared. 201 // All flags for pushing properties should have been cleared.
202 EXPECT_FALSE( 202 EXPECT_FALSE(
203 layer_src_root->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 203 layer_src_root->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
204 layer_src_root.get())); 204 layer_src_root.get()));
205 EXPECT_FALSE(layer_src_a->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 205 EXPECT_FALSE(layer_src_a->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
206 layer_src_a.get())); 206 layer_src_a.get()));
207 EXPECT_FALSE(layer_src_b->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 207 EXPECT_FALSE(layer_src_b->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
208 layer_src_b.get())); 208 layer_src_b.get()));
209 EXPECT_FALSE( 209 EXPECT_FALSE(
(...skipping 15 matching lines...) Expand all
225 layer_src_a->SetNeedsPushProperties(); 225 layer_src_a->SetNeedsPushProperties();
226 dirty_layer_ids.insert(layer_src_a->id()); 226 dirty_layer_ids.insert(layer_src_a->id());
227 layer_src_b->SetNeedsPushProperties(); 227 layer_src_b->SetNeedsPushProperties();
228 dirty_layer_ids.insert(layer_src_b->id()); 228 dirty_layer_ids.insert(layer_src_b->id());
229 layer_src_b_mask->SetNeedsPushProperties(); 229 layer_src_b_mask->SetNeedsPushProperties();
230 dirty_layer_ids.insert(layer_src_b_mask->id()); 230 dirty_layer_ids.insert(layer_src_b_mask->id());
231 layer_src_d->SetNeedsPushProperties(); 231 layer_src_d->SetNeedsPushProperties();
232 dirty_layer_ids.insert(layer_src_d->id()); 232 dirty_layer_ids.insert(layer_src_d->id());
233 233
234 LayerProtoConverter::SerializeLayerProperties( 234 LayerProtoConverter::SerializeLayerProperties(
235 layer_src_root->layer_tree_host(), &layer_update); 235 layer_src_root->GetLayerTreeHostForTesting(), &layer_update);
236 236
237 // All flags for pushing properties should have been cleared. 237 // All flags for pushing properties should have been cleared.
238 EXPECT_FALSE( 238 EXPECT_FALSE(
239 layer_src_root->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 239 layer_src_root->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
240 layer_src_root.get())); 240 layer_src_root.get()));
241 EXPECT_FALSE(layer_src_a->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 241 EXPECT_FALSE(layer_src_a->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
242 layer_src_a.get())); 242 layer_src_a.get()));
243 EXPECT_FALSE(layer_src_b->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 243 EXPECT_FALSE(layer_src_b->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
244 layer_src_b.get())); 244 layer_src_b.get()));
245 EXPECT_FALSE( 245 EXPECT_FALSE(
(...skipping 30 matching lines...) Expand all
276 scoped_refptr<Layer> layer_src_b = Layer::Create(); 276 scoped_refptr<Layer> layer_src_b = Layer::Create();
277 scoped_refptr<Layer> layer_src_b_mask = Layer::Create(); 277 scoped_refptr<Layer> layer_src_b_mask = Layer::Create();
278 scoped_refptr<Layer> layer_src_c = Layer::Create(); 278 scoped_refptr<Layer> layer_src_c = Layer::Create();
279 layer_src_root->AddChild(layer_src_b); 279 layer_src_root->AddChild(layer_src_b);
280 layer_src_b->AddChild(layer_src_c); 280 layer_src_b->AddChild(layer_src_c);
281 layer_src_b->SetMaskLayer(layer_src_b_mask.get()); 281 layer_src_b->SetMaskLayer(layer_src_b_mask.get());
282 layer_src_root->SetLayerTreeHost(layer_tree_host_.get()); 282 layer_src_root->SetLayerTreeHost(layer_tree_host_.get());
283 283
284 proto::LayerUpdate layer_update; 284 proto::LayerUpdate layer_update;
285 LayerProtoConverter::SerializeLayerProperties( 285 LayerProtoConverter::SerializeLayerProperties(
286 layer_src_root->layer_tree_host(), &layer_update); 286 layer_src_root->GetLayerTreeHostForTesting(), &layer_update);
287 // All layers need to push properties as their layer tree host changed. 287 // All layers need to push properties as their layer tree host changed.
288 ASSERT_EQ(4, layer_update.layers_size()); 288 ASSERT_EQ(4, layer_update.layers_size());
289 layer_update.Clear(); 289 layer_update.Clear();
290 290
291 std::unordered_set<int> dirty_layer_ids; 291 std::unordered_set<int> dirty_layer_ids;
292 layer_src_b->SetNeedsPushProperties(); 292 layer_src_b->SetNeedsPushProperties();
293 dirty_layer_ids.insert(layer_src_b->id()); 293 dirty_layer_ids.insert(layer_src_b->id());
294 layer_src_b_mask->SetNeedsPushProperties(); 294 layer_src_b_mask->SetNeedsPushProperties();
295 dirty_layer_ids.insert(layer_src_b_mask->id()); 295 dirty_layer_ids.insert(layer_src_b_mask->id());
296 296
297 LayerProtoConverter::SerializeLayerProperties( 297 LayerProtoConverter::SerializeLayerProperties(
298 layer_src_root->layer_tree_host(), &layer_update); 298 layer_src_root->GetLayerTreeHostForTesting(), &layer_update);
299 299
300 // All flags for pushing properties should have been cleared. 300 // All flags for pushing properties should have been cleared.
301 EXPECT_FALSE( 301 EXPECT_FALSE(
302 layer_src_root->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 302 layer_src_root->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
303 layer_src_root.get())); 303 layer_src_root.get()));
304 EXPECT_FALSE(layer_src_b->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 304 EXPECT_FALSE(layer_src_b->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
305 layer_src_b.get())); 305 layer_src_b.get()));
306 EXPECT_FALSE( 306 EXPECT_FALSE(
307 layer_src_b_mask->GetLayerTree()->LayerNeedsPushPropertiesForTesting( 307 layer_src_b_mask->GetLayerTree()->LayerNeedsPushPropertiesForTesting(
308 layer_src_b_mask.get())); 308 layer_src_b_mask.get()));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // serialize to. 382 // serialize to.
383 proto::LayerNode layer_node; 383 proto::LayerNode layer_node;
384 new_root->SetTypeForProtoSerialization(&layer_node); 384 new_root->SetTypeForProtoSerialization(&layer_node);
385 EXPECT_EQ(proto::LayerNode::HEADS_UP_DISPLAY_LAYER, layer_node.type()); 385 EXPECT_EQ(proto::LayerNode::HEADS_UP_DISPLAY_LAYER, layer_node.type());
386 386
387 new_root->SetLayerTreeHost(nullptr); 387 new_root->SetLayerTreeHost(nullptr);
388 } 388 }
389 389
390 } // namespace 390 } // namespace
391 } // namespace cc 391 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698