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

Side by Side Diff: cc/resources/picture_layer_tiling_unittest.cc

Issue 240593004: cc: Fix missing compositor invalidations during resize (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Avoid assertion on empty bounds Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/resources/picture_layer_tiling.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/resources/picture_layer_tiling.h" 5 #include "cc/resources/picture_layer_tiling.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 166 }
167 167
168 protected: 168 protected:
169 FakePictureLayerTilingClient client_; 169 FakePictureLayerTilingClient client_;
170 scoped_ptr<TestablePictureLayerTiling> tiling_; 170 scoped_ptr<TestablePictureLayerTiling> tiling_;
171 171
172 private: 172 private:
173 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest); 173 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest);
174 }; 174 };
175 175
176 TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) {
177 // Verifies that a resize deletes tiles that used to be on the edge.
178 gfx::Size tile_size(100, 100);
179 gfx::Size original_layer_size(10, 10);
180 Initialize(tile_size, 1.f, original_layer_size);
181 SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size));
182
183 // Tiling only has one tile, since its total size is less than one.
184 EXPECT_TRUE(tiling_->TileAt(0, 0));
185
186 // Stop creating tiles so that any invalidations are left as holes.
187 client_.set_allow_create_tile(false);
188
189 tiling_->SetLayerBounds(gfx::Size(200, 200));
190 EXPECT_FALSE(tiling_->TileAt(0, 0));
191 }
192
176 TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) { 193 TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) {
177 Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801)); 194 Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801));
178 SetLiveRectAndVerifyTiles(gfx::Rect(100, 100)); 195 SetLiveRectAndVerifyTiles(gfx::Rect(100, 100));
179 SetLiveRectAndVerifyTiles(gfx::Rect(101, 99)); 196 SetLiveRectAndVerifyTiles(gfx::Rect(101, 99));
180 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1)); 197 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1));
181 SetLiveRectAndVerifyTiles(gfx::Rect(1, 801)); 198 SetLiveRectAndVerifyTiles(gfx::Rect(1, 801));
182 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1)); 199 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1));
183 SetLiveRectAndVerifyTiles(gfx::Rect(201, 800)); 200 SetLiveRectAndVerifyTiles(gfx::Rect(201, 800));
184 } 201 }
185 202
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); 1706 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
1690 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); 1707 EXPECT_EQ(TilePriority::NOW, priority.priority_bin);
1691 1708
1692 priority = tiling->TileAt(1, 0)->priority(ACTIVE_TREE); 1709 priority = tiling->TileAt(1, 0)->priority(ACTIVE_TREE);
1693 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); 1710 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible);
1694 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); 1711 EXPECT_EQ(TilePriority::NOW, priority.priority_bin);
1695 } 1712 }
1696 1713
1697 } // namespace 1714 } // namespace
1698 } // namespace cc 1715 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698