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

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

Issue 2376623004: cc : Enable LayerTreeHostTestGpuRasterDeviceSizeChanged test (Closed)
Patch Set: comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | 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 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 1585
1586 PostSetNeedsCommitToMainThread(); 1586 PostSetNeedsCommitToMainThread();
1587 client_.set_bounds(root_layer_->bounds()); 1587 client_.set_bounds(root_layer_->bounds());
1588 } 1588 }
1589 1589
1590 void InitializeSettings(LayerTreeSettings* settings) override { 1590 void InitializeSettings(LayerTreeSettings* settings) override {
1591 settings->gpu_rasterization_enabled = true; 1591 settings->gpu_rasterization_enabled = true;
1592 settings->gpu_rasterization_forced = true; 1592 settings->gpu_rasterization_forced = true;
1593 } 1593 }
1594 1594
1595 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
1596 if (num_draws_ < 2) {
1597 PostSetNeedsRedrawRectToMainThread(invalid_rect_);
1598 num_draws_++;
1599 }
1600 }
1601
1602 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 1595 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
1603 if (num_draws_ == 2) { 1596 if (num_draws_ == 2) {
1604 auto* pending_tree = host_impl->pending_tree(); 1597 auto* pending_tree = host_impl->pending_tree();
1605 auto* pending_layer_impl = static_cast<FakePictureLayerImpl*>( 1598 auto* pending_layer_impl = static_cast<FakePictureLayerImpl*>(
1606 pending_tree->root_layer_for_testing()); 1599 pending_tree->root_layer_for_testing());
1607 EXPECT_NE(pending_layer_impl, nullptr); 1600 EXPECT_NE(pending_layer_impl, nullptr);
1608 1601
1609 auto* active_tree = host_impl->pending_tree(); 1602 auto* active_tree = host_impl->pending_tree();
1610 auto* active_layer_impl = static_cast<FakePictureLayerImpl*>( 1603 auto* active_layer_impl = static_cast<FakePictureLayerImpl*>(
1611 active_tree->root_layer_for_testing()); 1604 active_tree->root_layer_for_testing());
1612 EXPECT_NE(pending_layer_impl, nullptr); 1605 EXPECT_NE(pending_layer_impl, nullptr);
1613 1606
1614 auto* active_tiling_set = active_layer_impl->picture_layer_tiling_set(); 1607 auto* active_tiling_set = active_layer_impl->picture_layer_tiling_set();
1615 auto* active_tiling = active_tiling_set->tiling_at(0); 1608 auto* active_tiling = active_tiling_set->tiling_at(0);
1616 auto* pending_tiling_set = pending_layer_impl->picture_layer_tiling_set(); 1609 auto* pending_tiling_set = pending_layer_impl->picture_layer_tiling_set();
1617 auto* pending_tiling = pending_tiling_set->tiling_at(0); 1610 auto* pending_tiling = pending_tiling_set->tiling_at(0);
1618 EXPECT_EQ( 1611 EXPECT_EQ(
1619 pending_tiling->TilingDataForTesting().max_texture_size().width(), 1612 pending_tiling->TilingDataForTesting().max_texture_size().width(),
1620 active_tiling->TilingDataForTesting().max_texture_size().width()); 1613 active_tiling->TilingDataForTesting().max_texture_size().width());
1621 EndTest();
1622 } 1614 }
1623 } 1615 }
1624 1616
1625 void DidCommitAndDrawFrame() override { 1617 void DidCommitAndDrawFrame() override {
1626 // On the second commit, resize the viewport. 1618 // On the second commit, resize the viewport.
1627 if (num_draws_ == 1) { 1619 if (num_draws_ == 1) {
1628 layer_tree()->SetViewportSize(gfx::Size(400, 64)); 1620 layer_tree()->SetViewportSize(gfx::Size(400, 64));
1629 } 1621 }
1622 if (num_draws_ < 2) {
1623 layer_tree_host()->SetNeedsRedrawRect(invalid_rect_);
1624 layer_tree_host()->SetNeedsCommit();
1625 num_draws_++;
1626 } else {
1627 EndTest();
1628 }
1630 } 1629 }
1631 1630
1632 void AfterTest() override {} 1631 void AfterTest() override {}
1633 1632
1634 private: 1633 private:
1635 int num_draws_; 1634 int num_draws_;
1636 const gfx::Size bounds_; 1635 const gfx::Size bounds_;
1637 const gfx::Rect invalid_rect_; 1636 const gfx::Rect invalid_rect_;
1638 FakeContentLayerClient client_; 1637 FakeContentLayerClient client_;
1639 scoped_refptr<FakePictureLayer> root_layer_; 1638 scoped_refptr<FakePictureLayer> root_layer_;
1640 }; 1639 };
1641 1640
1642 // As there's no pending tree in single-threaded case, this test should run 1641 // As there's no pending tree in single-threaded case, this test should run
1643 // only for multi-threaded case. 1642 // only for multi-threaded case.
1644 // Disabled because its timing out flakily. crbug.com/598491 1643 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged);
1645 // MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged);
1646 1644
1647 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { 1645 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
1648 public: 1646 public:
1649 void InitializeSettings(LayerTreeSettings* settings) override { 1647 void InitializeSettings(LayerTreeSettings* settings) override {
1650 settings->layer_transforms_should_scale_layer_contents = true; 1648 settings->layer_transforms_should_scale_layer_contents = true;
1651 } 1649 }
1652 1650
1653 void SetupTree() override { 1651 void SetupTree() override {
1654 root_layer_ = Layer::Create(); 1652 root_layer_ = Layer::Create();
1655 root_layer_->SetBounds(gfx::Size(10, 20)); 1653 root_layer_->SetBounds(gfx::Size(10, 20));
(...skipping 5598 matching lines...) Expand 10 before | Expand all | Expand 10 after
7254 EndTest(); 7252 EndTest();
7255 } 7253 }
7256 7254
7257 void AfterTest() override {} 7255 void AfterTest() override {}
7258 }; 7256 };
7259 7257
7260 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7258 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7261 7259
7262 } // namespace 7260 } // namespace
7263 } // namespace cc 7261 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698