OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 new testing::NiceMock<MockSurfaceReferenceFactory>(); | 152 new testing::NiceMock<MockSurfaceReferenceFactory>(); |
153 | 153 |
154 scoped_refptr<SurfaceLayer> layer = SurfaceLayer::Create(ref_factory); | 154 scoped_refptr<SurfaceLayer> layer = SurfaceLayer::Create(ref_factory); |
155 layer_tree_host_->SetRootLayer(layer); | 155 layer_tree_host_->SetRootLayer(layer); |
156 SurfaceInfo primary_info( | 156 SurfaceInfo primary_info( |
157 SurfaceId(kArbitraryFrameSinkId, | 157 SurfaceId(kArbitraryFrameSinkId, |
158 LocalSurfaceId(1, base::UnguessableToken::Create())), | 158 LocalSurfaceId(1, base::UnguessableToken::Create())), |
159 1.f, gfx::Size(1, 1)); | 159 1.f, gfx::Size(1, 1)); |
160 layer->SetPrimarySurfaceInfo(primary_info); | 160 layer->SetPrimarySurfaceInfo(primary_info); |
161 | 161 |
| 162 // As surface synchronization is not enabled, the primary surface id should |
| 163 // be recorded on the layer tree host. |
| 164 EXPECT_FALSE(layer_tree_host_->GetSettings().enable_surface_synchronization); |
| 165 EXPECT_TRUE(layer_tree_host_->needs_surface_ids_sync()); |
| 166 EXPECT_EQ(layer_tree_host_->SurfaceLayerIds().size(), 1u); |
| 167 |
| 168 // Verify that pending tree has no surface ids already. |
| 169 EXPECT_FALSE(host_impl_.pending_tree()->needs_surface_ids_sync()); |
| 170 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 0u); |
| 171 |
162 std::unique_ptr<SurfaceLayerImpl> layer_impl = | 172 std::unique_ptr<SurfaceLayerImpl> layer_impl = |
163 SurfaceLayerImpl::Create(host_impl_.pending_tree(), layer->id()); | 173 SurfaceLayerImpl::Create(host_impl_.pending_tree(), layer->id()); |
164 layer->PushPropertiesTo(layer_impl.get()); | 174 TreeSynchronizer::PushLayerProperties(layer_tree_host_.get(), |
| 175 host_impl_.pending_tree()); |
| 176 layer_tree_host_->PushSurfaceIdsTo(host_impl_.pending_tree()); |
165 | 177 |
166 // Verify tha the primary SurfaceInfo is pushed through and that there is | 178 // Verify that pending tree received the surface id and also has |
| 179 // needs_surface_ids_sync set to true as it needs to sync with active tree. |
| 180 EXPECT_TRUE(host_impl_.pending_tree()->needs_surface_ids_sync()); |
| 181 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u); |
| 182 |
| 183 // Verify we have reset the state on layer tree host. |
| 184 EXPECT_FALSE(layer_tree_host_->needs_surface_ids_sync()); |
| 185 |
| 186 // Verify that the primary SurfaceInfo is pushed through and that there is |
167 // no valid fallback SurfaceInfo. | 187 // no valid fallback SurfaceInfo. |
168 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); | 188 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); |
169 EXPECT_EQ(SurfaceInfo(), layer_impl->fallback_surface_info()); | 189 EXPECT_EQ(SurfaceInfo(), layer_impl->fallback_surface_info()); |
170 | 190 |
171 SurfaceInfo fallback_info( | 191 SurfaceInfo fallback_info( |
172 SurfaceId(kArbitraryFrameSinkId, | 192 SurfaceId(kArbitraryFrameSinkId, |
173 LocalSurfaceId(2, base::UnguessableToken::Create())), | 193 LocalSurfaceId(2, base::UnguessableToken::Create())), |
174 2.f, gfx::Size(10, 10)); | 194 2.f, gfx::Size(10, 10)); |
175 layer->SetFallbackSurfaceInfo(fallback_info); | 195 layer->SetFallbackSurfaceInfo(fallback_info); |
176 layer->PushPropertiesTo(layer_impl.get()); | 196 |
| 197 // Verify that fallback surface id is not recorded on the layer tree host as |
| 198 // surface synchronization is not enabled. |
| 199 EXPECT_FALSE(layer_tree_host_->needs_surface_ids_sync()); |
| 200 EXPECT_EQ(layer_tree_host_->SurfaceLayerIds().size(), 1u); |
| 201 |
| 202 TreeSynchronizer::PushLayerProperties(layer_tree_host_.get(), |
| 203 host_impl_.pending_tree()); |
| 204 layer_tree_host_->PushSurfaceIdsTo(host_impl_.pending_tree()); |
| 205 |
| 206 EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u); |
177 | 207 |
178 // Verify that the primary SurfaceInfo stays the same and the new fallback | 208 // Verify that the primary SurfaceInfo stays the same and the new fallback |
179 // SurfaceInfo is pushed through. | 209 // SurfaceInfo is pushed through. |
180 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); | 210 EXPECT_EQ(primary_info, layer_impl->primary_surface_info()); |
181 EXPECT_EQ(fallback_info, layer_impl->fallback_surface_info()); | 211 EXPECT_EQ(fallback_info, layer_impl->fallback_surface_info()); |
182 } | 212 } |
183 | 213 |
184 // Check that SurfaceSequence is sent through swap promise. | 214 // Check that SurfaceSequence is sent through swap promise. |
185 class SurfaceLayerSwapPromise : public LayerTreeTest { | 215 class SurfaceLayerSwapPromise : public LayerTreeTest { |
186 public: | 216 public: |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 EndTest(); | 328 EndTest(); |
299 break; | 329 break; |
300 } | 330 } |
301 } | 331 } |
302 }; | 332 }; |
303 | 333 |
304 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw); | 334 MULTI_THREAD_TEST_F(SurfaceLayerSwapPromiseWithoutDraw); |
305 | 335 |
306 } // namespace | 336 } // namespace |
307 } // namespace cc | 337 } // namespace cc |
OLD | NEW |