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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 1135833002: cc: Ensure pending tree needs prop updates when active tree scrolls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 5 years, 7 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 | « cc/layers/layer_impl.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 4903 matching lines...) Expand 10 before | Expand all | Expand 10 after
4914 4914
4915 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, gfx::Rect()); 4915 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, gfx::Rect());
4916 4916
4917 EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles()); 4917 EXPECT_FALSE(pending_layer_->HighResTiling()->has_tiles());
4918 EXPECT_FALSE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty()); 4918 EXPECT_FALSE(pending_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
4919 ActivateTree(); 4919 ActivateTree();
4920 EXPECT_TRUE(active_layer_->HighResTiling()->has_tiles()); 4920 EXPECT_TRUE(active_layer_->HighResTiling()->has_tiles());
4921 EXPECT_FALSE(active_layer_->HighResTiling()->live_tiles_rect().IsEmpty()); 4921 EXPECT_FALSE(active_layer_->HighResTiling()->live_tiles_rect().IsEmpty());
4922 } 4922 }
4923 4923
4924 TEST_F(PictureLayerImplTest, ScrollPropagatesToPending) {
4925 base::TimeTicks time_ticks;
4926 time_ticks += base::TimeDelta::FromMilliseconds(1);
4927 host_impl_.SetCurrentBeginFrameArgs(
4928 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
4929
4930 gfx::Size tile_size(102, 102);
4931 gfx::Size layer_bounds(1000, 1000);
4932 gfx::Size viewport_size(100, 100);
4933
4934 host_impl_.SetViewportSize(viewport_size);
4935 host_impl_.SetDeviceScaleFactor(1.f);
4936
4937 scoped_refptr<FakePicturePileImpl> pending_pile =
4938 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4939 scoped_refptr<FakePicturePileImpl> active_pile =
4940 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
4941
4942 SetupTrees(pending_pile, active_pile);
4943
4944 active_layer_->SetCurrentScrollOffset(gfx::ScrollOffset(0.0, 50.0));
4945 host_impl_.active_tree()->UpdateDrawProperties(false);
4946 EXPECT_EQ("0,50 100x100", active_layer_->HighResTiling()
4947 ->GetCurrentVisibleRectForTesting()
4948 .ToString());
4949
4950 EXPECT_EQ("0,0 100x100", pending_layer_->HighResTiling()
4951 ->GetCurrentVisibleRectForTesting()
4952 .ToString());
4953 host_impl_.pending_tree()->UpdateDrawProperties(false);
4954 EXPECT_EQ("0,50 100x100", pending_layer_->HighResTiling()
vmpstr 2015/05/11 18:36:15 This part fails without the patch, and passes with
4955 ->GetCurrentVisibleRectForTesting()
4956 .ToString());
4957 }
4958
4924 TEST_F(PictureLayerImplTest, UpdateLCDInvalidatesPendingTree) { 4959 TEST_F(PictureLayerImplTest, UpdateLCDInvalidatesPendingTree) {
4925 base::TimeTicks time_ticks; 4960 base::TimeTicks time_ticks;
4926 time_ticks += base::TimeDelta::FromMilliseconds(1); 4961 time_ticks += base::TimeDelta::FromMilliseconds(1);
4927 host_impl_.SetCurrentBeginFrameArgs( 4962 host_impl_.SetCurrentBeginFrameArgs(
4928 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); 4963 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks));
4929 4964
4930 gfx::Size tile_size(102, 102); 4965 gfx::Size tile_size(102, 102);
4931 gfx::Size layer_bounds(100, 100); 4966 gfx::Size layer_bounds(100, 100);
4932 gfx::Size viewport_size(100, 100); 4967 gfx::Size viewport_size(100, 100);
4933 4968
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
5025 result = layer->CalculateTileSize(gfx::Size(447, 400)); 5060 result = layer->CalculateTileSize(gfx::Size(447, 400));
5026 EXPECT_EQ(result.width(), 448); 5061 EXPECT_EQ(result.width(), 448);
5027 EXPECT_EQ(result.height(), 448); 5062 EXPECT_EQ(result.height(), 448);
5028 result = layer->CalculateTileSize(gfx::Size(500, 499)); 5063 result = layer->CalculateTileSize(gfx::Size(500, 499));
5029 EXPECT_EQ(result.width(), 512); 5064 EXPECT_EQ(result.width(), 512);
5030 EXPECT_EQ(result.height(), 500 + 2); 5065 EXPECT_EQ(result.height(), 500 + 2);
5031 } 5066 }
5032 5067
5033 } // namespace 5068 } // namespace
5034 } // namespace cc 5069 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698