[TreesInViz] Fix LegacySWPictureLayerImplTest.SnappedTilingDuringZoom.

The tiling removal is delayed due to pending viz to confirm, thus
we need to adjust expected remaining tiling count in the test.

TEST=cc_unittests

Bug: 448683984
Change-Id: Ibe85a3ba9c006ad60875ccd96dfa646ceb68cb28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7257194
Reviewed-by: Victor Miura <vmiura@chromium.org>
Commit-Queue: Victor Miura <vmiura@chromium.org>
Auto-Submit: Zhenyao Mo <zmo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1558323}
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index fe69ff3..524dc7c 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -77,6 +77,10 @@
     EXPECT_FALSE(active_layer()->expression);  \
   } while (false)
 
+bool TreesInViz() {
+  return base::FeatureList::IsEnabled(features::kTreesInViz);
+}
+
 class PictureLayerImplTest : public TestLayerTreeHostBase {
  public:
   void SetUp() override {
@@ -838,10 +842,16 @@
 
   // Zoom in a lot. Since we move in factors of two, we should get a scale that
   // is a power of 2 times 0.24. The tile at the lowest scale factor is now out
-  // of range and should be cleaned up as a result, leaving the number of tiles
-  // still at 3 due to the addition and removal.
+  // of range and should be cleaned up as a result. In non TreesInViz mode, this
+  // leaves the number of tiles still at 3 due to the addition and removal.
+  // In TreesInViz mode, due to tiling removal is delayed, the number of tiles
+  // is 4 due to the addition and delayed removal, pending viz to confirm.
   SetContentsScaleOnBothLayers(1.f, 1.0f, 1.f);
-  ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
+  if (TreesInViz()) {
+    ASSERT_EQ(4u, active_layer()->tilings()->num_tilings());
+  } else {
+    ASSERT_EQ(3u, active_layer()->tilings()->num_tilings());
+  }
   EXPECT_FLOAT_EQ(
       1.92f, active_layer()->tilings()->tiling_at(0)->contents_scale_key());
 }
diff --git a/testing/buildbot/filters/trees_in_viz.cc_unittests.filter b/testing/buildbot/filters/trees_in_viz.cc_unittests.filter
index 6b8aadb..a41a147 100644
--- a/testing/buildbot/filters/trees_in_viz.cc_unittests.filter
+++ b/testing/buildbot/filters/trees_in_viz.cc_unittests.filter
@@ -15,9 +15,5 @@
 
 # TODO(crbug.com/448683984) These tests fails with TreesInViz because the
 # tiling removal optimization during pinch zoom is disabled which might impact
-# the test expectations. Note that the test
-# LegacySWPictureLayerImplTest.SnappedTilingDuringZoom fails both with and
-# without TreesInViz enabled which indicates that test expectation depends on
-# tiling removal optimizations
--LayerTreeHostTestCrispUpAfterPinchEnds.RunMultiThread_DelegatingRenderer
--LegacySWPictureLayerImplTest.SnappedTilingDuringZoom
\ No newline at end of file
+# the test expectations.
+-LayerTreeHostTestCrispUpAfterPinchEnds.RunMultiThread_DelegatingRenderer
\ No newline at end of file