Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); | 280 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); |
| 281 EXPECT_LE(size_t(1), required_for_activation_count_); | 281 EXPECT_LE(size_t(1), required_for_activation_count_); |
| 282 } | 282 } |
| 283 | 283 |
| 284 private: | 284 private: |
| 285 FakeContentLayerClient client_; | 285 FakeContentLayerClient client_; |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 // No single thread test because the commit goes directly to the active tree in | 288 // No single thread test because the commit goes directly to the active tree in |
| 289 // single thread mode, so notify ready to activate is skipped. | 289 // single thread mode, so notify ready to activate is skipped. |
| 290 // No remote test because we currently don't deserialize FakePictureLayer, | 290 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty); |
| 291 // so on the impl side, PictureLayerImpl is created instead of | |
| 292 // FakePictureLayerImpl, see crbug/657871. | |
| 293 MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty); | |
| 294 | 291 |
| 295 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when | 292 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when |
| 296 // no raster tasks get scheduled. | 293 // no raster tasks get scheduled. |
| 297 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest { | 294 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest { |
| 298 public: | 295 public: |
| 299 LayerTreeHostTestReadyToDrawEmpty() | 296 LayerTreeHostTestReadyToDrawEmpty() |
| 300 : did_notify_ready_to_draw_(false), | 297 : did_notify_ready_to_draw_(false), |
| 301 all_tiles_required_for_draw_are_ready_to_draw_(false), | 298 all_tiles_required_for_draw_are_ready_to_draw_(false), |
| 302 required_for_draw_count_(0) {} | 299 required_for_draw_count_(0) {} |
| 303 | 300 |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1617 private: | 1614 private: |
| 1618 int num_draws_; | 1615 int num_draws_; |
| 1619 const gfx::Size bounds_; | 1616 const gfx::Size bounds_; |
| 1620 const gfx::Rect invalid_rect_; | 1617 const gfx::Rect invalid_rect_; |
| 1621 FakeContentLayerClient client_; | 1618 FakeContentLayerClient client_; |
| 1622 scoped_refptr<FakePictureLayer> root_layer_; | 1619 scoped_refptr<FakePictureLayer> root_layer_; |
| 1623 }; | 1620 }; |
| 1624 | 1621 |
| 1625 // As there's no pending tree in single-threaded case, this test should run | 1622 // As there's no pending tree in single-threaded case, this test should run |
| 1626 // only for multi-threaded case. | 1623 // only for multi-threaded case. |
| 1627 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); | 1624 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); |
| 1628 | 1625 |
| 1629 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { | 1626 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { |
| 1630 public: | 1627 public: |
| 1631 void InitializeSettings(LayerTreeSettings* settings) override { | 1628 void InitializeSettings(LayerTreeSettings* settings) override { |
| 1632 settings->layer_transforms_should_scale_layer_contents = true; | 1629 settings->layer_transforms_should_scale_layer_contents = true; |
| 1633 } | 1630 } |
| 1634 | 1631 |
| 1635 void SetupTree() override { | 1632 void SetupTree() override { |
| 1636 root_layer_ = Layer::Create(); | 1633 root_layer_ = Layer::Create(); |
| 1637 root_layer_->SetBounds(gfx::Size(10, 20)); | 1634 root_layer_->SetBounds(gfx::Size(10, 20)); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1667 void AfterTest() override { | 1664 void AfterTest() override { |
| 1668 EXPECT_EQ(gfx::Size(4, 4).ToString(), scaled_layer_->bounds().ToString()); | 1665 EXPECT_EQ(gfx::Size(4, 4).ToString(), scaled_layer_->bounds().ToString()); |
| 1669 } | 1666 } |
| 1670 | 1667 |
| 1671 private: | 1668 private: |
| 1672 FakeContentLayerClient client_; | 1669 FakeContentLayerClient client_; |
| 1673 scoped_refptr<Layer> root_layer_; | 1670 scoped_refptr<Layer> root_layer_; |
| 1674 scoped_refptr<Layer> scaled_layer_; | 1671 scoped_refptr<Layer> scaled_layer_; |
| 1675 }; | 1672 }; |
| 1676 | 1673 |
| 1677 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); | 1674 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); |
| 1678 | 1675 |
| 1679 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate | 1676 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate |
| 1680 : public LayerTreeHostTest { | 1677 : public LayerTreeHostTest { |
| 1681 public: | 1678 public: |
| 1682 void InitializeSettings(LayerTreeSettings* settings) override { | 1679 void InitializeSettings(LayerTreeSettings* settings) override { |
| 1683 settings->layer_transforms_should_scale_layer_contents = true; | 1680 settings->layer_transforms_should_scale_layer_contents = true; |
| 1684 } | 1681 } |
| 1685 | 1682 |
| 1686 void SetupTree() override { | 1683 void SetupTree() override { |
| 1687 root_layer_ = Layer::Create(); | 1684 root_layer_ = Layer::Create(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1724 } | 1721 } |
| 1725 | 1722 |
| 1726 void AfterTest() override {} | 1723 void AfterTest() override {} |
| 1727 | 1724 |
| 1728 private: | 1725 private: |
| 1729 FakeContentLayerClient client_; | 1726 FakeContentLayerClient client_; |
| 1730 scoped_refptr<Layer> root_layer_; | 1727 scoped_refptr<Layer> root_layer_; |
| 1731 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; | 1728 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; |
| 1732 }; | 1729 }; |
| 1733 | 1730 |
| 1731 // No remote test here because PaintedScrollbarLayer is not supported by LTH | |
| 1732 // remote. | |
| 1734 SINGLE_AND_MULTI_THREAD_TEST_F( | 1733 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1735 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); | 1734 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); |
| 1736 | 1735 |
| 1737 class LayerTreeHostTestDeviceScaleFactorChange : public LayerTreeHostTest { | 1736 class LayerTreeHostTestDeviceScaleFactorChange : public LayerTreeHostTest { |
| 1738 public: | 1737 public: |
| 1739 void InitializeSettings(LayerTreeSettings* settings) override { | 1738 void InitializeSettings(LayerTreeSettings* settings) override { |
| 1740 settings->layer_transforms_should_scale_layer_contents = true; | 1739 settings->layer_transforms_should_scale_layer_contents = true; |
| 1741 } | 1740 } |
| 1742 | 1741 |
| 1743 void SetupTree() override { | 1742 void SetupTree() override { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1791 } | 1790 } |
| 1792 | 1791 |
| 1793 void AfterTest() override {} | 1792 void AfterTest() override {} |
| 1794 | 1793 |
| 1795 private: | 1794 private: |
| 1796 FakeContentLayerClient client_; | 1795 FakeContentLayerClient client_; |
| 1797 scoped_refptr<Layer> root_layer_; | 1796 scoped_refptr<Layer> root_layer_; |
| 1798 scoped_refptr<Layer> child_layer_; | 1797 scoped_refptr<Layer> child_layer_; |
| 1799 }; | 1798 }; |
| 1800 | 1799 |
| 1801 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorChange); | 1800 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestDeviceScaleFactorChange); |
| 1802 | 1801 |
| 1803 class LayerTreeHostTestDeviceColorSpaceChange : public LayerTreeHostTest { | 1802 class LayerTreeHostTestDeviceColorSpaceChange : public LayerTreeHostTest { |
| 1804 public: | 1803 public: |
| 1805 void SetupTree() override { | 1804 void SetupTree() override { |
| 1806 space1_ = gfx::ColorSpace::CreateXYZD50(); | 1805 space1_ = gfx::ColorSpace::CreateXYZD50(); |
| 1807 space2_ = gfx::ColorSpace::CreateSRGB(); | 1806 space2_ = gfx::ColorSpace::CreateSRGB(); |
| 1808 | 1807 |
| 1809 root_layer_ = Layer::Create(); | 1808 root_layer_ = Layer::Create(); |
| 1810 root_layer_->SetBounds(gfx::Size(10, 20)); | 1809 root_layer_->SetBounds(gfx::Size(10, 20)); |
| 1811 | 1810 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1914 void AfterTest() override {} | 1913 void AfterTest() override {} |
| 1915 | 1914 |
| 1916 private: | 1915 private: |
| 1917 gfx::ColorSpace space1_; | 1916 gfx::ColorSpace space1_; |
| 1918 gfx::ColorSpace space2_; | 1917 gfx::ColorSpace space2_; |
| 1919 FakeContentLayerClient client_; | 1918 FakeContentLayerClient client_; |
| 1920 scoped_refptr<Layer> root_layer_; | 1919 scoped_refptr<Layer> root_layer_; |
| 1921 scoped_refptr<Layer> child_layer_; | 1920 scoped_refptr<Layer> child_layer_; |
| 1922 }; | 1921 }; |
| 1923 | 1922 |
| 1923 // No remote test because LTH remote doesn't serialize device_color_space, so | |
| 1924 // LTH in process will always use the default color space here. | |
| 1925 // see crbug/658786. | |
| 1924 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceColorSpaceChange); | 1926 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceColorSpaceChange); |
| 1925 | 1927 |
| 1926 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { | 1928 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { |
| 1927 public: | 1929 public: |
| 1928 LayerTreeHostTestSetNextCommitForcesRedraw() | 1930 LayerTreeHostTestSetNextCommitForcesRedraw() |
| 1929 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} | 1931 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} |
| 1930 | 1932 |
| 1931 void BeginTest() override { | 1933 void BeginTest() override { |
| 1932 root_layer_ = FakePictureLayer::Create(&client_); | 1934 root_layer_ = FakePictureLayer::Create(&client_); |
| 1933 root_layer_->SetIsDrawable(true); | 1935 root_layer_->SetIsDrawable(true); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2004 private: | 2006 private: |
| 2005 int num_draws_; | 2007 int num_draws_; |
| 2006 const gfx::Size bounds_; | 2008 const gfx::Size bounds_; |
| 2007 const gfx::Rect invalid_rect_; | 2009 const gfx::Rect invalid_rect_; |
| 2008 FakeContentLayerClient client_; | 2010 FakeContentLayerClient client_; |
| 2009 scoped_refptr<FakePictureLayer> root_layer_; | 2011 scoped_refptr<FakePictureLayer> root_layer_; |
| 2010 }; | 2012 }; |
| 2011 | 2013 |
| 2012 // This test blocks activation which is not supported for single thread mode. | 2014 // This test blocks activation which is not supported for single thread mode. |
| 2013 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); | 2015 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); |
| 2016 REMOTE_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); | |
| 2014 | 2017 |
| 2015 // Tests that if a layer is not drawn because of some reason in the parent then | 2018 // Tests that if a layer is not drawn because of some reason in the parent then |
| 2016 // its damage is preserved until the next time it is drawn. | 2019 // its damage is preserved until the next time it is drawn. |
| 2017 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { | 2020 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { |
| 2018 public: | 2021 public: |
| 2019 void InitializeSettings(LayerTreeSettings* settings) override { | 2022 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2020 // If we don't set the minimum contents scale, it's harder to verify whether | 2023 // If we don't set the minimum contents scale, it's harder to verify whether |
| 2021 // the damage we get is correct. For other scale amounts, please see | 2024 // the damage we get is correct. For other scale amounts, please see |
| 2022 // LayerTreeHostTestDamageWithScale. | 2025 // LayerTreeHostTestDamageWithScale. |
| 2023 settings->minimum_contents_scale = 1.f; | 2026 settings->minimum_contents_scale = 1.f; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2100 | 2103 |
| 2101 void AfterTest() override {} | 2104 void AfterTest() override {} |
| 2102 | 2105 |
| 2103 private: | 2106 private: |
| 2104 FakeContentLayerClient client_; | 2107 FakeContentLayerClient client_; |
| 2105 scoped_refptr<FakePictureLayer> root_layer_; | 2108 scoped_refptr<FakePictureLayer> root_layer_; |
| 2106 scoped_refptr<FakePictureLayer> parent_layer_; | 2109 scoped_refptr<FakePictureLayer> parent_layer_; |
| 2107 scoped_refptr<FakePictureLayer> child_layer_; | 2110 scoped_refptr<FakePictureLayer> child_layer_; |
| 2108 }; | 2111 }; |
| 2109 | 2112 |
| 2110 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); | 2113 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); |
| 2111 | 2114 |
| 2112 // Tests that if a layer is not drawn because of some reason in the parent then | 2115 // Tests that if a layer is not drawn because of some reason in the parent then |
| 2113 // its damage is preserved until the next time it is drawn. | 2116 // its damage is preserved until the next time it is drawn. |
| 2114 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { | 2117 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { |
| 2115 public: | 2118 public: |
| 2116 LayerTreeHostTestDamageWithScale() {} | 2119 LayerTreeHostTestDamageWithScale() {} |
| 2117 | 2120 |
| 2118 void SetupTree() override { | 2121 void SetupTree() override { |
| 2119 client_.set_fill_with_nonsolid_color(true); | 2122 client_.set_fill_with_nonsolid_color(true); |
| 2120 | 2123 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2205 } | 2208 } |
| 2206 | 2209 |
| 2207 void AfterTest() override {} | 2210 void AfterTest() override {} |
| 2208 | 2211 |
| 2209 private: | 2212 private: |
| 2210 FakeContentLayerClient client_; | 2213 FakeContentLayerClient client_; |
| 2211 scoped_refptr<Layer> root_layer_; | 2214 scoped_refptr<Layer> root_layer_; |
| 2212 scoped_refptr<Layer> child_layer_; | 2215 scoped_refptr<Layer> child_layer_; |
| 2213 }; | 2216 }; |
| 2214 | 2217 |
| 2215 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); | 2218 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestDamageWithScale); |
| 2216 | 2219 |
| 2217 // This test verifies that properties on the layer tree host are commited | 2220 // This test verifies that properties on the layer tree host are commited |
| 2218 // to the impl side. | 2221 // to the impl side. |
| 2219 class LayerTreeHostTestCommit : public LayerTreeHostTest { | 2222 class LayerTreeHostTestCommit : public LayerTreeHostTest { |
| 2220 public: | 2223 public: |
| 2221 LayerTreeHostTestCommit() {} | 2224 LayerTreeHostTestCommit() {} |
| 2222 | 2225 |
| 2223 void BeginTest() override { | 2226 void BeginTest() override { |
| 2224 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 2227 layer_tree()->SetViewportSize(gfx::Size(20, 20)); |
| 2225 layer_tree()->set_background_color(SK_ColorGRAY); | 2228 layer_tree()->set_background_color(SK_ColorGRAY); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 2249 impl->active_tree()->event_listener_properties( | 2252 impl->active_tree()->event_listener_properties( |
| 2250 EventListenerClass::kTouchEndOrCancel)); | 2253 EventListenerClass::kTouchEndOrCancel)); |
| 2251 EXPECT_TRUE(impl->active_tree()->have_scroll_event_handlers()); | 2254 EXPECT_TRUE(impl->active_tree()->have_scroll_event_handlers()); |
| 2252 | 2255 |
| 2253 EndTest(); | 2256 EndTest(); |
| 2254 } | 2257 } |
| 2255 | 2258 |
| 2256 void AfterTest() override {} | 2259 void AfterTest() override {} |
| 2257 }; | 2260 }; |
| 2258 | 2261 |
| 2259 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); | 2262 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); |
| 2260 | 2263 |
| 2261 // This test verifies that LayerTreeHostImpl's current frame time gets | 2264 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 2262 // updated in consecutive frames when it doesn't draw due to tree | 2265 // updated in consecutive frames when it doesn't draw due to tree |
| 2263 // activation failure. | 2266 // activation failure. |
| 2264 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails | 2267 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails |
| 2265 : public LayerTreeHostTest { | 2268 : public LayerTreeHostTest { |
| 2266 public: | 2269 public: |
| 2267 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() | 2270 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() |
| 2268 : frame_count_with_pending_tree_(0) {} | 2271 : frame_count_with_pending_tree_(0) {} |
| 2269 | 2272 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2307 void AfterTest() override {} | 2310 void AfterTest() override {} |
| 2308 | 2311 |
| 2309 private: | 2312 private: |
| 2310 int frame_count_with_pending_tree_; | 2313 int frame_count_with_pending_tree_; |
| 2311 base::TimeTicks first_frame_time_; | 2314 base::TimeTicks first_frame_time_; |
| 2312 }; | 2315 }; |
| 2313 | 2316 |
| 2314 // This test blocks activation which is not supported for single thread mode. | 2317 // This test blocks activation which is not supported for single thread mode. |
| 2315 MULTI_THREAD_BLOCKNOTIFY_TEST_F( | 2318 MULTI_THREAD_BLOCKNOTIFY_TEST_F( |
| 2316 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | 2319 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); |
| 2320 REMOTE_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); | |
| 2317 | 2321 |
| 2318 // This test verifies that LayerTreeHostImpl's current frame time gets | 2322 // This test verifies that LayerTreeHostImpl's current frame time gets |
| 2319 // updated in consecutive frames when it draws in each frame. | 2323 // updated in consecutive frames when it draws in each frame. |
| 2320 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { | 2324 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { |
| 2321 public: | 2325 public: |
| 2322 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} | 2326 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} |
| 2323 | 2327 |
| 2324 void BeginTest() override { | 2328 void BeginTest() override { |
| 2325 layer_tree()->SetViewportSize(gfx::Size(20, 20)); | 2329 layer_tree()->SetViewportSize(gfx::Size(20, 20)); |
| 2326 layer_tree()->set_background_color(SK_ColorGRAY); | 2330 layer_tree()->set_background_color(SK_ColorGRAY); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 2355 EXPECT_EQ(0, frame_); | 2359 EXPECT_EQ(0, frame_); |
| 2356 } | 2360 } |
| 2357 | 2361 |
| 2358 void AfterTest() override {} | 2362 void AfterTest() override {} |
| 2359 | 2363 |
| 2360 private: | 2364 private: |
| 2361 int frame_; | 2365 int frame_; |
| 2362 base::TimeTicks first_frame_time_; | 2366 base::TimeTicks first_frame_time_; |
| 2363 }; | 2367 }; |
| 2364 | 2368 |
| 2365 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterDraw); | 2369 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterDraw); |
| 2366 | 2370 |
| 2367 // Verifies that StartPageScaleAnimation events propagate correctly | 2371 // Verifies that StartPageScaleAnimation events propagate correctly |
| 2368 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. | 2372 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. |
| 2369 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { | 2373 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { |
| 2370 public: | 2374 public: |
| 2371 LayerTreeHostTestStartPageScaleAnimation() {} | 2375 LayerTreeHostTestStartPageScaleAnimation() {} |
| 2372 | 2376 |
| 2373 void SetupTree() override { | 2377 void SetupTree() override { |
| 2374 LayerTreeHostTest::SetupTree(); | 2378 LayerTreeHostTest::SetupTree(); |
| 2375 | 2379 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2433 } | 2437 } |
| 2434 } | 2438 } |
| 2435 | 2439 |
| 2436 void AfterTest() override {} | 2440 void AfterTest() override {} |
| 2437 | 2441 |
| 2438 FakeContentLayerClient client_; | 2442 FakeContentLayerClient client_; |
| 2439 scoped_refptr<Layer> scroll_layer_; | 2443 scoped_refptr<Layer> scroll_layer_; |
| 2440 }; | 2444 }; |
| 2441 | 2445 |
| 2442 // Single thread proxy does not support impl-side page scale changes. | 2446 // Single thread proxy does not support impl-side page scale changes. |
| 2447 // Remote test does not support page scale animation. | |
| 2443 MULTI_THREAD_TEST_F(LayerTreeHostTestStartPageScaleAnimation); | 2448 MULTI_THREAD_TEST_F(LayerTreeHostTestStartPageScaleAnimation); |
| 2444 | 2449 |
| 2445 class LayerTreeHostTestSetVisible : public LayerTreeHostTest { | 2450 class LayerTreeHostTestSetVisible : public LayerTreeHostTest { |
| 2446 public: | 2451 public: |
| 2447 LayerTreeHostTestSetVisible() : num_draws_(0) {} | 2452 LayerTreeHostTestSetVisible() : num_draws_(0) {} |
| 2448 | 2453 |
| 2449 void BeginTest() override { | 2454 void BeginTest() override { |
| 2450 PostSetNeedsCommitToMainThread(); | 2455 PostSetNeedsCommitToMainThread(); |
| 2451 } | 2456 } |
| 2452 | 2457 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2463 ++num_draws_; | 2468 ++num_draws_; |
| 2464 EndTest(); | 2469 EndTest(); |
| 2465 } | 2470 } |
| 2466 | 2471 |
| 2467 void AfterTest() override { EXPECT_EQ(1, num_draws_); } | 2472 void AfterTest() override { EXPECT_EQ(1, num_draws_); } |
| 2468 | 2473 |
| 2469 private: | 2474 private: |
| 2470 int num_draws_; | 2475 int num_draws_; |
| 2471 }; | 2476 }; |
| 2472 | 2477 |
| 2473 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); | 2478 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); |
| 2474 | 2479 |
| 2475 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers | 2480 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers |
| 2476 : public LayerTreeHostTest { | 2481 : public LayerTreeHostTest { |
| 2477 public: | 2482 public: |
| 2478 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} | 2483 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} |
| 2479 | 2484 |
| 2480 void BeginTest() override { | 2485 void BeginTest() override { |
| 2481 client_.set_fill_with_nonsolid_color(true); | 2486 client_.set_fill_with_nonsolid_color(true); |
| 2482 root_layer_ = FakePictureLayer::Create(&client_); | 2487 root_layer_ = FakePictureLayer::Create(&client_); |
| 2483 child_layer_ = FakePictureLayer::Create(&client_); | 2488 child_layer_ = FakePictureLayer::Create(&client_); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2565 } | 2570 } |
| 2566 | 2571 |
| 2567 void AfterTest() override {} | 2572 void AfterTest() override {} |
| 2568 | 2573 |
| 2569 private: | 2574 private: |
| 2570 FakeContentLayerClient client_; | 2575 FakeContentLayerClient client_; |
| 2571 scoped_refptr<FakePictureLayer> root_layer_; | 2576 scoped_refptr<FakePictureLayer> root_layer_; |
| 2572 scoped_refptr<FakePictureLayer> child_layer_; | 2577 scoped_refptr<FakePictureLayer> child_layer_; |
| 2573 }; | 2578 }; |
| 2574 | 2579 |
| 2575 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); | 2580 REMOTE_AND_MULTI_THREAD_TEST_F( |
| 2581 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); | |
| 2576 | 2582 |
| 2577 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { | 2583 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { |
| 2578 public: | 2584 public: |
| 2579 LayerTreeHostTestContinuousInvalidate() | 2585 LayerTreeHostTestContinuousInvalidate() |
| 2580 : num_commit_complete_(0), num_draw_layers_(0) {} | 2586 : num_commit_complete_(0), num_draw_layers_(0) {} |
| 2581 | 2587 |
| 2582 void BeginTest() override { | 2588 void BeginTest() override { |
| 2583 layer_tree()->SetViewportSize(gfx::Size(10, 10)); | 2589 layer_tree()->SetViewportSize(gfx::Size(10, 10)); |
| 2584 layer_tree()->root_layer()->SetBounds(gfx::Size(10, 10)); | 2590 layer_tree()->root_layer()->SetBounds(gfx::Size(10, 10)); |
| 2585 | 2591 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 2615 EXPECT_EQ(1, num_commit_complete_); | 2621 EXPECT_EQ(1, num_commit_complete_); |
| 2616 } | 2622 } |
| 2617 | 2623 |
| 2618 private: | 2624 private: |
| 2619 FakeContentLayerClient client_; | 2625 FakeContentLayerClient client_; |
| 2620 scoped_refptr<Layer> layer_; | 2626 scoped_refptr<Layer> layer_; |
| 2621 int num_commit_complete_; | 2627 int num_commit_complete_; |
| 2622 int num_draw_layers_; | 2628 int num_draw_layers_; |
| 2623 }; | 2629 }; |
| 2624 | 2630 |
| 2625 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousInvalidate); | 2631 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestContinuousInvalidate); |
| 2626 | 2632 |
| 2627 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { | 2633 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { |
| 2628 public: | 2634 public: |
| 2629 LayerTreeHostTestDeferCommits() | 2635 LayerTreeHostTestDeferCommits() |
| 2630 : num_will_begin_impl_frame_(0), num_send_begin_main_frame_(0) {} | 2636 : num_will_begin_impl_frame_(0), num_send_begin_main_frame_(0) {} |
| 2631 | 2637 |
| 2632 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2638 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2633 | 2639 |
| 2634 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, | 2640 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, |
| 2635 const BeginFrameArgs& args) override { | 2641 const BeginFrameArgs& args) override { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2673 void AfterTest() override { | 2679 void AfterTest() override { |
| 2674 EXPECT_GE(num_will_begin_impl_frame_, 5); | 2680 EXPECT_GE(num_will_begin_impl_frame_, 5); |
| 2675 EXPECT_EQ(2, num_send_begin_main_frame_); | 2681 EXPECT_EQ(2, num_send_begin_main_frame_); |
| 2676 } | 2682 } |
| 2677 | 2683 |
| 2678 private: | 2684 private: |
| 2679 int num_will_begin_impl_frame_; | 2685 int num_will_begin_impl_frame_; |
| 2680 int num_send_begin_main_frame_; | 2686 int num_send_begin_main_frame_; |
| 2681 }; | 2687 }; |
| 2682 | 2688 |
| 2683 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); | 2689 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestDeferCommits); |
| 2684 | 2690 |
| 2685 class LayerTreeHostTestCompositeImmediatelyStateTransitions | 2691 class LayerTreeHostTestCompositeImmediatelyStateTransitions |
| 2686 : public LayerTreeHostTest { | 2692 : public LayerTreeHostTest { |
| 2687 public: | 2693 public: |
| 2688 enum { | 2694 enum { |
| 2689 kInvalid, | 2695 kInvalid, |
| 2690 kStartedTest, | 2696 kStartedTest, |
| 2691 kStartedImplFrame, | 2697 kStartedImplFrame, |
| 2692 kStartedMainFrame, | 2698 kStartedMainFrame, |
| 2693 kStartedCommit, | 2699 kStartedCommit, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2832 } | 2838 } |
| 2833 } | 2839 } |
| 2834 | 2840 |
| 2835 void AfterTest() override {} | 2841 void AfterTest() override {} |
| 2836 | 2842 |
| 2837 private: | 2843 private: |
| 2838 FakeContentLayerClient client_; | 2844 FakeContentLayerClient client_; |
| 2839 int num_tiles_rastered_; | 2845 int num_tiles_rastered_; |
| 2840 }; | 2846 }; |
| 2841 | 2847 |
| 2842 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDChange); | 2848 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestLCDChange); |
| 2843 | 2849 |
| 2844 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled | 2850 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled |
| 2845 : public LayerTreeHostTest { | 2851 : public LayerTreeHostTest { |
| 2846 public: | 2852 public: |
| 2847 void InitializeSettings(LayerTreeSettings* settings) override { | 2853 void InitializeSettings(LayerTreeSettings* settings) override { |
| 2848 settings->using_synchronous_renderer_compositor = true; | 2854 settings->using_synchronous_renderer_compositor = true; |
| 2849 } | 2855 } |
| 2850 | 2856 |
| 2851 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2857 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2852 | 2858 |
| 2853 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 2859 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 2854 // The BeginFrame notification is turned off now but will get enabled | 2860 // The BeginFrame notification is turned off now but will get enabled |
| 2855 // once we return. End test while it's enabled. | 2861 // once we return. End test while it's enabled. |
| 2856 ImplThreadTaskRunner()->PostTask( | 2862 ImplThreadTaskRunner()->PostTask( |
| 2857 FROM_HERE, | 2863 FROM_HERE, |
| 2858 base::Bind(&LayerTreeHostTest::EndTest, base::Unretained(this))); | 2864 base::Bind(&LayerTreeHostTest::EndTest, base::Unretained(this))); |
| 2859 } | 2865 } |
| 2860 | 2866 |
| 2861 void AfterTest() override {} | 2867 void AfterTest() override {} |
| 2862 }; | 2868 }; |
| 2863 | 2869 |
| 2870 // No remote test since synchronous renderer compositor is not supported for LTH | |
| 2871 // remote. | |
| 2864 MULTI_THREAD_TEST_F( | 2872 MULTI_THREAD_TEST_F( |
| 2865 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); | 2873 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); |
| 2866 | 2874 |
| 2867 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { | 2875 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { |
| 2868 protected: | 2876 protected: |
| 2869 LayerTreeHostTestAbortedCommitDoesntStall() | 2877 LayerTreeHostTestAbortedCommitDoesntStall() |
| 2870 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} | 2878 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} |
| 2871 | 2879 |
| 2872 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 2880 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 2873 | 2881 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2978 ImplThreadTaskRunner()->PostTask( | 2986 ImplThreadTaskRunner()->PostTask( |
| 2979 FROM_HERE, base::Bind(&OnDrawCompositorFrameSink::OnDraw, | 2987 FROM_HERE, base::Bind(&OnDrawCompositorFrameSink::OnDraw, |
| 2980 base::Unretained(compositor_frame_sink_), | 2988 base::Unretained(compositor_frame_sink_), |
| 2981 resourceless_software_draw)); | 2989 resourceless_software_draw)); |
| 2982 } | 2990 } |
| 2983 } | 2991 } |
| 2984 | 2992 |
| 2985 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr; | 2993 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr; |
| 2986 }; | 2994 }; |
| 2987 | 2995 |
| 2996 // No remote test since synchronous renderer compositor is not supported for LTH | |
| 2997 // remote. | |
| 2988 MULTI_THREAD_TEST_F( | 2998 MULTI_THREAD_TEST_F( |
| 2989 LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor); | 2999 LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor); |
| 2990 | 3000 |
| 2991 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation | 3001 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation |
| 2992 : public LayerTreeHostTest { | 3002 : public LayerTreeHostTest { |
| 2993 protected: | 3003 protected: |
| 2994 void SetupTree() override { | 3004 void SetupTree() override { |
| 2995 LayerTreeHostTest::SetupTree(); | 3005 LayerTreeHostTest::SetupTree(); |
| 2996 | 3006 |
| 2997 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); | 3007 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); |
| 2998 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); | 3008 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); |
| 2999 layer->SetBounds(gfx::Size(10, 10)); | 3009 layer->SetBounds(gfx::Size(10, 10)); |
| 3000 layer_tree()->root_layer()->AddChild(layer); | 3010 layer_tree()->root_layer()->AddChild(layer); |
| 3001 client_.set_bounds(layer->bounds()); | 3011 client_.set_bounds(layer->bounds()); |
| 3002 } | 3012 } |
| 3003 | 3013 |
| 3004 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3014 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 3005 | 3015 |
| 3006 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { | 3016 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { |
| 3007 EndTest(); | 3017 EndTest(); |
| 3008 } | 3018 } |
| 3009 | 3019 |
| 3010 void AfterTest() override {} | 3020 void AfterTest() override {} |
| 3011 | 3021 |
| 3012 FakeContentLayerClient client_; | 3022 FakeContentLayerClient client_; |
| 3013 }; | 3023 }; |
| 3014 | 3024 |
| 3015 SINGLE_AND_MULTI_THREAD_TEST_F( | 3025 SINGLE_MULTI_AND_REMOTE_TEST_F( |
| 3016 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation); | 3026 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation); |
| 3017 | 3027 |
| 3018 class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest { | 3028 class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest { |
| 3019 public: | 3029 public: |
| 3020 void BeginTest() override { | 3030 void BeginTest() override { |
| 3021 frame_ = 0; | 3031 frame_ = 0; |
| 3022 PostSetNeedsCommitToMainThread(); | 3032 PostSetNeedsCommitToMainThread(); |
| 3023 } | 3033 } |
| 3024 | 3034 |
| 3025 // Round 1: commit + draw | 3035 // Round 1: commit + draw |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 3054 break; | 3064 break; |
| 3055 } | 3065 } |
| 3056 } | 3066 } |
| 3057 | 3067 |
| 3058 void AfterTest() override {} | 3068 void AfterTest() override {} |
| 3059 | 3069 |
| 3060 protected: | 3070 protected: |
| 3061 int frame_; | 3071 int frame_; |
| 3062 }; | 3072 }; |
| 3063 | 3073 |
| 3064 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNumFramesPending); | 3074 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestNumFramesPending); |
| 3065 | 3075 |
| 3066 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { | 3076 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { |
| 3067 protected: | 3077 protected: |
| 3068 void InitializeSettings(LayerTreeSettings* settings) override { | 3078 void InitializeSettings(LayerTreeSettings* settings) override { |
| 3069 settings->using_synchronous_renderer_compositor = true; | 3079 settings->using_synchronous_renderer_compositor = true; |
| 3070 } | 3080 } |
| 3071 | 3081 |
| 3072 void SetupTree() override { | 3082 void SetupTree() override { |
| 3073 root_layer_ = FakePictureLayer::Create(&client_); | 3083 root_layer_ = FakePictureLayer::Create(&client_); |
| 3074 root_layer_->SetIsDrawable(true); | 3084 root_layer_->SetIsDrawable(true); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3160 private: | 3170 private: |
| 3161 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr; | 3171 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr; |
| 3162 FakeContentLayerClient client_; | 3172 FakeContentLayerClient client_; |
| 3163 scoped_refptr<Layer> root_layer_; | 3173 scoped_refptr<Layer> root_layer_; |
| 3164 scoped_refptr<Layer> parent_layer_; | 3174 scoped_refptr<Layer> parent_layer_; |
| 3165 scoped_refptr<Layer> child_layer_; | 3175 scoped_refptr<Layer> child_layer_; |
| 3166 int draw_count_ = 0; | 3176 int draw_count_ = 0; |
| 3167 }; | 3177 }; |
| 3168 | 3178 |
| 3169 // Resourceless is not used for SingleThreadProxy, so it is unimplemented. | 3179 // Resourceless is not used for SingleThreadProxy, so it is unimplemented. |
| 3180 // No remote test since synchronous renderer compositor is not supported for LTH | |
| 3181 // remote. | |
| 3170 MULTI_THREAD_TEST_F(LayerTreeHostTestResourcelessSoftwareDraw); | 3182 MULTI_THREAD_TEST_F(LayerTreeHostTestResourcelessSoftwareDraw); |
| 3171 | 3183 |
| 3172 // Test for UI Resource management. | 3184 // Test for UI Resource management. |
| 3173 class LayerTreeHostTestUIResource : public LayerTreeHostTest { | 3185 class LayerTreeHostTestUIResource : public LayerTreeHostTest { |
| 3174 public: | 3186 public: |
| 3175 LayerTreeHostTestUIResource() : num_ui_resources_(0) {} | 3187 LayerTreeHostTestUIResource() : num_ui_resources_(0) {} |
| 3176 | 3188 |
| 3177 void InitializeSettings(LayerTreeSettings* settings) override { | 3189 void InitializeSettings(LayerTreeSettings* settings) override { |
| 3178 settings->renderer_settings.texture_id_allocation_chunk_size = 1; | 3190 settings->renderer_settings.texture_id_allocation_chunk_size = 1; |
| 3179 } | 3191 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3256 | 3268 |
| 3257 void CreateResource() { | 3269 void CreateResource() { |
| 3258 ui_resources_[num_ui_resources_++] = | 3270 ui_resources_[num_ui_resources_++] = |
| 3259 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); | 3271 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); |
| 3260 } | 3272 } |
| 3261 | 3273 |
| 3262 std::unique_ptr<FakeScopedUIResource> ui_resources_[5]; | 3274 std::unique_ptr<FakeScopedUIResource> ui_resources_[5]; |
| 3263 int num_ui_resources_; | 3275 int num_ui_resources_; |
| 3264 }; | 3276 }; |
| 3265 | 3277 |
| 3278 // No remote test since LTH remote does not support UIResourceLayers and | |
| 3279 // PaintedScrollbarLayers, which uses UIResourceManager. | |
| 3266 MULTI_THREAD_TEST_F(LayerTreeHostTestUIResource); | 3280 MULTI_THREAD_TEST_F(LayerTreeHostTestUIResource); |
| 3267 | 3281 |
| 3268 class PushPropertiesCountingLayerImpl : public LayerImpl { | 3282 class PushPropertiesCountingLayerImpl : public LayerImpl { |
| 3269 public: | 3283 public: |
| 3270 static std::unique_ptr<PushPropertiesCountingLayerImpl> Create( | 3284 static std::unique_ptr<PushPropertiesCountingLayerImpl> Create( |
| 3271 LayerTreeImpl* tree_impl, | 3285 LayerTreeImpl* tree_impl, |
| 3272 int id) { | 3286 int id) { |
| 3273 return base::WrapUnique(new PushPropertiesCountingLayerImpl(tree_impl, id)); | 3287 return base::WrapUnique(new PushPropertiesCountingLayerImpl(tree_impl, id)); |
| 3274 } | 3288 } |
| 3275 | 3289 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 3293 | 3307 |
| 3294 private: | 3308 private: |
| 3295 size_t push_properties_count_; | 3309 size_t push_properties_count_; |
| 3296 | 3310 |
| 3297 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id) | 3311 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id) |
| 3298 : LayerImpl(tree_impl, id), push_properties_count_(0) { | 3312 : LayerImpl(tree_impl, id), push_properties_count_(0) { |
| 3299 SetBounds(gfx::Size(1, 1)); | 3313 SetBounds(gfx::Size(1, 1)); |
| 3300 } | 3314 } |
| 3301 }; | 3315 }; |
| 3302 | 3316 |
| 3303 class PushPropertiesCountingLayer : public Layer { | 3317 class PushPropertiesCountingLayer : public Layer { |
|
Khushal
2016/10/27 18:37:52
The tests which use this would definitely be nice
ajuma
2016/10/27 19:40:03
That sounds like a good plan.
| |
| 3304 public: | 3318 public: |
| 3305 static scoped_refptr<PushPropertiesCountingLayer> Create() { | 3319 static scoped_refptr<PushPropertiesCountingLayer> Create() { |
| 3306 return new PushPropertiesCountingLayer(); | 3320 return new PushPropertiesCountingLayer(); |
| 3307 } | 3321 } |
| 3308 | 3322 |
| 3309 void PushPropertiesTo(LayerImpl* layer) override { | 3323 void PushPropertiesTo(LayerImpl* layer) override { |
| 3310 Layer::PushPropertiesTo(layer); | 3324 Layer::PushPropertiesTo(layer); |
| 3311 push_properties_count_++; | 3325 push_properties_count_++; |
| 3312 if (persist_needs_push_properties_) { | 3326 if (persist_needs_push_properties_) { |
| 3313 GetLayerTree()->AddLayerShouldPushProperties(this); | 3327 GetLayerTree()->AddLayerShouldPushProperties(this); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3535 scoped_refptr<PushPropertiesCountingLayer> other_root_; | 3549 scoped_refptr<PushPropertiesCountingLayer> other_root_; |
| 3536 scoped_refptr<PushPropertiesCountingLayer> leaf_always_pushing_layer_; | 3550 scoped_refptr<PushPropertiesCountingLayer> leaf_always_pushing_layer_; |
| 3537 size_t expected_push_properties_root_; | 3551 size_t expected_push_properties_root_; |
| 3538 size_t expected_push_properties_child_; | 3552 size_t expected_push_properties_child_; |
| 3539 size_t expected_push_properties_child2_; | 3553 size_t expected_push_properties_child2_; |
| 3540 size_t expected_push_properties_grandchild_; | 3554 size_t expected_push_properties_grandchild_; |
| 3541 size_t expected_push_properties_other_root_; | 3555 size_t expected_push_properties_other_root_; |
| 3542 size_t expected_push_properties_leaf_layer_; | 3556 size_t expected_push_properties_leaf_layer_; |
| 3543 }; | 3557 }; |
| 3544 | 3558 |
| 3559 // No remote test because LTH remote serializes the layers that needs to push | |
| 3560 // property into protos, but does not directly call PushPropertiesTo to sync | |
| 3561 // states to the impl side. See crbug/658913. | |
| 3545 MULTI_THREAD_TEST_F(LayerTreeHostTestLayersPushProperties); | 3562 MULTI_THREAD_TEST_F(LayerTreeHostTestLayersPushProperties); |
| 3546 | 3563 |
| 3547 class LayerTreeHostTestImplLayersPushProperties | 3564 class LayerTreeHostTestImplLayersPushProperties |
| 3548 : public LayerTreeHostTestLayersPushProperties { | 3565 : public LayerTreeHostTestLayersPushProperties { |
| 3549 protected: | 3566 protected: |
| 3550 void BeginTest() override { | 3567 void BeginTest() override { |
| 3551 expected_push_properties_root_impl_ = 0; | 3568 expected_push_properties_root_impl_ = 0; |
| 3552 expected_push_properties_child_impl_ = 0; | 3569 expected_push_properties_child_impl_ = 0; |
| 3553 expected_push_properties_grandchild_impl_ = 0; | 3570 expected_push_properties_grandchild_impl_ = 0; |
| 3554 expected_push_properties_child2_impl_ = 0; | 3571 expected_push_properties_child2_impl_ = 0; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3732 } | 3749 } |
| 3733 | 3750 |
| 3734 size_t expected_push_properties_root_impl_; | 3751 size_t expected_push_properties_root_impl_; |
| 3735 size_t expected_push_properties_child_impl_; | 3752 size_t expected_push_properties_child_impl_; |
| 3736 size_t expected_push_properties_child2_impl_; | 3753 size_t expected_push_properties_child2_impl_; |
| 3737 size_t expected_push_properties_grandchild_impl_; | 3754 size_t expected_push_properties_grandchild_impl_; |
| 3738 size_t expected_push_properties_grandchild2_impl_; | 3755 size_t expected_push_properties_grandchild2_impl_; |
| 3739 }; | 3756 }; |
| 3740 | 3757 |
| 3741 // In single thread there's no pending tree to push properties from. | 3758 // In single thread there's no pending tree to push properties from. |
| 3759 // No remote test because LTH remote serializes the layers that needs to push | |
| 3760 // property into protos, but does not directly call PushPropertiesTo to sync | |
| 3761 // states to the impl side. See crbug/658913. | |
| 3742 MULTI_THREAD_TEST_F(LayerTreeHostTestImplLayersPushProperties); | 3762 MULTI_THREAD_TEST_F(LayerTreeHostTestImplLayersPushProperties); |
| 3743 | 3763 |
| 3744 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed | 3764 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed |
| 3745 : public LayerTreeHostTest { | 3765 : public LayerTreeHostTest { |
| 3746 protected: | 3766 protected: |
| 3747 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3767 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 3748 | 3768 |
| 3749 void SetupTree() override { | 3769 void SetupTree() override { |
| 3750 root_ = Layer::Create(); | 3770 root_ = Layer::Create(); |
| 3751 root_->SetBounds(gfx::Size(1, 1)); | 3771 root_->SetBounds(gfx::Size(1, 1)); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3789 break; | 3809 break; |
| 3790 } | 3810 } |
| 3791 } | 3811 } |
| 3792 | 3812 |
| 3793 void AfterTest() override {} | 3813 void AfterTest() override {} |
| 3794 | 3814 |
| 3795 scoped_refptr<Layer> root_; | 3815 scoped_refptr<Layer> root_; |
| 3796 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; | 3816 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; |
| 3797 }; | 3817 }; |
| 3798 | 3818 |
| 3819 // No remote test since remote LTH does not support PaintedScrollbarLayer. | |
| 3799 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); | 3820 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); |
| 3800 | 3821 |
| 3801 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { | 3822 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { |
| 3802 protected: | 3823 protected: |
| 3803 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3824 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 3804 | 3825 |
| 3805 void SetupTree() override { | 3826 void SetupTree() override { |
| 3806 root_ = PushPropertiesCountingLayer::Create(); | 3827 root_ = PushPropertiesCountingLayer::Create(); |
| 3807 child_ = PushPropertiesCountingLayer::Create(); | 3828 child_ = PushPropertiesCountingLayer::Create(); |
| 3808 root_->AddChild(child_); | 3829 root_->AddChild(child_); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3849 break; | 3870 break; |
| 3850 } | 3871 } |
| 3851 } | 3872 } |
| 3852 | 3873 |
| 3853 void AfterTest() override {} | 3874 void AfterTest() override {} |
| 3854 | 3875 |
| 3855 scoped_refptr<PushPropertiesCountingLayer> root_; | 3876 scoped_refptr<PushPropertiesCountingLayer> root_; |
| 3856 scoped_refptr<PushPropertiesCountingLayer> child_; | 3877 scoped_refptr<PushPropertiesCountingLayer> child_; |
| 3857 }; | 3878 }; |
| 3858 | 3879 |
| 3880 // No remote test because LTH remote serializes the layers that needs to push | |
| 3881 // property into protos, but does not directly call PushPropertiesTo to sync | |
| 3882 // states to the impl side. See crbug/658913. | |
| 3859 MULTI_THREAD_TEST_F(LayerTreeHostTestSetDrawableCausesCommit); | 3883 MULTI_THREAD_TEST_F(LayerTreeHostTestSetDrawableCausesCommit); |
| 3860 | 3884 |
| 3861 class LayerTreeHostTestCasePushPropertiesThreeGrandChildren | 3885 class LayerTreeHostTestCasePushPropertiesThreeGrandChildren |
| 3862 : public LayerTreeHostTest { | 3886 : public LayerTreeHostTest { |
| 3863 protected: | 3887 protected: |
| 3864 void BeginTest() override { | 3888 void BeginTest() override { |
| 3865 expected_push_properties_root_ = 0; | 3889 expected_push_properties_root_ = 0; |
| 3866 expected_push_properties_child_ = 0; | 3890 expected_push_properties_child_ = 0; |
| 3867 expected_push_properties_grandchild1_ = 0; | 3891 expected_push_properties_grandchild1_ = 0; |
| 3868 expected_push_properties_grandchild2_ = 0; | 3892 expected_push_properties_grandchild2_ = 0; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3922 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( | 3946 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( |
| 3923 grandchild3_.get())); | 3947 grandchild3_.get())); |
| 3924 break; | 3948 break; |
| 3925 case 1: | 3949 case 1: |
| 3926 EndTest(); | 3950 EndTest(); |
| 3927 break; | 3951 break; |
| 3928 } | 3952 } |
| 3929 } | 3953 } |
| 3930 }; | 3954 }; |
| 3931 | 3955 |
| 3956 // No remote test because LTH remote serializes the layers that needs to push | |
| 3957 // property into protos, but does not directly call PushPropertiesTo to sync | |
| 3958 // states to the impl side. See crbug/658913. | |
| 3932 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3959 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
| 3933 | 3960 |
| 3934 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3961 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
| 3935 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3962 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3936 protected: | 3963 protected: |
| 3937 void DidCommitAndDrawFrame() override { | 3964 void DidCommitAndDrawFrame() override { |
| 3938 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 3965 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 3939 switch (last_source_frame_number) { | 3966 switch (last_source_frame_number) { |
| 3940 case 0: | 3967 case 0: |
| 3941 layer_tree()->SetRootLayer(root_); | 3968 layer_tree()->SetRootLayer(root_); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4005 EXPECT_FALSE( | 4032 EXPECT_FALSE( |
| 4006 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4033 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4007 EXPECT_FALSE( | 4034 EXPECT_FALSE( |
| 4008 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); | 4035 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 4009 EndTest(); | 4036 EndTest(); |
| 4010 break; | 4037 break; |
| 4011 } | 4038 } |
| 4012 } | 4039 } |
| 4013 }; | 4040 }; |
| 4014 | 4041 |
| 4015 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 4042 REMOTE_AND_MULTI_THREAD_TEST_F( |
| 4043 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | |
| 4016 | 4044 |
| 4017 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 4045 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
| 4018 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4046 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4019 protected: | 4047 protected: |
| 4020 void DidCommitAndDrawFrame() override { | 4048 void DidCommitAndDrawFrame() override { |
| 4021 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4049 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 4022 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4050 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4023 switch (last_source_frame_number) { | 4051 switch (last_source_frame_number) { |
| 4024 case 0: | 4052 case 0: |
| 4025 layer_tree->SetRootLayer(root_); | 4053 layer_tree->SetRootLayer(root_); |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 4053 EXPECT_FALSE( | 4081 EXPECT_FALSE( |
| 4054 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4082 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4055 EXPECT_FALSE( | 4083 EXPECT_FALSE( |
| 4056 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4084 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 4057 EndTest(); | 4085 EndTest(); |
| 4058 break; | 4086 break; |
| 4059 } | 4087 } |
| 4060 } | 4088 } |
| 4061 }; | 4089 }; |
| 4062 | 4090 |
| 4091 // No remote test because persist_needs_push_properties_ is used in | |
| 4092 // PushPropertiesTo, and LTH remote does not directly call PushPropertiesTo to | |
| 4093 // synchronize states to the impl side. See crbug/658913. | |
| 4063 MULTI_THREAD_TEST_F( | 4094 MULTI_THREAD_TEST_F( |
| 4064 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 4095 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
| 4065 | 4096 |
| 4066 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 4097 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
| 4067 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4098 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4068 protected: | 4099 protected: |
| 4069 void DidCommitAndDrawFrame() override { | 4100 void DidCommitAndDrawFrame() override { |
| 4070 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4101 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 4071 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4102 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4072 switch (last_source_frame_number) { | 4103 switch (last_source_frame_number) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4122 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4153 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4123 EXPECT_TRUE( | 4154 EXPECT_TRUE( |
| 4124 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); | 4155 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 4125 | 4156 |
| 4126 EndTest(); | 4157 EndTest(); |
| 4127 break; | 4158 break; |
| 4128 } | 4159 } |
| 4129 } | 4160 } |
| 4130 }; | 4161 }; |
| 4131 | 4162 |
| 4132 MULTI_THREAD_TEST_F( | 4163 REMOTE_AND_MULTI_THREAD_TEST_F( |
| 4133 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 4164 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
| 4134 | 4165 |
| 4135 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 4166 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
| 4136 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4167 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4137 protected: | 4168 protected: |
| 4138 void DidCommitAndDrawFrame() override { | 4169 void DidCommitAndDrawFrame() override { |
| 4139 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4170 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 4140 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4171 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4141 switch (last_source_frame_number) { | 4172 switch (last_source_frame_number) { |
| 4142 case 0: | 4173 case 0: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4187 | 4218 |
| 4188 EXPECT_FALSE( | 4219 EXPECT_FALSE( |
| 4189 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4220 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4190 | 4221 |
| 4191 EndTest(); | 4222 EndTest(); |
| 4192 break; | 4223 break; |
| 4193 } | 4224 } |
| 4194 } | 4225 } |
| 4195 }; | 4226 }; |
| 4196 | 4227 |
| 4197 MULTI_THREAD_TEST_F( | 4228 REMOTE_AND_MULTI_THREAD_TEST_F( |
| 4198 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 4229 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
| 4199 | 4230 |
| 4200 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 4231 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
| 4201 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 4232 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 4202 protected: | 4233 protected: |
| 4203 void DidCommitAndDrawFrame() override { | 4234 void DidCommitAndDrawFrame() override { |
| 4204 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); | 4235 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 4205 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; | 4236 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; |
| 4206 switch (last_source_frame_number) { | 4237 switch (last_source_frame_number) { |
| 4207 case 0: | 4238 case 0: |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4252 | 4283 |
| 4253 EXPECT_FALSE( | 4284 EXPECT_FALSE( |
| 4254 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); | 4285 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 4255 | 4286 |
| 4256 EndTest(); | 4287 EndTest(); |
| 4257 break; | 4288 break; |
| 4258 } | 4289 } |
| 4259 } | 4290 } |
| 4260 }; | 4291 }; |
| 4261 | 4292 |
| 4262 MULTI_THREAD_TEST_F( | 4293 REMOTE_AND_MULTI_THREAD_TEST_F( |
| 4263 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); | 4294 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); |
| 4264 | 4295 |
| 4265 // This test verifies that the tree activation callback is invoked correctly. | 4296 // This test verifies that the tree activation callback is invoked correctly. |
| 4266 class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest { | 4297 class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest { |
| 4267 public: | 4298 public: |
| 4268 LayerTreeHostTestTreeActivationCallback() | 4299 LayerTreeHostTestTreeActivationCallback() |
| 4269 : num_commits_(0), callback_count_(0) {} | 4300 : num_commits_(0), callback_count_(0) {} |
| 4270 | 4301 |
| 4271 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4302 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4272 | 4303 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4311 base::Unretained(this)) | 4342 base::Unretained(this)) |
| 4312 : base::Closure()); | 4343 : base::Closure()); |
| 4313 } | 4344 } |
| 4314 | 4345 |
| 4315 void ActivationCallback() { ++callback_count_; } | 4346 void ActivationCallback() { ++callback_count_; } |
| 4316 | 4347 |
| 4317 int num_commits_; | 4348 int num_commits_; |
| 4318 int callback_count_; | 4349 int callback_count_; |
| 4319 }; | 4350 }; |
| 4320 | 4351 |
| 4321 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTreeActivationCallback); | 4352 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestTreeActivationCallback); |
| 4322 | 4353 |
| 4323 class LayerInvalidateCausesDraw : public LayerTreeHostTest { | 4354 class LayerInvalidateCausesDraw : public LayerTreeHostTest { |
| 4324 public: | 4355 public: |
| 4325 LayerInvalidateCausesDraw() : num_commits_(0), num_draws_(0) {} | 4356 LayerInvalidateCausesDraw() : num_commits_(0), num_draws_(0) {} |
| 4326 | 4357 |
| 4327 void BeginTest() override { | 4358 void BeginTest() override { |
| 4328 ASSERT_TRUE(invalidate_layer_) | 4359 ASSERT_TRUE(invalidate_layer_) |
| 4329 << "Derived tests must set this in SetupTree"; | 4360 << "Derived tests must set this in SetupTree"; |
| 4330 | 4361 |
| 4331 // One initial commit. | 4362 // One initial commit. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4374 video_layer->SetIsDrawable(true); | 4405 video_layer->SetIsDrawable(true); |
| 4375 layer_tree()->root_layer()->AddChild(video_layer); | 4406 layer_tree()->root_layer()->AddChild(video_layer); |
| 4376 | 4407 |
| 4377 invalidate_layer_ = video_layer; | 4408 invalidate_layer_ = video_layer; |
| 4378 } | 4409 } |
| 4379 | 4410 |
| 4380 private: | 4411 private: |
| 4381 FakeVideoFrameProvider provider_; | 4412 FakeVideoFrameProvider provider_; |
| 4382 }; | 4413 }; |
| 4383 | 4414 |
| 4415 // LTH remote does not support VideoLayer. | |
| 4384 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); | 4416 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); |
| 4385 | 4417 |
| 4386 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { | 4418 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { |
| 4387 protected: | 4419 protected: |
| 4388 void SetupTree() override { | 4420 void SetupTree() override { |
| 4389 root_layer_ = Layer::Create(); | 4421 root_layer_ = Layer::Create(); |
| 4390 root_layer_->SetPosition(gfx::PointF()); | 4422 root_layer_->SetPosition(gfx::PointF()); |
| 4391 root_layer_->SetBounds(gfx::Size(10, 10)); | 4423 root_layer_->SetBounds(gfx::Size(10, 10)); |
| 4392 | 4424 |
| 4393 parent_layer_ = SolidColorLayer::Create(); | 4425 parent_layer_ = SolidColorLayer::Create(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4441 } | 4473 } |
| 4442 } | 4474 } |
| 4443 | 4475 |
| 4444 void AfterTest() override {} | 4476 void AfterTest() override {} |
| 4445 | 4477 |
| 4446 scoped_refptr<Layer> root_layer_; | 4478 scoped_refptr<Layer> root_layer_; |
| 4447 scoped_refptr<SolidColorLayer> parent_layer_; | 4479 scoped_refptr<SolidColorLayer> parent_layer_; |
| 4448 scoped_refptr<SolidColorLayer> child_layer_; | 4480 scoped_refptr<SolidColorLayer> child_layer_; |
| 4449 }; | 4481 }; |
| 4450 | 4482 |
| 4451 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); | 4483 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestPushHiddenLayer); |
| 4452 | 4484 |
| 4453 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { | 4485 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { |
| 4454 protected: | 4486 protected: |
| 4455 void SetupTree() override { | 4487 void SetupTree() override { |
| 4456 root_layer_ = FakePictureLayer::Create(&client_); | 4488 root_layer_ = FakePictureLayer::Create(&client_); |
| 4457 root_layer_->SetBounds(gfx::Size(10, 10)); | 4489 root_layer_->SetBounds(gfx::Size(10, 10)); |
| 4458 | 4490 |
| 4459 layer_tree()->SetRootLayer(root_layer_); | 4491 layer_tree()->SetRootLayer(root_layer_); |
| 4460 LayerTreeHostTest::SetupTree(); | 4492 LayerTreeHostTest::SetupTree(); |
| 4461 client_.set_bounds(root_layer_->bounds()); | 4493 client_.set_bounds(root_layer_->bounds()); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 4474 EXPECT_GT(root_layer_->update_count(), 0); | 4506 EXPECT_GT(root_layer_->update_count(), 0); |
| 4475 EndTest(); | 4507 EndTest(); |
| 4476 } | 4508 } |
| 4477 | 4509 |
| 4478 void AfterTest() override {} | 4510 void AfterTest() override {} |
| 4479 | 4511 |
| 4480 FakeContentLayerClient client_; | 4512 FakeContentLayerClient client_; |
| 4481 scoped_refptr<FakePictureLayer> root_layer_; | 4513 scoped_refptr<FakePictureLayer> root_layer_; |
| 4482 }; | 4514 }; |
| 4483 | 4515 |
| 4484 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); | 4516 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); |
| 4485 | 4517 |
| 4486 class LayerTreeHostTestElasticOverscroll : public LayerTreeHostTest { | 4518 class LayerTreeHostTestElasticOverscroll : public LayerTreeHostTest { |
| 4487 public: | 4519 public: |
| 4488 LayerTreeHostTestElasticOverscroll() | 4520 LayerTreeHostTestElasticOverscroll() |
| 4489 : scroll_elasticity_helper_(nullptr), num_draws_(0) {} | 4521 : scroll_elasticity_helper_(nullptr), num_draws_(0) {} |
| 4490 | 4522 |
| 4491 void InitializeSettings(LayerTreeSettings* settings) override { | 4523 void InitializeSettings(LayerTreeSettings* settings) override { |
| 4492 settings->enable_elastic_overscroll = true; | 4524 settings->enable_elastic_overscroll = true; |
| 4493 } | 4525 } |
| 4494 | 4526 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4569 void AfterTest() override {} | 4601 void AfterTest() override {} |
| 4570 | 4602 |
| 4571 private: | 4603 private: |
| 4572 FakeContentLayerClient client_; | 4604 FakeContentLayerClient client_; |
| 4573 scoped_refptr<Layer> root_layer_; | 4605 scoped_refptr<Layer> root_layer_; |
| 4574 ScrollElasticityHelper* scroll_elasticity_helper_; | 4606 ScrollElasticityHelper* scroll_elasticity_helper_; |
| 4575 int content_layer_id_; | 4607 int content_layer_id_; |
| 4576 int num_draws_; | 4608 int num_draws_; |
| 4577 }; | 4609 }; |
| 4578 | 4610 |
| 4611 // Remote test does not support enable_elastic_overscroll. | |
| 4579 MULTI_THREAD_TEST_F(LayerTreeHostTestElasticOverscroll); | 4612 MULTI_THREAD_TEST_F(LayerTreeHostTestElasticOverscroll); |
| 4580 | 4613 |
| 4581 struct TestSwapPromiseResult { | 4614 struct TestSwapPromiseResult { |
| 4582 TestSwapPromiseResult() | 4615 TestSwapPromiseResult() |
| 4583 : did_activate_called(false), | 4616 : did_activate_called(false), |
| 4584 did_swap_called(false), | 4617 did_swap_called(false), |
| 4585 did_not_swap_called(false), | 4618 did_not_swap_called(false), |
| 4586 dtor_called(false), | 4619 dtor_called(false), |
| 4587 reason(SwapPromise::COMMIT_FAILS) {} | 4620 reason(SwapPromise::COMMIT_FAILS) {} |
| 4588 | 4621 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4673 // The pinned active swap promise should not activate, but should swap. | 4706 // The pinned active swap promise should not activate, but should swap. |
| 4674 EXPECT_FALSE(pinned_active_swap_promise_result_.did_activate_called); | 4707 EXPECT_FALSE(pinned_active_swap_promise_result_.did_activate_called); |
| 4675 EXPECT_TRUE(pinned_active_swap_promise_result_.did_swap_called); | 4708 EXPECT_TRUE(pinned_active_swap_promise_result_.did_swap_called); |
| 4676 } | 4709 } |
| 4677 | 4710 |
| 4678 TestSwapPromiseResult pending_swap_promise_result_; | 4711 TestSwapPromiseResult pending_swap_promise_result_; |
| 4679 TestSwapPromiseResult active_swap_promise_result_; | 4712 TestSwapPromiseResult active_swap_promise_result_; |
| 4680 TestSwapPromiseResult pinned_active_swap_promise_result_; | 4713 TestSwapPromiseResult pinned_active_swap_promise_result_; |
| 4681 }; | 4714 }; |
| 4682 | 4715 |
| 4716 // No remote test because this test compares the swap promises result between | |
| 4717 // LTH in process and LTH impl. LTH remote runs its own swap promise, and we | |
| 4718 // don't send swap promises to the client. | |
| 4683 MULTI_THREAD_TEST_F(PinnedLayerTreeSwapPromise); | 4719 MULTI_THREAD_TEST_F(PinnedLayerTreeSwapPromise); |
| 4684 | 4720 |
| 4685 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { | 4721 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { |
| 4686 protected: | 4722 protected: |
| 4687 LayerTreeHostTestBreakSwapPromise() | 4723 LayerTreeHostTestBreakSwapPromise() |
| 4688 : commit_count_(0), commit_complete_count_(0) {} | 4724 : commit_count_(0), commit_complete_count_(0) {} |
| 4689 | 4725 |
| 4690 void WillBeginMainFrame() override { | 4726 void WillBeginMainFrame() override { |
| 4691 ASSERT_LE(commit_count_, 2); | 4727 ASSERT_LE(commit_count_, 2); |
| 4692 std::unique_ptr<SwapPromise> swap_promise( | 4728 std::unique_ptr<SwapPromise> swap_promise( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4770 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason); | 4806 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason); |
| 4771 EXPECT_TRUE(swap_promise_result_[2].dtor_called); | 4807 EXPECT_TRUE(swap_promise_result_[2].dtor_called); |
| 4772 } | 4808 } |
| 4773 } | 4809 } |
| 4774 | 4810 |
| 4775 int commit_count_; | 4811 int commit_count_; |
| 4776 int commit_complete_count_; | 4812 int commit_complete_count_; |
| 4777 TestSwapPromiseResult swap_promise_result_[3]; | 4813 TestSwapPromiseResult swap_promise_result_[3]; |
| 4778 }; | 4814 }; |
| 4779 | 4815 |
| 4816 // No remote test because LTH remote runs its own swap promises, and we | |
| 4817 // don't send swap promises to the LTH in process on the client side. | |
| 4780 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); | 4818 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); |
| 4781 | 4819 |
| 4782 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { | 4820 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { |
| 4783 public: | 4821 public: |
| 4784 LayerTreeHostTestKeepSwapPromise() {} | 4822 LayerTreeHostTestKeepSwapPromise() {} |
| 4785 | 4823 |
| 4786 void BeginTest() override { | 4824 void BeginTest() override { |
| 4787 layer_ = SolidColorLayer::Create(); | 4825 layer_ = SolidColorLayer::Create(); |
| 4788 layer_->SetIsDrawable(true); | 4826 layer_->SetIsDrawable(true); |
| 4789 layer_->SetBounds(gfx::Size(10, 10)); | 4827 layer_->SetBounds(gfx::Size(10, 10)); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4861 } | 4899 } |
| 4862 | 4900 |
| 4863 void AfterTest() override {} | 4901 void AfterTest() override {} |
| 4864 | 4902 |
| 4865 private: | 4903 private: |
| 4866 int num_swaps_ = 0; | 4904 int num_swaps_ = 0; |
| 4867 scoped_refptr<Layer> layer_; | 4905 scoped_refptr<Layer> layer_; |
| 4868 TestSwapPromiseResult swap_promise_result_; | 4906 TestSwapPromiseResult swap_promise_result_; |
| 4869 }; | 4907 }; |
| 4870 | 4908 |
| 4909 // No remote test because LTH remote runs its own swap promises, and we | |
| 4910 // don't send swap promises to the LTH in process on the client side. | |
| 4871 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromise); | 4911 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromise); |
| 4872 | 4912 |
| 4873 class LayerTreeHostTestKeepSwapPromiseMFBA : public LayerTreeHostTest { | 4913 class LayerTreeHostTestKeepSwapPromiseMFBA : public LayerTreeHostTest { |
| 4874 public: | 4914 public: |
| 4875 LayerTreeHostTestKeepSwapPromiseMFBA() {} | 4915 LayerTreeHostTestKeepSwapPromiseMFBA() {} |
| 4876 | 4916 |
| 4877 void InitializeSettings(LayerTreeSettings* settings) override { | 4917 void InitializeSettings(LayerTreeSettings* settings) override { |
| 4878 settings->main_frame_before_activation_enabled = true; | 4918 settings->main_frame_before_activation_enabled = true; |
| 4879 } | 4919 } |
| 4880 | 4920 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4975 } | 5015 } |
| 4976 | 5016 |
| 4977 void AfterTest() override { EXPECT_EQ(1, num_swaps_); } | 5017 void AfterTest() override { EXPECT_EQ(1, num_swaps_); } |
| 4978 | 5018 |
| 4979 private: | 5019 private: |
| 4980 int num_swaps_ = 0; | 5020 int num_swaps_ = 0; |
| 4981 scoped_refptr<Layer> layer_; | 5021 scoped_refptr<Layer> layer_; |
| 4982 TestSwapPromiseResult swap_promise_result_; | 5022 TestSwapPromiseResult swap_promise_result_; |
| 4983 }; | 5023 }; |
| 4984 | 5024 |
| 5025 // No remote test because LTH remote runs its own swap promises, and we | |
| 5026 // don't send swap promises to the LTH in process on the client side. | |
| 4985 MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromiseMFBA); | 5027 MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromiseMFBA); |
| 4986 | 5028 |
| 4987 class LayerTreeHostTestBreakSwapPromiseForVisibility | 5029 class LayerTreeHostTestBreakSwapPromiseForVisibility |
| 4988 : public LayerTreeHostTest { | 5030 : public LayerTreeHostTest { |
| 4989 protected: | 5031 protected: |
| 4990 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 5032 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4991 | 5033 |
| 4992 void SetVisibleFalseAndQueueSwapPromise() { | 5034 void SetVisibleFalseAndQueueSwapPromise() { |
| 4993 layer_tree_host()->SetVisible(false); | 5035 layer_tree_host()->SetVisible(false); |
| 4994 std::unique_ptr<SwapPromise> swap_promise( | 5036 std::unique_ptr<SwapPromise> swap_promise( |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 5017 EXPECT_FALSE(swap_promise_result_.did_swap_called); | 5059 EXPECT_FALSE(swap_promise_result_.did_swap_called); |
| 5018 EXPECT_TRUE(swap_promise_result_.did_not_swap_called); | 5060 EXPECT_TRUE(swap_promise_result_.did_not_swap_called); |
| 5019 EXPECT_EQ(SwapPromise::COMMIT_FAILS, swap_promise_result_.reason); | 5061 EXPECT_EQ(SwapPromise::COMMIT_FAILS, swap_promise_result_.reason); |
| 5020 EXPECT_TRUE(swap_promise_result_.dtor_called); | 5062 EXPECT_TRUE(swap_promise_result_.dtor_called); |
| 5021 } | 5063 } |
| 5022 } | 5064 } |
| 5023 | 5065 |
| 5024 TestSwapPromiseResult swap_promise_result_; | 5066 TestSwapPromiseResult swap_promise_result_; |
| 5025 }; | 5067 }; |
| 5026 | 5068 |
| 5069 // No remote test because LTH remote runs its own swap promises, and we | |
| 5070 // don't send swap promises to the LTH in process on the client side. | |
| 5027 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForVisibility); | 5071 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForVisibility); |
| 5028 | 5072 |
| 5029 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { | 5073 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { |
| 5030 public: | 5074 public: |
| 5031 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, | 5075 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, |
| 5032 LayerTreeHostImpl* layer_tree_host_impl, | 5076 LayerTreeHostImpl* layer_tree_host_impl, |
| 5033 int* set_needs_commit_count, | 5077 int* set_needs_commit_count, |
| 5034 int* set_needs_redraw_count) | 5078 int* set_needs_redraw_count) |
| 5035 : SwapPromiseMonitor( | 5079 : SwapPromiseMonitor( |
| 5036 (layer_tree_host ? layer_tree_host->GetSwapPromiseManager() | 5080 (layer_tree_host ? layer_tree_host->GetSwapPromiseManager() |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5100 EXPECT_EQ(3, set_needs_commit_count); | 5144 EXPECT_EQ(3, set_needs_commit_count); |
| 5101 EXPECT_EQ(0, set_needs_redraw_count); | 5145 EXPECT_EQ(0, set_needs_redraw_count); |
| 5102 } | 5146 } |
| 5103 | 5147 |
| 5104 EndTest(); | 5148 EndTest(); |
| 5105 } | 5149 } |
| 5106 | 5150 |
| 5107 void AfterTest() override {} | 5151 void AfterTest() override {} |
| 5108 }; | 5152 }; |
| 5109 | 5153 |
| 5154 // No remote test because LTH remote runs its own swap promises, and we | |
| 5155 // don't send swap promises to the LTH in process on the client side. | |
| 5110 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); | 5156 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); |
| 5111 | 5157 |
| 5112 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources | 5158 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources |
| 5113 : public LayerTreeHostTest { | 5159 : public LayerTreeHostTest { |
| 5114 protected: | 5160 protected: |
| 5115 void SetupTree() override { | 5161 void SetupTree() override { |
| 5116 LayerTreeHostTest::SetupTree(); | 5162 LayerTreeHostTest::SetupTree(); |
| 5117 ui_resource_ = | 5163 ui_resource_ = |
| 5118 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); | 5164 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); |
| 5119 client_.set_bounds(layer_tree()->root_layer()->bounds()); | 5165 client_.set_bounds(layer_tree()->root_layer()->bounds()); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5321 EndTest(); | 5367 EndTest(); |
| 5322 } | 5368 } |
| 5323 | 5369 |
| 5324 void AfterTest() override {} | 5370 void AfterTest() override {} |
| 5325 | 5371 |
| 5326 FakeContentLayerClient layer_client_; | 5372 FakeContentLayerClient layer_client_; |
| 5327 FakePictureLayer* layer_; | 5373 FakePictureLayer* layer_; |
| 5328 FakeRecordingSource* recording_source_; | 5374 FakeRecordingSource* recording_source_; |
| 5329 }; | 5375 }; |
| 5330 | 5376 |
| 5377 // No remote test since we does not send gpu rasterization flag to the client. | |
| 5378 // See crbug/650431. | |
| 5331 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); | 5379 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); |
| 5332 | 5380 |
| 5333 class LayerTreeHostTestGpuRasterizationReenabled : public LayerTreeHostTest { | 5381 class LayerTreeHostTestGpuRasterizationReenabled : public LayerTreeHostTest { |
| 5334 protected: | 5382 protected: |
| 5335 void InitializeSettings(LayerTreeSettings* settings) override { | 5383 void InitializeSettings(LayerTreeSettings* settings) override { |
| 5336 EXPECT_FALSE(settings->gpu_rasterization_enabled); | 5384 EXPECT_FALSE(settings->gpu_rasterization_enabled); |
| 5337 settings->gpu_rasterization_enabled = true; | 5385 settings->gpu_rasterization_enabled = true; |
| 5338 } | 5386 } |
| 5339 | 5387 |
| 5340 void SetupTree() override { | 5388 void SetupTree() override { |
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7036 EndTest(); | 7084 EndTest(); |
| 7037 } | 7085 } |
| 7038 | 7086 |
| 7039 void AfterTest() override {} | 7087 void AfterTest() override {} |
| 7040 }; | 7088 }; |
| 7041 | 7089 |
| 7042 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); | 7090 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); |
| 7043 | 7091 |
| 7044 } // namespace | 7092 } // namespace |
| 7045 } // namespace cc | 7093 } // namespace cc |
| OLD | NEW |