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

Unified Diff: cc/layers/surface_layer_unittest.cc

Issue 2905533002: cc : Store surface layer ids on LayerTreeHost and push them at commit (Closed)
Patch Set: initialize Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/surface_layer_impl.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/surface_layer_unittest.cc
diff --git a/cc/layers/surface_layer_unittest.cc b/cc/layers/surface_layer_unittest.cc
index 4c354a7a5f6100ddd6a008a9972d3b2b2ab9aaab..9662d234ed11f4d5727c0a868567c16002a4475a 100644
--- a/cc/layers/surface_layer_unittest.cc
+++ b/cc/layers/surface_layer_unittest.cc
@@ -159,11 +159,31 @@ TEST_F(SurfaceLayerTest, SurfaceInfoPushProperties) {
1.f, gfx::Size(1, 1));
layer->SetPrimarySurfaceInfo(primary_info);
+ // As surface synchronization is not enabled, the primary surface id should
+ // be recorded on the layer tree host.
+ EXPECT_FALSE(layer_tree_host_->GetSettings().enable_surface_synchronization);
+ EXPECT_TRUE(layer_tree_host_->needs_surface_ids_sync());
+ EXPECT_EQ(layer_tree_host_->SurfaceLayerIds().size(), 1u);
+
+ // Verify that pending tree has no surface ids already.
+ EXPECT_FALSE(host_impl_.pending_tree()->needs_surface_ids_sync());
+ EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 0u);
+
std::unique_ptr<SurfaceLayerImpl> layer_impl =
SurfaceLayerImpl::Create(host_impl_.pending_tree(), layer->id());
- layer->PushPropertiesTo(layer_impl.get());
+ TreeSynchronizer::PushLayerProperties(layer_tree_host_.get(),
+ host_impl_.pending_tree());
+ layer_tree_host_->PushSurfaceIdsTo(host_impl_.pending_tree());
+
+ // Verify that pending tree received the surface id and also has
+ // needs_surface_ids_sync set to true as it needs to sync with active tree.
+ EXPECT_TRUE(host_impl_.pending_tree()->needs_surface_ids_sync());
+ EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u);
+
+ // Verify we have reset the state on layer tree host.
+ EXPECT_FALSE(layer_tree_host_->needs_surface_ids_sync());
- // Verify tha the primary SurfaceInfo is pushed through and that there is
+ // Verify that the primary SurfaceInfo is pushed through and that there is
// no valid fallback SurfaceInfo.
EXPECT_EQ(primary_info, layer_impl->primary_surface_info());
EXPECT_EQ(SurfaceInfo(), layer_impl->fallback_surface_info());
@@ -173,7 +193,17 @@ TEST_F(SurfaceLayerTest, SurfaceInfoPushProperties) {
LocalSurfaceId(2, base::UnguessableToken::Create())),
2.f, gfx::Size(10, 10));
layer->SetFallbackSurfaceInfo(fallback_info);
- layer->PushPropertiesTo(layer_impl.get());
+
+ // Verify that fallback surface id is not recorded on the layer tree host as
+ // surface synchronization is not enabled.
+ EXPECT_FALSE(layer_tree_host_->needs_surface_ids_sync());
+ EXPECT_EQ(layer_tree_host_->SurfaceLayerIds().size(), 1u);
+
+ TreeSynchronizer::PushLayerProperties(layer_tree_host_.get(),
+ host_impl_.pending_tree());
+ layer_tree_host_->PushSurfaceIdsTo(host_impl_.pending_tree());
+
+ EXPECT_EQ(host_impl_.pending_tree()->SurfaceLayerIds().size(), 1u);
// Verify that the primary SurfaceInfo stays the same and the new fallback
// SurfaceInfo is pushed through.
« no previous file with comments | « cc/layers/surface_layer_impl.cc ('k') | cc/trees/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698