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

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

Issue 1827643002: Enable LayerTreeHostTestGpuRasterDeviceSizeChanged test on win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 PostSetNeedsCommitToMainThread(); 869 PostSetNeedsCommitToMainThread();
870 client_.set_bounds(root_layer_->bounds()); 870 client_.set_bounds(root_layer_->bounds());
871 } 871 }
872 872
873 void InitializeSettings(LayerTreeSettings* settings) override { 873 void InitializeSettings(LayerTreeSettings* settings) override {
874 settings->gpu_rasterization_enabled = true; 874 settings->gpu_rasterization_enabled = true;
875 settings->gpu_rasterization_forced = true; 875 settings->gpu_rasterization_forced = true;
876 } 876 }
877 877
878 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { 878 void DrawLayersOnThread(LayerTreeHostImpl* impl) override {
879 // Perform 2 commits. 879 PostSetNeedsRedrawRectToMainThread(invalid_rect_);
enne (OOO) 2016/03/22 22:36:42 Can you only do this if num_draws < 2? I would rat
880 if (!num_draws_) {
881 PostSetNeedsRedrawRectToMainThread(invalid_rect_);
882 } else {
883 EndTest();
884 }
885 num_draws_++; 880 num_draws_++;
886 } 881 }
887 882
888 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { 883 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
889 if (num_draws_ == 2) { 884 if (num_draws_ == 2) {
890 auto pending_tree = host_impl->pending_tree(); 885 auto pending_tree = host_impl->pending_tree();
891 auto pending_layer_impl = 886 auto pending_layer_impl =
892 static_cast<FakePictureLayerImpl*>(pending_tree->root_layer()); 887 static_cast<FakePictureLayerImpl*>(pending_tree->root_layer());
893 EXPECT_NE(pending_layer_impl, nullptr); 888 EXPECT_NE(pending_layer_impl, nullptr);
894 889
895 auto active_tree = host_impl->pending_tree(); 890 auto active_tree = host_impl->pending_tree();
896 auto active_layer_impl = 891 auto active_layer_impl =
897 static_cast<FakePictureLayerImpl*>(active_tree->root_layer()); 892 static_cast<FakePictureLayerImpl*>(active_tree->root_layer());
898 EXPECT_NE(pending_layer_impl, nullptr); 893 EXPECT_NE(pending_layer_impl, nullptr);
899 894
900 auto active_tiling_set = active_layer_impl->picture_layer_tiling_set(); 895 auto active_tiling_set = active_layer_impl->picture_layer_tiling_set();
901 auto active_tiling = active_tiling_set->tiling_at(0); 896 auto active_tiling = active_tiling_set->tiling_at(0);
902 auto pending_tiling_set = pending_layer_impl->picture_layer_tiling_set(); 897 auto pending_tiling_set = pending_layer_impl->picture_layer_tiling_set();
903 auto pending_tiling = pending_tiling_set->tiling_at(0); 898 auto pending_tiling = pending_tiling_set->tiling_at(0);
904 EXPECT_EQ( 899 EXPECT_EQ(
905 pending_tiling->TilingDataForTesting().max_texture_size().width(), 900 pending_tiling->TilingDataForTesting().max_texture_size().width(),
906 active_tiling->TilingDataForTesting().max_texture_size().width()); 901 active_tiling->TilingDataForTesting().max_texture_size().width());
902 EndTest();
907 } 903 }
908 } 904 }
909 905
910 void DidCommitAndDrawFrame() override { 906 void DidCommitAndDrawFrame() override {
911 // On the second commit, resize the viewport. 907 // On the second commit, resize the viewport.
912 if (num_draws_ == 1) { 908 if (num_draws_ == 1) {
913 layer_tree_host()->SetViewportSize(gfx::Size(400, 64)); 909 layer_tree_host()->SetViewportSize(gfx::Size(400, 64));
914 } 910 }
915 } 911 }
916 912
917 void AfterTest() override {} 913 void AfterTest() override {}
918 914
919 private: 915 private:
920 int num_draws_; 916 int num_draws_;
921 const gfx::Size bounds_; 917 const gfx::Size bounds_;
922 const gfx::Rect invalid_rect_; 918 const gfx::Rect invalid_rect_;
923 FakeContentLayerClient client_; 919 FakeContentLayerClient client_;
924 scoped_refptr<FakePictureLayer> root_layer_; 920 scoped_refptr<FakePictureLayer> root_layer_;
925 }; 921 };
926 922
927 #if !defined(OS_WIN) 923 // As there's no pending tree in single-threaded case, this test should run
928 // Flaky on win: http://crbug.com/596880 924 // only for multi-threaded case.
929 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged); 925 MULTI_THREAD_TEST_F(LayerTreeHostTestGpuRasterDeviceSizeChanged);
930 #endif
931 926
932 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest { 927 class LayerTreeHostTestNoExtraCommitFromInvalidate : public LayerTreeHostTest {
933 public: 928 public:
934 void InitializeSettings(LayerTreeSettings* settings) override { 929 void InitializeSettings(LayerTreeSettings* settings) override {
935 settings->layer_transforms_should_scale_layer_contents = true; 930 settings->layer_transforms_should_scale_layer_contents = true;
936 } 931 }
937 932
938 void SetupTree() override { 933 void SetupTree() override {
939 root_layer_ = Layer::Create(); 934 root_layer_ = Layer::Create();
940 root_layer_->SetBounds(gfx::Size(10, 20)); 935 root_layer_->SetBounds(gfx::Size(10, 20));
(...skipping 5714 matching lines...) Expand 10 before | Expand all | Expand 10 after
6655 EndTest(); 6650 EndTest();
6656 } 6651 }
6657 6652
6658 void AfterTest() override {} 6653 void AfterTest() override {}
6659 }; 6654 };
6660 6655
6661 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); 6656 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor);
6662 6657
6663 } // namespace 6658 } // namespace
6664 } // namespace cc 6659 } // 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