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

Side by Side Diff: cc/trees/layer_tree_host_unittest_serialization.cc

Issue 1808373002: cc : Make tree synchronization independent of layer tree hierarchy (2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "cc/layers/heads_up_display_layer.h" 7 #include "cc/layers/heads_up_display_layer.h"
8 #include "cc/layers/layer.h" 8 #include "cc/layers/layer.h"
9 #include "cc/proto/layer.pb.h" 9 #include "cc/proto/layer.pb.h"
10 #include "cc/proto/layer_tree_host.pb.h" 10 #include "cc/proto/layer_tree_host.pb.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 // Need to reset root layer and LayerTreeHost pointers before tear down. 43 // Need to reset root layer and LayerTreeHost pointers before tear down.
44 layer_tree_host_src_->SetRootLayer(nullptr); 44 layer_tree_host_src_->SetRootLayer(nullptr);
45 layer_tree_host_src_ = nullptr; 45 layer_tree_host_src_ = nullptr;
46 layer_tree_host_dst_->SetRootLayer(nullptr); 46 layer_tree_host_dst_->SetRootLayer(nullptr);
47 layer_tree_host_dst_ = nullptr; 47 layer_tree_host_dst_ = nullptr;
48 } 48 }
49 49
50 void VerifySerializationAndDeserialization() { 50 void VerifySerializationAndDeserialization() {
51 proto::LayerTreeHost proto; 51 proto::LayerTreeHost proto;
52
53 std::unordered_set<Layer*> layers_that_should_push_properties_src_ =
ajuma 2016/03/21 13:41:20 Nit: local variable name shouldn't end with an und
jaydasika 2016/03/21 17:32:03 Done.
54 layer_tree_host_src_->LayersThatShouldPushProperties();
52 layer_tree_host_src_->ToProtobufForCommit(&proto); 55 layer_tree_host_src_->ToProtobufForCommit(&proto);
53 layer_tree_host_dst_->FromProtobufForCommit(proto); 56 layer_tree_host_dst_->FromProtobufForCommit(proto);
54 57
55 EXPECT_EQ(layer_tree_host_src_->needs_full_tree_sync_, 58 EXPECT_EQ(layer_tree_host_src_->needs_full_tree_sync_,
56 layer_tree_host_dst_->needs_full_tree_sync_); 59 layer_tree_host_dst_->needs_full_tree_sync_);
57 EXPECT_EQ(layer_tree_host_src_->needs_meta_info_recomputation_, 60 EXPECT_EQ(layer_tree_host_src_->needs_meta_info_recomputation_,
58 layer_tree_host_dst_->needs_meta_info_recomputation_); 61 layer_tree_host_dst_->needs_meta_info_recomputation_);
59 EXPECT_EQ(layer_tree_host_src_->source_frame_number_, 62 EXPECT_EQ(layer_tree_host_src_->source_frame_number_,
60 layer_tree_host_dst_->source_frame_number_); 63 layer_tree_host_dst_->source_frame_number_);
61 EXPECT_EQ(layer_tree_host_src_->meta_information_sequence_number_, 64 EXPECT_EQ(layer_tree_host_src_->meta_information_sequence_number_,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 layer_tree_host_dst_->content_is_suitable_for_gpu_rasterization_); 98 layer_tree_host_dst_->content_is_suitable_for_gpu_rasterization_);
96 EXPECT_EQ(layer_tree_host_src_->background_color_, 99 EXPECT_EQ(layer_tree_host_src_->background_color_,
97 layer_tree_host_dst_->background_color_); 100 layer_tree_host_dst_->background_color_);
98 EXPECT_EQ(layer_tree_host_src_->has_transparent_background_, 101 EXPECT_EQ(layer_tree_host_src_->has_transparent_background_,
99 layer_tree_host_dst_->has_transparent_background_); 102 layer_tree_host_dst_->has_transparent_background_);
100 EXPECT_EQ(layer_tree_host_src_->in_paint_layer_contents_, 103 EXPECT_EQ(layer_tree_host_src_->in_paint_layer_contents_,
101 layer_tree_host_dst_->in_paint_layer_contents_); 104 layer_tree_host_dst_->in_paint_layer_contents_);
102 EXPECT_EQ(layer_tree_host_src_->id_, layer_tree_host_dst_->id_); 105 EXPECT_EQ(layer_tree_host_src_->id_, layer_tree_host_dst_->id_);
103 EXPECT_EQ(layer_tree_host_src_->next_commit_forces_redraw_, 106 EXPECT_EQ(layer_tree_host_src_->next_commit_forces_redraw_,
104 layer_tree_host_dst_->next_commit_forces_redraw_); 107 layer_tree_host_dst_->next_commit_forces_redraw_);
108 for (auto layer : layers_that_should_push_properties_src_) {
109 EXPECT_TRUE(layer_tree_host_dst_->LayerNeedsPushPropertiesForTesting(
110 layer_tree_host_dst_->LayerById(layer->id())));
111 }
105 112
106 if (layer_tree_host_src_->hud_layer_) { 113 if (layer_tree_host_src_->hud_layer_) {
107 EXPECT_EQ(layer_tree_host_src_->hud_layer_->id(), 114 EXPECT_EQ(layer_tree_host_src_->hud_layer_->id(),
108 layer_tree_host_dst_->hud_layer_->id()); 115 layer_tree_host_dst_->hud_layer_->id());
109 // The HUD layer member is a HeadsUpDisplayLayer instead of Layer, so 116 // The HUD layer member is a HeadsUpDisplayLayer instead of Layer, so
110 // inspect the proto to see if it contains the the right layer type. 117 // inspect the proto to see if it contains the the right layer type.
111 bool found_hud_layer_type = false; 118 bool found_hud_layer_type = false;
112 for (int i = 0; i < proto.root_layer().children_size(); ++i) { 119 for (int i = 0; i < proto.root_layer().children_size(); ++i) {
113 if (proto.root_layer().children(i).id() == 120 if (proto.root_layer().children(i).id() ==
114 layer_tree_host_src_->hud_layer_->id()) { 121 layer_tree_host_src_->hud_layer_->id()) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 323
317 TEST_F(LayerTreeHostSerializationTest, LayersChanged) { 324 TEST_F(LayerTreeHostSerializationTest, LayersChanged) {
318 RunLayersChangedTest(); 325 RunLayersChangedTest();
319 } 326 }
320 327
321 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) { 328 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) {
322 LayersChangedMultipleSerializations(); 329 LayersChangedMultipleSerializations();
323 } 330 }
324 331
325 } // namespace cc 332 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698