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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2456093003: Enable more layer_tree_host_unittest for LayerTreeHostRemote. (Closed)
Patch Set: Minor polish on refactored test class. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/test/remote_client_layer_factory.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
40 #include "cc/test/fake_painted_scrollbar_layer.h" 40 #include "cc/test/fake_painted_scrollbar_layer.h"
41 #include "cc/test/fake_picture_layer.h" 41 #include "cc/test/fake_picture_layer.h"
42 #include "cc/test/fake_picture_layer_impl.h" 42 #include "cc/test/fake_picture_layer_impl.h"
43 #include "cc/test/fake_proxy.h" 43 #include "cc/test/fake_proxy.h"
44 #include "cc/test/fake_recording_source.h" 44 #include "cc/test/fake_recording_source.h"
45 #include "cc/test/fake_scoped_ui_resource.h" 45 #include "cc/test/fake_scoped_ui_resource.h"
46 #include "cc/test/fake_video_frame_provider.h" 46 #include "cc/test/fake_video_frame_provider.h"
47 #include "cc/test/geometry_test_utils.h" 47 #include "cc/test/geometry_test_utils.h"
48 #include "cc/test/layer_internals_for_test.h" 48 #include "cc/test/layer_internals_for_test.h"
49 #include "cc/test/layer_tree_test.h" 49 #include "cc/test/layer_tree_test.h"
50 #include "cc/test/push_properties_counting_layer.h"
51 #include "cc/test/push_properties_counting_layer_impl.h"
50 #include "cc/test/render_pass_test_utils.h" 52 #include "cc/test/render_pass_test_utils.h"
51 #include "cc/test/skia_common.h" 53 #include "cc/test/skia_common.h"
52 #include "cc/test/test_compositor_frame_sink.h" 54 #include "cc/test/test_compositor_frame_sink.h"
53 #include "cc/test/test_web_graphics_context_3d.h" 55 #include "cc/test/test_web_graphics_context_3d.h"
54 #include "cc/trees/effect_node.h" 56 #include "cc/trees/effect_node.h"
55 #include "cc/trees/layer_tree_host_common.h" 57 #include "cc/trees/layer_tree_host_common.h"
56 #include "cc/trees/layer_tree_host_impl.h" 58 #include "cc/trees/layer_tree_host_impl.h"
57 #include "cc/trees/layer_tree_impl.h" 59 #include "cc/trees/layer_tree_impl.h"
58 #include "cc/trees/single_thread_proxy.h" 60 #include "cc/trees/single_thread_proxy.h"
59 #include "cc/trees/swap_promise_manager.h" 61 #include "cc/trees/swap_promise_manager.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_); 281 EXPECT_TRUE(all_tiles_required_for_activation_are_ready_to_draw_);
280 EXPECT_LE(size_t(1), required_for_activation_count_); 282 EXPECT_LE(size_t(1), required_for_activation_count_);
281 } 283 }
282 284
283 private: 285 private:
284 FakeContentLayerClient client_; 286 FakeContentLayerClient client_;
285 }; 287 };
286 288
287 // No single thread test because the commit goes directly to the active tree in 289 // No single thread test because the commit goes directly to the active tree in
288 // single thread mode, so notify ready to activate is skipped. 290 // single thread mode, so notify ready to activate is skipped.
289 // No remote test because we currently don't deserialize FakePictureLayer, 291 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty);
290 // so on the impl side, PictureLayerImpl is created instead of
291 // FakePictureLayerImpl, see crbug/657871.
292 MULTI_THREAD_TEST_F(LayerTreeHostTestReadyToActivateNonEmpty);
293 292
294 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when 293 // Test if the LTHI receives ReadyToDraw notifications from the TileManager when
295 // no raster tasks get scheduled. 294 // no raster tasks get scheduled.
296 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest { 295 class LayerTreeHostTestReadyToDrawEmpty : public LayerTreeHostTest {
297 public: 296 public:
298 LayerTreeHostTestReadyToDrawEmpty() 297 LayerTreeHostTestReadyToDrawEmpty()
299 : did_notify_ready_to_draw_(false), 298 : did_notify_ready_to_draw_(false),
300 all_tiles_required_for_draw_are_ready_to_draw_(false), 299 all_tiles_required_for_draw_are_ready_to_draw_(false),
301 required_for_draw_count_(0) {} 300 required_for_draw_count_(0) {}
302 301
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 private: 1615 private:
1617 int num_draws_; 1616 int num_draws_;
1618 const gfx::Size bounds_; 1617 const gfx::Size bounds_;
1619 const gfx::Rect invalid_rect_; 1618 const gfx::Rect invalid_rect_;
1620 FakeContentLayerClient client_; 1619 FakeContentLayerClient client_;
1621 scoped_refptr<FakePictureLayer> root_layer_; 1620 scoped_refptr<FakePictureLayer> root_layer_;
1622 }; 1621 };
1623 1622
1624 // As there's no pending tree in single-threaded case, this test should run 1623 // As there's no pending tree in single-threaded case, this test should run
1625 // only for multi-threaded case. 1624 // only for multi-threaded case.
1626 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); 1625 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged);
1627 1626
1628 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { 1627 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
1629 public: 1628 public:
1630 void InitializeSettings(LayerTreeSettings* settings) override { 1629 void InitializeSettings(LayerTreeSettings* settings) override {
1631 settings->layer_transforms_should_scale_layer_contents = true; 1630 settings->layer_transforms_should_scale_layer_contents = true;
1632 } 1631 }
1633 1632
1634 void SetupTree() override { 1633 void SetupTree() override {
1635 root_layer_ = Layer::Create(); 1634 root_layer_ = Layer::Create();
1636 root_layer_->SetBounds(gfx::Size(10, 20)); 1635 root_layer_->SetBounds(gfx::Size(10, 20));
(...skipping 29 matching lines...) Expand all
1666 void AfterTest() override { 1665 void AfterTest() override {
1667 EXPECT_EQ(gfx::Size(4, 4).ToString(), scaled_layer_->bounds().ToString()); 1666 EXPECT_EQ(gfx::Size(4, 4).ToString(), scaled_layer_->bounds().ToString());
1668 } 1667 }
1669 1668
1670 private: 1669 private:
1671 FakeContentLayerClient client_; 1670 FakeContentLayerClient client_;
1672 scoped_refptr<Layer> root_layer_; 1671 scoped_refptr<Layer> root_layer_;
1673 scoped_refptr<Layer> scaled_layer_; 1672 scoped_refptr<Layer> scaled_layer_;
1674 }; 1673 };
1675 1674
1676 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate); 1675 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestNoExtraCommitFromInvalidate);
1677 1676
1678 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate 1677 class LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate
1679 : public LayerTreeHostTest { 1678 : public LayerTreeHostTest {
1680 public: 1679 public:
1681 void InitializeSettings(LayerTreeSettings* settings) override { 1680 void InitializeSettings(LayerTreeSettings* settings) override {
1682 settings->layer_transforms_should_scale_layer_contents = true; 1681 settings->layer_transforms_should_scale_layer_contents = true;
1683 } 1682 }
1684 1683
1685 void SetupTree() override { 1684 void SetupTree() override {
1686 root_layer_ = Layer::Create(); 1685 root_layer_ = Layer::Create();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1723 } 1722 }
1724 1723
1725 void AfterTest() override {} 1724 void AfterTest() override {}
1726 1725
1727 private: 1726 private:
1728 FakeContentLayerClient client_; 1727 FakeContentLayerClient client_;
1729 scoped_refptr<Layer> root_layer_; 1728 scoped_refptr<Layer> root_layer_;
1730 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_; 1729 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_;
1731 }; 1730 };
1732 1731
1732 // No remote test here because PaintedScrollbarLayer is not supported by LTH
1733 // remote.
1733 SINGLE_AND_MULTI_THREAD_TEST_F( 1734 SINGLE_AND_MULTI_THREAD_TEST_F(
1734 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate); 1735 LayerTreeHostTestNoExtraCommitFromScrollbarInvalidate);
1735 1736
1736 class LayerTreeHostTestDeviceScaleFactorChange : public LayerTreeHostTest { 1737 class LayerTreeHostTestDeviceScaleFactorChange : public LayerTreeHostTest {
1737 public: 1738 public:
1738 void InitializeSettings(LayerTreeSettings* settings) override { 1739 void InitializeSettings(LayerTreeSettings* settings) override {
1739 settings->layer_transforms_should_scale_layer_contents = true; 1740 settings->layer_transforms_should_scale_layer_contents = true;
1740 } 1741 }
1741 1742
1742 void SetupTree() override { 1743 void SetupTree() override {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 } 1791 }
1791 1792
1792 void AfterTest() override {} 1793 void AfterTest() override {}
1793 1794
1794 private: 1795 private:
1795 FakeContentLayerClient client_; 1796 FakeContentLayerClient client_;
1796 scoped_refptr<Layer> root_layer_; 1797 scoped_refptr<Layer> root_layer_;
1797 scoped_refptr<Layer> child_layer_; 1798 scoped_refptr<Layer> child_layer_;
1798 }; 1799 };
1799 1800
1800 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorChange); 1801 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestDeviceScaleFactorChange);
1801 1802
1802 class LayerTreeHostTestDeviceColorSpaceChange : public LayerTreeHostTest { 1803 class LayerTreeHostTestDeviceColorSpaceChange : public LayerTreeHostTest {
1803 public: 1804 public:
1804 void SetupTree() override { 1805 void SetupTree() override {
1805 space1_ = gfx::ColorSpace::CreateXYZD50(); 1806 space1_ = gfx::ColorSpace::CreateXYZD50();
1806 space2_ = gfx::ColorSpace::CreateSRGB(); 1807 space2_ = gfx::ColorSpace::CreateSRGB();
1807 1808
1808 root_layer_ = Layer::Create(); 1809 root_layer_ = Layer::Create();
1809 root_layer_->SetBounds(gfx::Size(10, 20)); 1810 root_layer_->SetBounds(gfx::Size(10, 20));
1810 1811
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 void AfterTest() override {} 1914 void AfterTest() override {}
1914 1915
1915 private: 1916 private:
1916 gfx::ColorSpace space1_; 1917 gfx::ColorSpace space1_;
1917 gfx::ColorSpace space2_; 1918 gfx::ColorSpace space2_;
1918 FakeContentLayerClient client_; 1919 FakeContentLayerClient client_;
1919 scoped_refptr<Layer> root_layer_; 1920 scoped_refptr<Layer> root_layer_;
1920 scoped_refptr<Layer> child_layer_; 1921 scoped_refptr<Layer> child_layer_;
1921 }; 1922 };
1922 1923
1924 // No remote test because LTH remote doesn't serialize device_color_space, so
1925 // LTH in process will always use the default color space here.
1926 // see crbug/658786.
1923 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceColorSpaceChange); 1927 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceColorSpaceChange);
1924 1928
1925 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest { 1929 class LayerTreeHostTestSetNextCommitForcesRedraw : public LayerTreeHostTest {
1926 public: 1930 public:
1927 LayerTreeHostTestSetNextCommitForcesRedraw() 1931 LayerTreeHostTestSetNextCommitForcesRedraw()
1928 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {} 1932 : num_draws_(0), bounds_(50, 50), invalid_rect_(10, 10, 20, 20) {}
1929 1933
1930 void BeginTest() override { 1934 void BeginTest() override {
1931 root_layer_ = FakePictureLayer::Create(&client_); 1935 root_layer_ = FakePictureLayer::Create(&client_);
1932 root_layer_->SetIsDrawable(true); 1936 root_layer_->SetIsDrawable(true);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 private: 2007 private:
2004 int num_draws_; 2008 int num_draws_;
2005 const gfx::Size bounds_; 2009 const gfx::Size bounds_;
2006 const gfx::Rect invalid_rect_; 2010 const gfx::Rect invalid_rect_;
2007 FakeContentLayerClient client_; 2011 FakeContentLayerClient client_;
2008 scoped_refptr<FakePictureLayer> root_layer_; 2012 scoped_refptr<FakePictureLayer> root_layer_;
2009 }; 2013 };
2010 2014
2011 // This test blocks activation which is not supported for single thread mode. 2015 // This test blocks activation which is not supported for single thread mode.
2012 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw); 2016 MULTI_THREAD_BLOCKNOTIFY_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw);
2017 REMOTE_TEST_F(LayerTreeHostTestSetNextCommitForcesRedraw);
2013 2018
2014 // Tests that if a layer is not drawn because of some reason in the parent then 2019 // Tests that if a layer is not drawn because of some reason in the parent then
2015 // its damage is preserved until the next time it is drawn. 2020 // its damage is preserved until the next time it is drawn.
2016 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest { 2021 class LayerTreeHostTestUndrawnLayersDamageLater : public LayerTreeHostTest {
2017 public: 2022 public:
2018 void InitializeSettings(LayerTreeSettings* settings) override { 2023 void InitializeSettings(LayerTreeSettings* settings) override {
2019 // If we don't set the minimum contents scale, it's harder to verify whether 2024 // If we don't set the minimum contents scale, it's harder to verify whether
2020 // the damage we get is correct. For other scale amounts, please see 2025 // the damage we get is correct. For other scale amounts, please see
2021 // LayerTreeHostTestDamageWithScale. 2026 // LayerTreeHostTestDamageWithScale.
2022 settings->minimum_contents_scale = 1.f; 2027 settings->minimum_contents_scale = 1.f;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 2104
2100 void AfterTest() override {} 2105 void AfterTest() override {}
2101 2106
2102 private: 2107 private:
2103 FakeContentLayerClient client_; 2108 FakeContentLayerClient client_;
2104 scoped_refptr<FakePictureLayer> root_layer_; 2109 scoped_refptr<FakePictureLayer> root_layer_;
2105 scoped_refptr<FakePictureLayer> parent_layer_; 2110 scoped_refptr<FakePictureLayer> parent_layer_;
2106 scoped_refptr<FakePictureLayer> child_layer_; 2111 scoped_refptr<FakePictureLayer> child_layer_;
2107 }; 2112 };
2108 2113
2109 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater); 2114 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestUndrawnLayersDamageLater);
2110 2115
2111 // Tests that if a layer is not drawn because of some reason in the parent then 2116 // Tests that if a layer is not drawn because of some reason in the parent then
2112 // its damage is preserved until the next time it is drawn. 2117 // its damage is preserved until the next time it is drawn.
2113 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest { 2118 class LayerTreeHostTestDamageWithScale : public LayerTreeHostTest {
2114 public: 2119 public:
2115 LayerTreeHostTestDamageWithScale() {} 2120 LayerTreeHostTestDamageWithScale() {}
2116 2121
2117 void SetupTree() override { 2122 void SetupTree() override {
2118 client_.set_fill_with_nonsolid_color(true); 2123 client_.set_fill_with_nonsolid_color(true);
2119 2124
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
2204 } 2209 }
2205 2210
2206 void AfterTest() override {} 2211 void AfterTest() override {}
2207 2212
2208 private: 2213 private:
2209 FakeContentLayerClient client_; 2214 FakeContentLayerClient client_;
2210 scoped_refptr<Layer> root_layer_; 2215 scoped_refptr<Layer> root_layer_;
2211 scoped_refptr<Layer> child_layer_; 2216 scoped_refptr<Layer> child_layer_;
2212 }; 2217 };
2213 2218
2214 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDamageWithScale); 2219 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestDamageWithScale);
2215 2220
2216 // This test verifies that properties on the layer tree host are commited 2221 // This test verifies that properties on the layer tree host are commited
2217 // to the impl side. 2222 // to the impl side.
2218 class LayerTreeHostTestCommit : public LayerTreeHostTest { 2223 class LayerTreeHostTestCommit : public LayerTreeHostTest {
2219 public: 2224 public:
2220 LayerTreeHostTestCommit() {} 2225 LayerTreeHostTestCommit() {}
2221 2226
2222 void BeginTest() override { 2227 void BeginTest() override {
2223 layer_tree()->SetViewportSize(gfx::Size(20, 20)); 2228 layer_tree()->SetViewportSize(gfx::Size(20, 20));
2224 layer_tree()->set_background_color(SK_ColorGRAY); 2229 layer_tree()->set_background_color(SK_ColorGRAY);
(...skipping 23 matching lines...) Expand all
2248 impl->active_tree()->event_listener_properties( 2253 impl->active_tree()->event_listener_properties(
2249 EventListenerClass::kTouchEndOrCancel)); 2254 EventListenerClass::kTouchEndOrCancel));
2250 EXPECT_TRUE(impl->active_tree()->have_scroll_event_handlers()); 2255 EXPECT_TRUE(impl->active_tree()->have_scroll_event_handlers());
2251 2256
2252 EndTest(); 2257 EndTest();
2253 } 2258 }
2254 2259
2255 void AfterTest() override {} 2260 void AfterTest() override {}
2256 }; 2261 };
2257 2262
2258 MULTI_THREAD_TEST_F(LayerTreeHostTestCommit); 2263 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestCommit);
2259 2264
2260 // This test verifies that LayerTreeHostImpl's current frame time gets 2265 // This test verifies that LayerTreeHostImpl's current frame time gets
2261 // updated in consecutive frames when it doesn't draw due to tree 2266 // updated in consecutive frames when it doesn't draw due to tree
2262 // activation failure. 2267 // activation failure.
2263 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails 2268 class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
2264 : public LayerTreeHostTest { 2269 : public LayerTreeHostTest {
2265 public: 2270 public:
2266 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() 2271 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails()
2267 : frame_count_with_pending_tree_(0) {} 2272 : frame_count_with_pending_tree_(0) {}
2268 2273
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 void AfterTest() override {} 2311 void AfterTest() override {}
2307 2312
2308 private: 2313 private:
2309 int frame_count_with_pending_tree_; 2314 int frame_count_with_pending_tree_;
2310 base::TimeTicks first_frame_time_; 2315 base::TimeTicks first_frame_time_;
2311 }; 2316 };
2312 2317
2313 // This test blocks activation which is not supported for single thread mode. 2318 // This test blocks activation which is not supported for single thread mode.
2314 MULTI_THREAD_BLOCKNOTIFY_TEST_F( 2319 MULTI_THREAD_BLOCKNOTIFY_TEST_F(
2315 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails); 2320 LayerTreeHostTestFrameTimeUpdatesAfterActivationFails);
2321 REMOTE_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterActivationFails);
2316 2322
2317 // This test verifies that LayerTreeHostImpl's current frame time gets 2323 // This test verifies that LayerTreeHostImpl's current frame time gets
2318 // updated in consecutive frames when it draws in each frame. 2324 // updated in consecutive frames when it draws in each frame.
2319 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest { 2325 class LayerTreeHostTestFrameTimeUpdatesAfterDraw : public LayerTreeHostTest {
2320 public: 2326 public:
2321 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {} 2327 LayerTreeHostTestFrameTimeUpdatesAfterDraw() : frame_(0) {}
2322 2328
2323 void BeginTest() override { 2329 void BeginTest() override {
2324 layer_tree()->SetViewportSize(gfx::Size(20, 20)); 2330 layer_tree()->SetViewportSize(gfx::Size(20, 20));
2325 layer_tree()->set_background_color(SK_ColorGRAY); 2331 layer_tree()->set_background_color(SK_ColorGRAY);
(...skipping 28 matching lines...) Expand all
2354 EXPECT_EQ(0, frame_); 2360 EXPECT_EQ(0, frame_);
2355 } 2361 }
2356 2362
2357 void AfterTest() override {} 2363 void AfterTest() override {}
2358 2364
2359 private: 2365 private:
2360 int frame_; 2366 int frame_;
2361 base::TimeTicks first_frame_time_; 2367 base::TimeTicks first_frame_time_;
2362 }; 2368 };
2363 2369
2364 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterDraw); 2370 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestFrameTimeUpdatesAfterDraw);
2365 2371
2366 // Verifies that StartPageScaleAnimation events propagate correctly 2372 // Verifies that StartPageScaleAnimation events propagate correctly
2367 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor. 2373 // from LayerTreeHost to LayerTreeHostImpl in the MT compositor.
2368 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest { 2374 class LayerTreeHostTestStartPageScaleAnimation : public LayerTreeHostTest {
2369 public: 2375 public:
2370 LayerTreeHostTestStartPageScaleAnimation() {} 2376 LayerTreeHostTestStartPageScaleAnimation() {}
2371 2377
2372 void SetupTree() override { 2378 void SetupTree() override {
2373 LayerTreeHostTest::SetupTree(); 2379 LayerTreeHostTest::SetupTree();
2374 2380
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 } 2438 }
2433 } 2439 }
2434 2440
2435 void AfterTest() override {} 2441 void AfterTest() override {}
2436 2442
2437 FakeContentLayerClient client_; 2443 FakeContentLayerClient client_;
2438 scoped_refptr<Layer> scroll_layer_; 2444 scoped_refptr<Layer> scroll_layer_;
2439 }; 2445 };
2440 2446
2441 // Single thread proxy does not support impl-side page scale changes. 2447 // Single thread proxy does not support impl-side page scale changes.
2448 // Remote test does not support page scale animation.
2442 MULTI_THREAD_TEST_F(LayerTreeHostTestStartPageScaleAnimation); 2449 MULTI_THREAD_TEST_F(LayerTreeHostTestStartPageScaleAnimation);
2443 2450
2444 class LayerTreeHostTestSetVisible : public LayerTreeHostTest { 2451 class LayerTreeHostTestSetVisible : public LayerTreeHostTest {
2445 public: 2452 public:
2446 LayerTreeHostTestSetVisible() : num_draws_(0) {} 2453 LayerTreeHostTestSetVisible() : num_draws_(0) {}
2447 2454
2448 void BeginTest() override { 2455 void BeginTest() override {
2449 PostSetNeedsCommitToMainThread(); 2456 PostSetNeedsCommitToMainThread();
2450 } 2457 }
2451 2458
(...skipping 10 matching lines...) Expand all
2462 ++num_draws_; 2469 ++num_draws_;
2463 EndTest(); 2470 EndTest();
2464 } 2471 }
2465 2472
2466 void AfterTest() override { EXPECT_EQ(1, num_draws_); } 2473 void AfterTest() override { EXPECT_EQ(1, num_draws_); }
2467 2474
2468 private: 2475 private:
2469 int num_draws_; 2476 int num_draws_;
2470 }; 2477 };
2471 2478
2472 MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible); 2479 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetVisible);
2473 2480
2474 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers 2481 class LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers
2475 : public LayerTreeHostTest { 2482 : public LayerTreeHostTest {
2476 public: 2483 public:
2477 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {} 2484 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers() {}
2478 2485
2479 void BeginTest() override { 2486 void BeginTest() override {
2480 client_.set_fill_with_nonsolid_color(true); 2487 client_.set_fill_with_nonsolid_color(true);
2481 root_layer_ = FakePictureLayer::Create(&client_); 2488 root_layer_ = FakePictureLayer::Create(&client_);
2482 child_layer_ = FakePictureLayer::Create(&client_); 2489 child_layer_ = FakePictureLayer::Create(&client_);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 } 2571 }
2565 2572
2566 void AfterTest() override {} 2573 void AfterTest() override {}
2567 2574
2568 private: 2575 private:
2569 FakeContentLayerClient client_; 2576 FakeContentLayerClient client_;
2570 scoped_refptr<FakePictureLayer> root_layer_; 2577 scoped_refptr<FakePictureLayer> root_layer_;
2571 scoped_refptr<FakePictureLayer> child_layer_; 2578 scoped_refptr<FakePictureLayer> child_layer_;
2572 }; 2579 };
2573 2580
2574 MULTI_THREAD_TEST_F(LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers); 2581 REMOTE_AND_MULTI_THREAD_TEST_F(
2582 LayerTreeHostTestDeviceScaleFactorScalesViewportAndLayers);
2575 2583
2576 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest { 2584 class LayerTreeHostTestContinuousInvalidate : public LayerTreeHostTest {
2577 public: 2585 public:
2578 LayerTreeHostTestContinuousInvalidate() 2586 LayerTreeHostTestContinuousInvalidate()
2579 : num_commit_complete_(0), num_draw_layers_(0) {} 2587 : num_commit_complete_(0), num_draw_layers_(0) {}
2580 2588
2581 void BeginTest() override { 2589 void BeginTest() override {
2582 layer_tree()->SetViewportSize(gfx::Size(10, 10)); 2590 layer_tree()->SetViewportSize(gfx::Size(10, 10));
2583 layer_tree()->root_layer()->SetBounds(gfx::Size(10, 10)); 2591 layer_tree()->root_layer()->SetBounds(gfx::Size(10, 10));
2584 2592
(...skipping 29 matching lines...) Expand all
2614 EXPECT_EQ(1, num_commit_complete_); 2622 EXPECT_EQ(1, num_commit_complete_);
2615 } 2623 }
2616 2624
2617 private: 2625 private:
2618 FakeContentLayerClient client_; 2626 FakeContentLayerClient client_;
2619 scoped_refptr<Layer> layer_; 2627 scoped_refptr<Layer> layer_;
2620 int num_commit_complete_; 2628 int num_commit_complete_;
2621 int num_draw_layers_; 2629 int num_draw_layers_;
2622 }; 2630 };
2623 2631
2624 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestContinuousInvalidate); 2632 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestContinuousInvalidate);
2625 2633
2626 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest { 2634 class LayerTreeHostTestDeferCommits : public LayerTreeHostTest {
2627 public: 2635 public:
2628 LayerTreeHostTestDeferCommits() 2636 LayerTreeHostTestDeferCommits()
2629 : num_will_begin_impl_frame_(0), num_send_begin_main_frame_(0) {} 2637 : num_will_begin_impl_frame_(0), num_send_begin_main_frame_(0) {}
2630 2638
2631 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2639 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2632 2640
2633 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, 2641 void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
2634 const BeginFrameArgs& args) override { 2642 const BeginFrameArgs& args) override {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 void AfterTest() override { 2680 void AfterTest() override {
2673 EXPECT_GE(num_will_begin_impl_frame_, 5); 2681 EXPECT_GE(num_will_begin_impl_frame_, 5);
2674 EXPECT_EQ(2, num_send_begin_main_frame_); 2682 EXPECT_EQ(2, num_send_begin_main_frame_);
2675 } 2683 }
2676 2684
2677 private: 2685 private:
2678 int num_will_begin_impl_frame_; 2686 int num_will_begin_impl_frame_;
2679 int num_send_begin_main_frame_; 2687 int num_send_begin_main_frame_;
2680 }; 2688 };
2681 2689
2682 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDeferCommits); 2690 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestDeferCommits);
2683 2691
2684 class LayerTreeHostTestCompositeImmediatelyStateTransitions 2692 class LayerTreeHostTestCompositeImmediatelyStateTransitions
2685 : public LayerTreeHostTest { 2693 : public LayerTreeHostTest {
2686 public: 2694 public:
2687 enum { 2695 enum {
2688 kInvalid, 2696 kInvalid,
2689 kStartedTest, 2697 kStartedTest,
2690 kStartedImplFrame, 2698 kStartedImplFrame,
2691 kStartedMainFrame, 2699 kStartedMainFrame,
2692 kStartedCommit, 2700 kStartedCommit,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2831 } 2839 }
2832 } 2840 }
2833 2841
2834 void AfterTest() override {} 2842 void AfterTest() override {}
2835 2843
2836 private: 2844 private:
2837 FakeContentLayerClient client_; 2845 FakeContentLayerClient client_;
2838 int num_tiles_rastered_; 2846 int num_tiles_rastered_;
2839 }; 2847 };
2840 2848
2841 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestLCDChange); 2849 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestLCDChange);
2842 2850
2843 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled 2851 class LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled
2844 : public LayerTreeHostTest { 2852 : public LayerTreeHostTest {
2845 public: 2853 public:
2846 void InitializeSettings(LayerTreeSettings* settings) override { 2854 void InitializeSettings(LayerTreeSettings* settings) override {
2847 settings->using_synchronous_renderer_compositor = true; 2855 settings->using_synchronous_renderer_compositor = true;
2848 } 2856 }
2849 2857
2850 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2858 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2851 2859
2852 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 2860 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
2853 // The BeginFrame notification is turned off now but will get enabled 2861 // The BeginFrame notification is turned off now but will get enabled
2854 // once we return. End test while it's enabled. 2862 // once we return. End test while it's enabled.
2855 ImplThreadTaskRunner()->PostTask( 2863 ImplThreadTaskRunner()->PostTask(
2856 FROM_HERE, 2864 FROM_HERE,
2857 base::Bind(&LayerTreeHostTest::EndTest, base::Unretained(this))); 2865 base::Bind(&LayerTreeHostTest::EndTest, base::Unretained(this)));
2858 } 2866 }
2859 2867
2860 void AfterTest() override {} 2868 void AfterTest() override {}
2861 }; 2869 };
2862 2870
2871 // No remote test since synchronous renderer compositor is not supported for LTH
2872 // remote.
2863 MULTI_THREAD_TEST_F( 2873 MULTI_THREAD_TEST_F(
2864 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); 2874 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled);
2865 2875
2866 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { 2876 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest {
2867 protected: 2877 protected:
2868 LayerTreeHostTestAbortedCommitDoesntStall() 2878 LayerTreeHostTestAbortedCommitDoesntStall()
2869 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} 2879 : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {}
2870 2880
2871 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 2881 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
2872 2882
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2977 ImplThreadTaskRunner()->PostTask( 2987 ImplThreadTaskRunner()->PostTask(
2978 FROM_HERE, base::Bind(&OnDrawCompositorFrameSink::OnDraw, 2988 FROM_HERE, base::Bind(&OnDrawCompositorFrameSink::OnDraw,
2979 base::Unretained(compositor_frame_sink_), 2989 base::Unretained(compositor_frame_sink_),
2980 resourceless_software_draw)); 2990 resourceless_software_draw));
2981 } 2991 }
2982 } 2992 }
2983 2993
2984 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr; 2994 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr;
2985 }; 2995 };
2986 2996
2997 // No remote test since synchronous renderer compositor is not supported for LTH
2998 // remote.
2987 MULTI_THREAD_TEST_F( 2999 MULTI_THREAD_TEST_F(
2988 LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor); 3000 LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor);
2989 3001
2990 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation 3002 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
2991 : public LayerTreeHostTest { 3003 : public LayerTreeHostTest {
2992 protected: 3004 protected:
2993 void SetupTree() override { 3005 void SetupTree() override {
2994 LayerTreeHostTest::SetupTree(); 3006 LayerTreeHostTest::SetupTree();
2995 3007
2996 scoped_refptr<Layer> layer = PictureLayer::Create(&client_); 3008 scoped_refptr<Layer> layer = PictureLayer::Create(&client_);
2997 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)); 3009 layer->SetTransform(gfx::Transform(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
2998 layer->SetBounds(gfx::Size(10, 10)); 3010 layer->SetBounds(gfx::Size(10, 10));
2999 layer_tree()->root_layer()->AddChild(layer); 3011 layer_tree()->root_layer()->AddChild(layer);
3000 client_.set_bounds(layer->bounds()); 3012 client_.set_bounds(layer->bounds());
3001 } 3013 }
3002 3014
3003 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3015 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3004 3016
3005 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override { 3017 void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
3006 EndTest(); 3018 EndTest();
3007 } 3019 }
3008 3020
3009 void AfterTest() override {} 3021 void AfterTest() override {}
3010 3022
3011 FakeContentLayerClient client_; 3023 FakeContentLayerClient client_;
3012 }; 3024 };
3013 3025
3014 SINGLE_AND_MULTI_THREAD_TEST_F( 3026 SINGLE_MULTI_AND_REMOTE_TEST_F(
3015 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation); 3027 LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation);
3016 3028
3017 class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest { 3029 class LayerTreeHostTestNumFramesPending : public LayerTreeHostTest {
3018 public: 3030 public:
3019 void BeginTest() override { 3031 void BeginTest() override {
3020 frame_ = 0; 3032 frame_ = 0;
3021 PostSetNeedsCommitToMainThread(); 3033 PostSetNeedsCommitToMainThread();
3022 } 3034 }
3023 3035
3024 // Round 1: commit + draw 3036 // Round 1: commit + draw
(...skipping 28 matching lines...) Expand all
3053 break; 3065 break;
3054 } 3066 }
3055 } 3067 }
3056 3068
3057 void AfterTest() override {} 3069 void AfterTest() override {}
3058 3070
3059 protected: 3071 protected:
3060 int frame_; 3072 int frame_;
3061 }; 3073 };
3062 3074
3063 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestNumFramesPending); 3075 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestNumFramesPending);
3064 3076
3065 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest { 3077 class LayerTreeHostTestResourcelessSoftwareDraw : public LayerTreeHostTest {
3066 protected: 3078 protected:
3067 void InitializeSettings(LayerTreeSettings* settings) override { 3079 void InitializeSettings(LayerTreeSettings* settings) override {
3068 settings->using_synchronous_renderer_compositor = true; 3080 settings->using_synchronous_renderer_compositor = true;
3069 } 3081 }
3070 3082
3071 void SetupTree() override { 3083 void SetupTree() override {
3072 root_layer_ = FakePictureLayer::Create(&client_); 3084 root_layer_ = FakePictureLayer::Create(&client_);
3073 root_layer_->SetIsDrawable(true); 3085 root_layer_->SetIsDrawable(true);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3159 private: 3171 private:
3160 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr; 3172 OnDrawCompositorFrameSink* compositor_frame_sink_ = nullptr;
3161 FakeContentLayerClient client_; 3173 FakeContentLayerClient client_;
3162 scoped_refptr<Layer> root_layer_; 3174 scoped_refptr<Layer> root_layer_;
3163 scoped_refptr<Layer> parent_layer_; 3175 scoped_refptr<Layer> parent_layer_;
3164 scoped_refptr<Layer> child_layer_; 3176 scoped_refptr<Layer> child_layer_;
3165 int draw_count_ = 0; 3177 int draw_count_ = 0;
3166 }; 3178 };
3167 3179
3168 // Resourceless is not used for SingleThreadProxy, so it is unimplemented. 3180 // Resourceless is not used for SingleThreadProxy, so it is unimplemented.
3181 // No remote test since synchronous renderer compositor is not supported for LTH
3182 // remote.
3169 MULTI_THREAD_TEST_F(LayerTreeHostTestResourcelessSoftwareDraw); 3183 MULTI_THREAD_TEST_F(LayerTreeHostTestResourcelessSoftwareDraw);
3170 3184
3171 // Test for UI Resource management. 3185 // Test for UI Resource management.
3172 class LayerTreeHostTestUIResource : public LayerTreeHostTest { 3186 class LayerTreeHostTestUIResource : public LayerTreeHostTest {
3173 public: 3187 public:
3174 LayerTreeHostTestUIResource() : num_ui_resources_(0) {} 3188 LayerTreeHostTestUIResource() : num_ui_resources_(0) {}
3175 3189
3176 void InitializeSettings(LayerTreeSettings* settings) override { 3190 void InitializeSettings(LayerTreeSettings* settings) override {
3177 settings->renderer_settings.texture_id_allocation_chunk_size = 1; 3191 settings->renderer_settings.texture_id_allocation_chunk_size = 1;
3178 } 3192 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 3269
3256 void CreateResource() { 3270 void CreateResource() {
3257 ui_resources_[num_ui_resources_++] = 3271 ui_resources_[num_ui_resources_++] =
3258 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); 3272 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager());
3259 } 3273 }
3260 3274
3261 std::unique_ptr<FakeScopedUIResource> ui_resources_[5]; 3275 std::unique_ptr<FakeScopedUIResource> ui_resources_[5];
3262 int num_ui_resources_; 3276 int num_ui_resources_;
3263 }; 3277 };
3264 3278
3279 // No remote test since LTH remote does not support UIResourceLayers and
3280 // PaintedScrollbarLayers, which uses UIResourceManager.
3265 MULTI_THREAD_TEST_F(LayerTreeHostTestUIResource); 3281 MULTI_THREAD_TEST_F(LayerTreeHostTestUIResource);
3266 3282
3267 class PushPropertiesCountingLayerImpl : public LayerImpl {
3268 public:
3269 static std::unique_ptr<PushPropertiesCountingLayerImpl> Create(
3270 LayerTreeImpl* tree_impl,
3271 int id) {
3272 return base::WrapUnique(new PushPropertiesCountingLayerImpl(tree_impl, id));
3273 }
3274
3275 ~PushPropertiesCountingLayerImpl() override {}
3276
3277 void PushPropertiesTo(LayerImpl* layer) override {
3278 LayerImpl::PushPropertiesTo(layer);
3279 push_properties_count_++;
3280 // Push state to the active tree because we can only access it from there.
3281 static_cast<PushPropertiesCountingLayerImpl*>(layer)
3282 ->push_properties_count_ = push_properties_count_;
3283 }
3284
3285 std::unique_ptr<LayerImpl> CreateLayerImpl(
3286 LayerTreeImpl* tree_impl) override {
3287 return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
3288 }
3289
3290 size_t push_properties_count() const { return push_properties_count_; }
3291 void reset_push_properties_count() { push_properties_count_ = 0; }
3292
3293 private:
3294 size_t push_properties_count_;
3295
3296 PushPropertiesCountingLayerImpl(LayerTreeImpl* tree_impl, int id)
3297 : LayerImpl(tree_impl, id), push_properties_count_(0) {
3298 SetBounds(gfx::Size(1, 1));
3299 }
3300 };
3301
3302 class PushPropertiesCountingLayer : public Layer {
3303 public:
3304 static scoped_refptr<PushPropertiesCountingLayer> Create() {
3305 return new PushPropertiesCountingLayer();
3306 }
3307
3308 void PushPropertiesTo(LayerImpl* layer) override {
3309 Layer::PushPropertiesTo(layer);
3310 push_properties_count_++;
3311 if (persist_needs_push_properties_) {
3312 GetLayerTree()->AddLayerShouldPushProperties(this);
3313 }
3314 }
3315
3316 // Something to make this layer push properties, but no other layer.
3317 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); }
3318
3319 std::unique_ptr<LayerImpl> CreateLayerImpl(
3320 LayerTreeImpl* tree_impl) override {
3321 return PushPropertiesCountingLayerImpl::Create(tree_impl, id());
3322 }
3323
3324 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); }
3325
3326 size_t push_properties_count() const { return push_properties_count_; }
3327 void reset_push_properties_count() { push_properties_count_ = 0; }
3328
3329 void set_persist_needs_push_properties(bool persist) {
3330 persist_needs_push_properties_ = persist;
3331 }
3332
3333 private:
3334 PushPropertiesCountingLayer()
3335 : push_properties_count_(0), persist_needs_push_properties_(false) {
3336 SetBounds(gfx::Size(1, 1));
3337 }
3338 ~PushPropertiesCountingLayer() override {}
3339
3340 size_t push_properties_count_;
3341 bool persist_needs_push_properties_;
3342 };
3343
3344 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest { 3283 class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
3345 protected: 3284 protected:
3346 void BeginTest() override { 3285 void BeginTest() override {
3347 num_commits_ = 0; 3286 num_commits_ = 0;
3348 expected_push_properties_root_ = 0; 3287 expected_push_properties_root_ = 0;
3349 expected_push_properties_child_ = 0; 3288 expected_push_properties_child_ = 0;
3350 expected_push_properties_grandchild_ = 0; 3289 expected_push_properties_grandchild_ = 0;
3351 expected_push_properties_child2_ = 0; 3290 expected_push_properties_child2_ = 0;
3352 expected_push_properties_other_root_ = 0; 3291 expected_push_properties_other_root_ = 0;
3353 expected_push_properties_leaf_layer_ = 0; 3292 expected_push_properties_leaf_layer_ = 0;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3534 scoped_refptr<PushPropertiesCountingLayer> other_root_; 3473 scoped_refptr<PushPropertiesCountingLayer> other_root_;
3535 scoped_refptr<PushPropertiesCountingLayer> leaf_always_pushing_layer_; 3474 scoped_refptr<PushPropertiesCountingLayer> leaf_always_pushing_layer_;
3536 size_t expected_push_properties_root_; 3475 size_t expected_push_properties_root_;
3537 size_t expected_push_properties_child_; 3476 size_t expected_push_properties_child_;
3538 size_t expected_push_properties_child2_; 3477 size_t expected_push_properties_child2_;
3539 size_t expected_push_properties_grandchild_; 3478 size_t expected_push_properties_grandchild_;
3540 size_t expected_push_properties_other_root_; 3479 size_t expected_push_properties_other_root_;
3541 size_t expected_push_properties_leaf_layer_; 3480 size_t expected_push_properties_leaf_layer_;
3542 }; 3481 };
3543 3482
3483 // No remote test because LTH remote does not build property trees, so layers
3484 // to push properties are different between engine and client.
3485 // See crbug/655795.
3544 MULTI_THREAD_TEST_F(LayerTreeHostTestLayersPushProperties); 3486 MULTI_THREAD_TEST_F(LayerTreeHostTestLayersPushProperties);
3545 3487
3546 class LayerTreeHostTestImplLayersPushProperties 3488 class LayerTreeHostTestImplLayersPushProperties
3547 : public LayerTreeHostTestLayersPushProperties { 3489 : public LayerTreeHostTestLayersPushProperties {
3548 protected: 3490 protected:
3549 void BeginTest() override { 3491 void BeginTest() override {
3550 expected_push_properties_root_impl_ = 0; 3492 expected_push_properties_root_impl_ = 0;
3551 expected_push_properties_child_impl_ = 0; 3493 expected_push_properties_child_impl_ = 0;
3552 expected_push_properties_grandchild_impl_ = 0; 3494 expected_push_properties_grandchild_impl_ = 0;
3553 expected_push_properties_child2_impl_ = 0; 3495 expected_push_properties_child2_impl_ = 0;
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3730 leaf_always_pushing_layer_impl_->push_properties_count()); 3672 leaf_always_pushing_layer_impl_->push_properties_count());
3731 } 3673 }
3732 3674
3733 size_t expected_push_properties_root_impl_; 3675 size_t expected_push_properties_root_impl_;
3734 size_t expected_push_properties_child_impl_; 3676 size_t expected_push_properties_child_impl_;
3735 size_t expected_push_properties_child2_impl_; 3677 size_t expected_push_properties_child2_impl_;
3736 size_t expected_push_properties_grandchild_impl_; 3678 size_t expected_push_properties_grandchild_impl_;
3737 size_t expected_push_properties_grandchild2_impl_; 3679 size_t expected_push_properties_grandchild2_impl_;
3738 }; 3680 };
3739 3681
3740 // In single thread there's no pending tree to push properties from. 3682 // No remote test because LTH remote does not build property trees, so layers
3683 // to push properties are different between engine and client.
3684 // See crbug/655795.
3741 MULTI_THREAD_TEST_F(LayerTreeHostTestImplLayersPushProperties); 3685 MULTI_THREAD_TEST_F(LayerTreeHostTestImplLayersPushProperties);
3742 3686
3743 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed 3687 class LayerTreeHostTestPropertyChangesDuringUpdateArePushed
3744 : public LayerTreeHostTest { 3688 : public LayerTreeHostTest {
3745 protected: 3689 protected:
3746 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3690 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3747 3691
3748 void SetupTree() override { 3692 void SetupTree() override {
3749 root_ = Layer::Create(); 3693 root_ = Layer::Create();
3750 root_->SetBounds(gfx::Size(1, 1)); 3694 root_->SetBounds(gfx::Size(1, 1));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3788 break; 3732 break;
3789 } 3733 }
3790 } 3734 }
3791 3735
3792 void AfterTest() override {} 3736 void AfterTest() override {}
3793 3737
3794 scoped_refptr<Layer> root_; 3738 scoped_refptr<Layer> root_;
3795 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_; 3739 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer_;
3796 }; 3740 };
3797 3741
3742 // No remote test since remote LTH does not support PaintedScrollbarLayer.
3798 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed); 3743 MULTI_THREAD_TEST_F(LayerTreeHostTestPropertyChangesDuringUpdateArePushed);
3799 3744
3800 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest { 3745 class LayerTreeHostTestSetDrawableCausesCommit : public LayerTreeHostTest {
3801 protected: 3746 protected:
3802 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 3747 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
3803 3748
3804 void SetupTree() override { 3749 void SetupTree() override {
3805 root_ = PushPropertiesCountingLayer::Create(); 3750 root_ = PushPropertiesCountingLayer::Create();
3806 child_ = PushPropertiesCountingLayer::Create(); 3751 child_ = PushPropertiesCountingLayer::Create();
3807 root_->AddChild(child_); 3752 root_->AddChild(child_);
(...skipping 11 matching lines...) Expand all
3819 // avoid causing a second commit to be scheduled. If a property change 3764 // avoid causing a second commit to be scheduled. If a property change
3820 // is made during this, however, it needs to be pushed in the upcoming 3765 // is made during this, however, it needs to be pushed in the upcoming
3821 // commit. 3766 // commit.
3822 EXPECT_FALSE( 3767 EXPECT_FALSE(
3823 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); 3768 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get()));
3824 EXPECT_FALSE( 3769 EXPECT_FALSE(
3825 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); 3770 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get()));
3826 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); 3771 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent());
3827 root_->reset_push_properties_count(); 3772 root_->reset_push_properties_count();
3828 child_->reset_push_properties_count(); 3773 child_->reset_push_properties_count();
3829 child_->SetDrawsContent(true); 3774 child_->SetIsDrawable(true);
3830 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); 3775 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent());
3831 EXPECT_EQ(0u, root_->push_properties_count()); 3776 EXPECT_EQ(0u, root_->push_properties_count());
3832 EXPECT_EQ(0u, child_->push_properties_count()); 3777 EXPECT_EQ(0u, child_->push_properties_count());
3833 EXPECT_TRUE( 3778 EXPECT_TRUE(
3834 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); 3779 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get()));
3835 EXPECT_TRUE( 3780 EXPECT_TRUE(
3836 3781
3837 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); 3782 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get()));
3838 break; 3783 break;
3839 } 3784 }
3840 case 2: 3785 case 2:
3841 EXPECT_EQ(1u, root_->push_properties_count()); 3786 EXPECT_EQ(1u, root_->push_properties_count());
3842 EXPECT_EQ(1u, child_->push_properties_count()); 3787 EXPECT_EQ(1u, child_->push_properties_count());
3843 EXPECT_FALSE( 3788 EXPECT_FALSE(
3844 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); 3789 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get()));
3845 EXPECT_FALSE( 3790 EXPECT_FALSE(
3846 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); 3791 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get()));
3847 EndTest(); 3792 EndTest();
3848 break; 3793 break;
3849 } 3794 }
3850 } 3795 }
3851 3796
3852 void AfterTest() override {} 3797 void AfterTest() override {}
3853 3798
3854 scoped_refptr<PushPropertiesCountingLayer> root_; 3799 scoped_refptr<PushPropertiesCountingLayer> root_;
3855 scoped_refptr<PushPropertiesCountingLayer> child_; 3800 scoped_refptr<PushPropertiesCountingLayer> child_;
3856 }; 3801 };
3857 3802
3858 MULTI_THREAD_TEST_F(LayerTreeHostTestSetDrawableCausesCommit); 3803 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSetDrawableCausesCommit);
3859 3804
3860 class LayerTreeHostTestCasePushPropertiesThreeGrandChildren 3805 class LayerTreeHostTestCasePushPropertiesThreeGrandChildren
3861 : public LayerTreeHostTest { 3806 : public LayerTreeHostTest {
3862 protected: 3807 protected:
3863 void BeginTest() override { 3808 void BeginTest() override {
3864 expected_push_properties_root_ = 0; 3809 expected_push_properties_root_ = 0;
3865 expected_push_properties_child_ = 0; 3810 expected_push_properties_child_ = 0;
3866 expected_push_properties_grandchild1_ = 0; 3811 expected_push_properties_grandchild1_ = 0;
3867 expected_push_properties_grandchild2_ = 0; 3812 expected_push_properties_grandchild2_ = 0;
3868 expected_push_properties_grandchild3_ = 0; 3813 expected_push_properties_grandchild3_ = 0;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3921 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting( 3866 EXPECT_TRUE(layer_tree()->LayerNeedsPushPropertiesForTesting(
3922 grandchild3_.get())); 3867 grandchild3_.get()));
3923 break; 3868 break;
3924 case 1: 3869 case 1:
3925 EndTest(); 3870 EndTest();
3926 break; 3871 break;
3927 } 3872 }
3928 } 3873 }
3929 }; 3874 };
3930 3875
3931 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); 3876 REMOTE_AND_MULTI_THREAD_TEST_F(
3877 LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush);
3932 3878
3933 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion 3879 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
3934 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3880 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
3935 protected: 3881 protected:
3936 void DidCommitAndDrawFrame() override { 3882 void DidCommitAndDrawFrame() override {
3937 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; 3883 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1;
3938 switch (last_source_frame_number) { 3884 switch (last_source_frame_number) {
3939 case 0: 3885 case 0:
3940 layer_tree()->SetRootLayer(root_); 3886 layer_tree()->SetRootLayer(root_);
3941 break; 3887 break;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
4004 EXPECT_FALSE( 3950 EXPECT_FALSE(
4005 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get())); 3951 layer_tree()->LayerNeedsPushPropertiesForTesting(root_.get()));
4006 EXPECT_FALSE( 3952 EXPECT_FALSE(
4007 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get())); 3953 layer_tree()->LayerNeedsPushPropertiesForTesting(child_.get()));
4008 EndTest(); 3954 EndTest();
4009 break; 3955 break;
4010 } 3956 }
4011 } 3957 }
4012 }; 3958 };
4013 3959
4014 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); 3960 REMOTE_AND_MULTI_THREAD_TEST_F(
3961 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion);
4015 3962
4016 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence 3963 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence
4017 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 3964 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
4018 protected: 3965 protected:
4019 void DidCommitAndDrawFrame() override { 3966 void DidCommitAndDrawFrame() override {
4020 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); 3967 LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
4021 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; 3968 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1;
4022 switch (last_source_frame_number) { 3969 switch (last_source_frame_number) {
4023 case 0: 3970 case 0:
4024 layer_tree->SetRootLayer(root_); 3971 layer_tree->SetRootLayer(root_);
(...skipping 27 matching lines...) Expand all
4052 EXPECT_FALSE( 3999 EXPECT_FALSE(
4053 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); 4000 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
4054 EXPECT_FALSE( 4001 EXPECT_FALSE(
4055 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); 4002 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
4056 EndTest(); 4003 EndTest();
4057 break; 4004 break;
4058 } 4005 }
4059 } 4006 }
4060 }; 4007 };
4061 4008
4062 MULTI_THREAD_TEST_F( 4009 REMOTE_AND_MULTI_THREAD_TEST_F(
4063 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); 4010 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence);
4064 4011
4065 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree 4012 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
4066 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 4013 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
4067 protected: 4014 protected:
4068 void DidCommitAndDrawFrame() override { 4015 void DidCommitAndDrawFrame() override {
4069 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); 4016 LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
4070 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; 4017 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1;
4071 switch (last_source_frame_number) { 4018 switch (last_source_frame_number) {
4072 case 0: 4019 case 0:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4121 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); 4068 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
4122 EXPECT_TRUE( 4069 EXPECT_TRUE(
4123 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); 4070 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get()));
4124 4071
4125 EndTest(); 4072 EndTest();
4126 break; 4073 break;
4127 } 4074 }
4128 } 4075 }
4129 }; 4076 };
4130 4077
4131 MULTI_THREAD_TEST_F( 4078 REMOTE_AND_MULTI_THREAD_TEST_F(
4132 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); 4079 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree);
4133 4080
4134 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild 4081 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild
4135 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 4082 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
4136 protected: 4083 protected:
4137 void DidCommitAndDrawFrame() override { 4084 void DidCommitAndDrawFrame() override {
4138 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); 4085 LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
4139 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; 4086 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1;
4140 switch (last_source_frame_number) { 4087 switch (last_source_frame_number) {
4141 case 0: 4088 case 0:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4186 4133
4187 EXPECT_FALSE( 4134 EXPECT_FALSE(
4188 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); 4135 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
4189 4136
4190 EndTest(); 4137 EndTest();
4191 break; 4138 break;
4192 } 4139 }
4193 } 4140 }
4194 }; 4141 };
4195 4142
4196 MULTI_THREAD_TEST_F( 4143 REMOTE_AND_MULTI_THREAD_TEST_F(
4197 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); 4144 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild);
4198 4145
4199 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent 4146 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent
4200 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { 4147 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren {
4201 protected: 4148 protected:
4202 void DidCommitAndDrawFrame() override { 4149 void DidCommitAndDrawFrame() override {
4203 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); 4150 LayerTree* layer_tree = layer_tree_host()->GetLayerTree();
4204 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1; 4151 int last_source_frame_number = layer_tree_host()->SourceFrameNumber() - 1;
4205 switch (last_source_frame_number) { 4152 switch (last_source_frame_number) {
4206 case 0: 4153 case 0:
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4251 4198
4252 EXPECT_FALSE( 4199 EXPECT_FALSE(
4253 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); 4200 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get()));
4254 4201
4255 EndTest(); 4202 EndTest();
4256 break; 4203 break;
4257 } 4204 }
4258 } 4205 }
4259 }; 4206 };
4260 4207
4261 MULTI_THREAD_TEST_F( 4208 REMOTE_AND_MULTI_THREAD_TEST_F(
4262 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); 4209 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent);
4263 4210
4264 // This test verifies that the tree activation callback is invoked correctly. 4211 // This test verifies that the tree activation callback is invoked correctly.
4265 class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest { 4212 class LayerTreeHostTestTreeActivationCallback : public LayerTreeHostTest {
4266 public: 4213 public:
4267 LayerTreeHostTestTreeActivationCallback() 4214 LayerTreeHostTestTreeActivationCallback()
4268 : num_commits_(0), callback_count_(0) {} 4215 : num_commits_(0), callback_count_(0) {}
4269 4216
4270 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4217 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4271 4218
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 base::Unretained(this)) 4257 base::Unretained(this))
4311 : base::Closure()); 4258 : base::Closure());
4312 } 4259 }
4313 4260
4314 void ActivationCallback() { ++callback_count_; } 4261 void ActivationCallback() { ++callback_count_; }
4315 4262
4316 int num_commits_; 4263 int num_commits_;
4317 int callback_count_; 4264 int callback_count_;
4318 }; 4265 };
4319 4266
4320 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestTreeActivationCallback); 4267 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestTreeActivationCallback);
4321 4268
4322 class LayerInvalidateCausesDraw : public LayerTreeHostTest { 4269 class LayerInvalidateCausesDraw : public LayerTreeHostTest {
4323 public: 4270 public:
4324 LayerInvalidateCausesDraw() : num_commits_(0), num_draws_(0) {} 4271 LayerInvalidateCausesDraw() : num_commits_(0), num_draws_(0) {}
4325 4272
4326 void BeginTest() override { 4273 void BeginTest() override {
4327 ASSERT_TRUE(invalidate_layer_) 4274 ASSERT_TRUE(invalidate_layer_)
4328 << "Derived tests must set this in SetupTree"; 4275 << "Derived tests must set this in SetupTree";
4329 4276
4330 // One initial commit. 4277 // One initial commit.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 video_layer->SetIsDrawable(true); 4320 video_layer->SetIsDrawable(true);
4374 layer_tree()->root_layer()->AddChild(video_layer); 4321 layer_tree()->root_layer()->AddChild(video_layer);
4375 4322
4376 invalidate_layer_ = video_layer; 4323 invalidate_layer_ = video_layer;
4377 } 4324 }
4378 4325
4379 private: 4326 private:
4380 FakeVideoFrameProvider provider_; 4327 FakeVideoFrameProvider provider_;
4381 }; 4328 };
4382 4329
4330 // LTH remote does not support VideoLayer.
4383 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate); 4331 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestVideoLayerInvalidate);
4384 4332
4385 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest { 4333 class LayerTreeHostTestPushHiddenLayer : public LayerTreeHostTest {
4386 protected: 4334 protected:
4387 void SetupTree() override { 4335 void SetupTree() override {
4388 root_layer_ = Layer::Create(); 4336 root_layer_ = Layer::Create();
4389 root_layer_->SetPosition(gfx::PointF()); 4337 root_layer_->SetPosition(gfx::PointF());
4390 root_layer_->SetBounds(gfx::Size(10, 10)); 4338 root_layer_->SetBounds(gfx::Size(10, 10));
4391 4339
4392 parent_layer_ = SolidColorLayer::Create(); 4340 parent_layer_ = SolidColorLayer::Create();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4440 } 4388 }
4441 } 4389 }
4442 4390
4443 void AfterTest() override {} 4391 void AfterTest() override {}
4444 4392
4445 scoped_refptr<Layer> root_layer_; 4393 scoped_refptr<Layer> root_layer_;
4446 scoped_refptr<SolidColorLayer> parent_layer_; 4394 scoped_refptr<SolidColorLayer> parent_layer_;
4447 scoped_refptr<SolidColorLayer> child_layer_; 4395 scoped_refptr<SolidColorLayer> child_layer_;
4448 }; 4396 };
4449 4397
4450 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushHiddenLayer); 4398 SINGLE_MULTI_AND_REMOTE_TEST_F(LayerTreeHostTestPushHiddenLayer);
4451 4399
4452 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest { 4400 class LayerTreeHostTestUpdateLayerInEmptyViewport : public LayerTreeHostTest {
4453 protected: 4401 protected:
4454 void SetupTree() override { 4402 void SetupTree() override {
4455 root_layer_ = FakePictureLayer::Create(&client_); 4403 root_layer_ = FakePictureLayer::Create(&client_);
4456 root_layer_->SetBounds(gfx::Size(10, 10)); 4404 root_layer_->SetBounds(gfx::Size(10, 10));
4457 4405
4458 layer_tree()->SetRootLayer(root_layer_); 4406 layer_tree()->SetRootLayer(root_layer_);
4459 LayerTreeHostTest::SetupTree(); 4407 LayerTreeHostTest::SetupTree();
4460 client_.set_bounds(root_layer_->bounds()); 4408 client_.set_bounds(root_layer_->bounds());
(...skipping 12 matching lines...) Expand all
4473 EXPECT_GT(root_layer_->update_count(), 0); 4421 EXPECT_GT(root_layer_->update_count(), 0);
4474 EndTest(); 4422 EndTest();
4475 } 4423 }
4476 4424
4477 void AfterTest() override {} 4425 void AfterTest() override {}
4478 4426
4479 FakeContentLayerClient client_; 4427 FakeContentLayerClient client_;
4480 scoped_refptr<FakePictureLayer> root_layer_; 4428 scoped_refptr<FakePictureLayer> root_layer_;
4481 }; 4429 };
4482 4430
4483 MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport); 4431 REMOTE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestUpdateLayerInEmptyViewport);
4484 4432
4485 class LayerTreeHostTestElasticOverscroll : public LayerTreeHostTest { 4433 class LayerTreeHostTestElasticOverscroll : public LayerTreeHostTest {
4486 public: 4434 public:
4487 LayerTreeHostTestElasticOverscroll() 4435 LayerTreeHostTestElasticOverscroll()
4488 : scroll_elasticity_helper_(nullptr), num_draws_(0) {} 4436 : scroll_elasticity_helper_(nullptr), num_draws_(0) {}
4489 4437
4490 void InitializeSettings(LayerTreeSettings* settings) override { 4438 void InitializeSettings(LayerTreeSettings* settings) override {
4491 settings->enable_elastic_overscroll = true; 4439 settings->enable_elastic_overscroll = true;
4492 } 4440 }
4493 4441
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
4568 void AfterTest() override {} 4516 void AfterTest() override {}
4569 4517
4570 private: 4518 private:
4571 FakeContentLayerClient client_; 4519 FakeContentLayerClient client_;
4572 scoped_refptr<Layer> root_layer_; 4520 scoped_refptr<Layer> root_layer_;
4573 ScrollElasticityHelper* scroll_elasticity_helper_; 4521 ScrollElasticityHelper* scroll_elasticity_helper_;
4574 int content_layer_id_; 4522 int content_layer_id_;
4575 int num_draws_; 4523 int num_draws_;
4576 }; 4524 };
4577 4525
4526 // Remote test does not support enable_elastic_overscroll.
4578 MULTI_THREAD_TEST_F(LayerTreeHostTestElasticOverscroll); 4527 MULTI_THREAD_TEST_F(LayerTreeHostTestElasticOverscroll);
4579 4528
4580 struct TestSwapPromiseResult { 4529 struct TestSwapPromiseResult {
4581 TestSwapPromiseResult() 4530 TestSwapPromiseResult()
4582 : did_activate_called(false), 4531 : did_activate_called(false),
4583 did_swap_called(false), 4532 did_swap_called(false),
4584 did_not_swap_called(false), 4533 did_not_swap_called(false),
4585 dtor_called(false), 4534 dtor_called(false),
4586 reason(SwapPromise::COMMIT_FAILS) {} 4535 reason(SwapPromise::COMMIT_FAILS) {}
4587 4536
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
4672 // The pinned active swap promise should not activate, but should swap. 4621 // The pinned active swap promise should not activate, but should swap.
4673 EXPECT_FALSE(pinned_active_swap_promise_result_.did_activate_called); 4622 EXPECT_FALSE(pinned_active_swap_promise_result_.did_activate_called);
4674 EXPECT_TRUE(pinned_active_swap_promise_result_.did_swap_called); 4623 EXPECT_TRUE(pinned_active_swap_promise_result_.did_swap_called);
4675 } 4624 }
4676 4625
4677 TestSwapPromiseResult pending_swap_promise_result_; 4626 TestSwapPromiseResult pending_swap_promise_result_;
4678 TestSwapPromiseResult active_swap_promise_result_; 4627 TestSwapPromiseResult active_swap_promise_result_;
4679 TestSwapPromiseResult pinned_active_swap_promise_result_; 4628 TestSwapPromiseResult pinned_active_swap_promise_result_;
4680 }; 4629 };
4681 4630
4631 // No remote test because this test compares the swap promises result between
4632 // LTH in process and LTH impl. LTH remote runs its own swap promise, and we
4633 // don't send swap promises to the client.
4682 MULTI_THREAD_TEST_F(PinnedLayerTreeSwapPromise); 4634 MULTI_THREAD_TEST_F(PinnedLayerTreeSwapPromise);
4683 4635
4684 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest { 4636 class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest {
4685 protected: 4637 protected:
4686 LayerTreeHostTestBreakSwapPromise() 4638 LayerTreeHostTestBreakSwapPromise()
4687 : commit_count_(0), commit_complete_count_(0) {} 4639 : commit_count_(0), commit_complete_count_(0) {}
4688 4640
4689 void WillBeginMainFrame() override { 4641 void WillBeginMainFrame() override {
4690 ASSERT_LE(commit_count_, 2); 4642 ASSERT_LE(commit_count_, 2);
4691 std::unique_ptr<SwapPromise> swap_promise( 4643 std::unique_ptr<SwapPromise> swap_promise(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
4769 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason); 4721 EXPECT_EQ(SwapPromise::SWAP_FAILS, swap_promise_result_[2].reason);
4770 EXPECT_TRUE(swap_promise_result_[2].dtor_called); 4722 EXPECT_TRUE(swap_promise_result_[2].dtor_called);
4771 } 4723 }
4772 } 4724 }
4773 4725
4774 int commit_count_; 4726 int commit_count_;
4775 int commit_complete_count_; 4727 int commit_complete_count_;
4776 TestSwapPromiseResult swap_promise_result_[3]; 4728 TestSwapPromiseResult swap_promise_result_[3];
4777 }; 4729 };
4778 4730
4731 // No remote test because LTH remote runs its own swap promises, and we
4732 // don't send swap promises to the LTH in process on the client side.
4779 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise); 4733 MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
4780 4734
4781 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest { 4735 class LayerTreeHostTestKeepSwapPromise : public LayerTreeHostTest {
4782 public: 4736 public:
4783 LayerTreeHostTestKeepSwapPromise() {} 4737 LayerTreeHostTestKeepSwapPromise() {}
4784 4738
4785 void BeginTest() override { 4739 void BeginTest() override {
4786 layer_ = SolidColorLayer::Create(); 4740 layer_ = SolidColorLayer::Create();
4787 layer_->SetIsDrawable(true); 4741 layer_->SetIsDrawable(true);
4788 layer_->SetBounds(gfx::Size(10, 10)); 4742 layer_->SetBounds(gfx::Size(10, 10));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
4860 } 4814 }
4861 4815
4862 void AfterTest() override {} 4816 void AfterTest() override {}
4863 4817
4864 private: 4818 private:
4865 int num_swaps_ = 0; 4819 int num_swaps_ = 0;
4866 scoped_refptr<Layer> layer_; 4820 scoped_refptr<Layer> layer_;
4867 TestSwapPromiseResult swap_promise_result_; 4821 TestSwapPromiseResult swap_promise_result_;
4868 }; 4822 };
4869 4823
4824 // No remote test because LTH remote runs its own swap promises, and we
4825 // don't send swap promises to the LTH in process on the client side.
4870 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromise); 4826 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromise);
4871 4827
4872 class LayerTreeHostTestKeepSwapPromiseMFBA : public LayerTreeHostTest { 4828 class LayerTreeHostTestKeepSwapPromiseMFBA : public LayerTreeHostTest {
4873 public: 4829 public:
4874 LayerTreeHostTestKeepSwapPromiseMFBA() {} 4830 LayerTreeHostTestKeepSwapPromiseMFBA() {}
4875 4831
4876 void InitializeSettings(LayerTreeSettings* settings) override { 4832 void InitializeSettings(LayerTreeSettings* settings) override {
4877 settings->main_frame_before_activation_enabled = true; 4833 settings->main_frame_before_activation_enabled = true;
4878 } 4834 }
4879 4835
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
4974 } 4930 }
4975 4931
4976 void AfterTest() override { EXPECT_EQ(1, num_swaps_); } 4932 void AfterTest() override { EXPECT_EQ(1, num_swaps_); }
4977 4933
4978 private: 4934 private:
4979 int num_swaps_ = 0; 4935 int num_swaps_ = 0;
4980 scoped_refptr<Layer> layer_; 4936 scoped_refptr<Layer> layer_;
4981 TestSwapPromiseResult swap_promise_result_; 4937 TestSwapPromiseResult swap_promise_result_;
4982 }; 4938 };
4983 4939
4940 // No remote test because LTH remote runs its own swap promises, and we
4941 // don't send swap promises to the LTH in process on the client side.
4984 MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromiseMFBA); 4942 MULTI_THREAD_TEST_F(LayerTreeHostTestKeepSwapPromiseMFBA);
4985 4943
4986 class LayerTreeHostTestBreakSwapPromiseForVisibility 4944 class LayerTreeHostTestBreakSwapPromiseForVisibility
4987 : public LayerTreeHostTest { 4945 : public LayerTreeHostTest {
4988 protected: 4946 protected:
4989 void BeginTest() override { PostSetNeedsCommitToMainThread(); } 4947 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
4990 4948
4991 void SetVisibleFalseAndQueueSwapPromise() { 4949 void SetVisibleFalseAndQueueSwapPromise() {
4992 layer_tree_host()->SetVisible(false); 4950 layer_tree_host()->SetVisible(false);
4993 std::unique_ptr<SwapPromise> swap_promise( 4951 std::unique_ptr<SwapPromise> swap_promise(
(...skipping 22 matching lines...) Expand all
5016 EXPECT_FALSE(swap_promise_result_.did_swap_called); 4974 EXPECT_FALSE(swap_promise_result_.did_swap_called);
5017 EXPECT_TRUE(swap_promise_result_.did_not_swap_called); 4975 EXPECT_TRUE(swap_promise_result_.did_not_swap_called);
5018 EXPECT_EQ(SwapPromise::COMMIT_FAILS, swap_promise_result_.reason); 4976 EXPECT_EQ(SwapPromise::COMMIT_FAILS, swap_promise_result_.reason);
5019 EXPECT_TRUE(swap_promise_result_.dtor_called); 4977 EXPECT_TRUE(swap_promise_result_.dtor_called);
5020 } 4978 }
5021 } 4979 }
5022 4980
5023 TestSwapPromiseResult swap_promise_result_; 4981 TestSwapPromiseResult swap_promise_result_;
5024 }; 4982 };
5025 4983
4984 // No remote test because LTH remote runs its own swap promises, and we
4985 // don't send swap promises to the LTH in process on the client side.
5026 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForVisibility); 4986 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForVisibility);
5027 4987
5028 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor { 4988 class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
5029 public: 4989 public:
5030 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host, 4990 SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,
5031 LayerTreeHostImpl* layer_tree_host_impl, 4991 LayerTreeHostImpl* layer_tree_host_impl,
5032 int* set_needs_commit_count, 4992 int* set_needs_commit_count,
5033 int* set_needs_redraw_count) 4993 int* set_needs_redraw_count)
5034 : SwapPromiseMonitor( 4994 : SwapPromiseMonitor(
5035 (layer_tree_host ? layer_tree_host->GetSwapPromiseManager() 4995 (layer_tree_host ? layer_tree_host->GetSwapPromiseManager()
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
5099 EXPECT_EQ(3, set_needs_commit_count); 5059 EXPECT_EQ(3, set_needs_commit_count);
5100 EXPECT_EQ(0, set_needs_redraw_count); 5060 EXPECT_EQ(0, set_needs_redraw_count);
5101 } 5061 }
5102 5062
5103 EndTest(); 5063 EndTest();
5104 } 5064 }
5105 5065
5106 void AfterTest() override {} 5066 void AfterTest() override {}
5107 }; 5067 };
5108 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.
5109 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor); 5071 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor);
5110 5072
5111 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources 5073 class LayerTreeHostTestHighResRequiredAfterEvictingUIResources
5112 : public LayerTreeHostTest { 5074 : public LayerTreeHostTest {
5113 protected: 5075 protected:
5114 void SetupTree() override { 5076 void SetupTree() override {
5115 LayerTreeHostTest::SetupTree(); 5077 LayerTreeHostTest::SetupTree();
5116 ui_resource_ = 5078 ui_resource_ =
5117 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager()); 5079 FakeScopedUIResource::Create(layer_tree_host()->GetUIResourceManager());
5118 client_.set_bounds(layer_tree()->root_layer()->bounds()); 5080 client_.set_bounds(layer_tree()->root_layer()->bounds());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
5320 EndTest(); 5282 EndTest();
5321 } 5283 }
5322 5284
5323 void AfterTest() override {} 5285 void AfterTest() override {}
5324 5286
5325 FakeContentLayerClient layer_client_; 5287 FakeContentLayerClient layer_client_;
5326 FakePictureLayer* layer_; 5288 FakePictureLayer* layer_;
5327 FakeRecordingSource* recording_source_; 5289 FakeRecordingSource* recording_source_;
5328 }; 5290 };
5329 5291
5292 // No remote test since we does not send gpu rasterization flag to the client.
5293 // See crbug/650431.
5330 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled); 5294 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterizationEnabled);
5331 5295
5332 class LayerTreeHostTestGpuRasterizationReenabled : public LayerTreeHostTest { 5296 class LayerTreeHostTestGpuRasterizationReenabled : public LayerTreeHostTest {
5333 protected: 5297 protected:
5334 void InitializeSettings(LayerTreeSettings* settings) override { 5298 void InitializeSettings(LayerTreeSettings* settings) override {
5335 EXPECT_FALSE(settings->gpu_rasterization_enabled); 5299 EXPECT_FALSE(settings->gpu_rasterization_enabled);
5336 settings->gpu_rasterization_enabled = true; 5300 settings->gpu_rasterization_enabled = true;
5337 } 5301 }
5338 5302
5339 void SetupTree() override { 5303 void SetupTree() override {
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after
7030 EndTest(); 6994 EndTest();
7031 } 6995 }
7032 6996
7033 void AfterTest() override {} 6997 void AfterTest() override {}
7034 }; 6998 };
7035 6999
7036 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7000 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7037 7001
7038 } // namespace 7002 } // namespace
7039 } // namespace cc 7003 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/remote_client_layer_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698