OLD | NEW |
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/layers/layer_settings.h" | 9 #include "cc/layers/layer_settings.h" |
10 #include "cc/proto/layer.pb.h" | 10 #include "cc/proto/layer.pb.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 layer_tree_host_dst_->has_transparent_background_); | 100 layer_tree_host_dst_->has_transparent_background_); |
101 EXPECT_EQ(layer_tree_host_src_->in_paint_layer_contents_, | 101 EXPECT_EQ(layer_tree_host_src_->in_paint_layer_contents_, |
102 layer_tree_host_dst_->in_paint_layer_contents_); | 102 layer_tree_host_dst_->in_paint_layer_contents_); |
103 EXPECT_EQ(layer_tree_host_src_->id_, layer_tree_host_dst_->id_); | 103 EXPECT_EQ(layer_tree_host_src_->id_, layer_tree_host_dst_->id_); |
104 EXPECT_EQ(layer_tree_host_src_->next_commit_forces_redraw_, | 104 EXPECT_EQ(layer_tree_host_src_->next_commit_forces_redraw_, |
105 layer_tree_host_dst_->next_commit_forces_redraw_); | 105 layer_tree_host_dst_->next_commit_forces_redraw_); |
106 | 106 |
107 if (layer_tree_host_src_->hud_layer_) { | 107 if (layer_tree_host_src_->hud_layer_) { |
108 EXPECT_EQ(layer_tree_host_src_->hud_layer_->id(), | 108 EXPECT_EQ(layer_tree_host_src_->hud_layer_->id(), |
109 layer_tree_host_dst_->hud_layer_->id()); | 109 layer_tree_host_dst_->hud_layer_->id()); |
| 110 // The HUD layer member is a HeadsUpDisplayLayer instead of Layer, so |
| 111 // inspect the proto to see if it contains the the right layer type. |
| 112 bool found_hud_layer_type = false; |
| 113 for (int i = 0; i < proto.root_layer().children_size(); ++i) { |
| 114 if (proto.root_layer().children(i).id() == |
| 115 layer_tree_host_src_->hud_layer_->id()) { |
| 116 EXPECT_EQ(proto::HEADS_UP_DISPLAY_LAYER, |
| 117 proto.root_layer().children(i).type()); |
| 118 found_hud_layer_type = true; |
| 119 break; |
| 120 } |
| 121 } |
| 122 EXPECT_TRUE(found_hud_layer_type); |
110 } else { | 123 } else { |
111 EXPECT_EQ(nullptr, layer_tree_host_dst_->hud_layer_); | 124 EXPECT_EQ(nullptr, layer_tree_host_dst_->hud_layer_); |
112 } | 125 } |
113 if (layer_tree_host_src_->overscroll_elasticity_layer_) { | 126 if (layer_tree_host_src_->overscroll_elasticity_layer_) { |
114 EXPECT_EQ(layer_tree_host_src_->overscroll_elasticity_layer_->id(), | 127 EXPECT_EQ(layer_tree_host_src_->overscroll_elasticity_layer_->id(), |
115 layer_tree_host_dst_->overscroll_elasticity_layer_->id()); | 128 layer_tree_host_dst_->overscroll_elasticity_layer_->id()); |
116 } else { | 129 } else { |
117 EXPECT_EQ(nullptr, layer_tree_host_dst_->overscroll_elasticity_layer_); | 130 EXPECT_EQ(nullptr, layer_tree_host_dst_->overscroll_elasticity_layer_); |
118 } | 131 } |
119 if (layer_tree_host_src_->page_scale_layer_) { | 132 if (layer_tree_host_src_->page_scale_layer_) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 317 |
305 TEST_F(LayerTreeHostSerializationTest, LayersChanged) { | 318 TEST_F(LayerTreeHostSerializationTest, LayersChanged) { |
306 RunLayersChangedTest(); | 319 RunLayersChangedTest(); |
307 } | 320 } |
308 | 321 |
309 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) { | 322 TEST_F(LayerTreeHostSerializationTest, LayersChangedMultipleSerializations) { |
310 LayersChangedMultipleSerializations(); | 323 LayersChangedMultipleSerializations(); |
311 } | 324 } |
312 | 325 |
313 } // namespace cc | 326 } // namespace cc |
OLD | NEW |