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

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

Issue 2816943004: cc: Fix bugs found by fuzzer due to floating point imprecision. (Closed)
Patch Set: layouttests Created 3 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
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/tiles/picture_layer_tiling.h" 5 #include "cc/tiles/picture_layer_tiling.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1248 expectation.Scale(1.5f / 1.56f); 1248 expectation.Scale(1.5f / 1.56f);
1249 expectation.Offset(0.5f, 0.5f); 1249 expectation.Offset(0.5f, 0.5f);
1250 EXPECT_FLOAT_EQ(expectation.x(), texture_rect.x()); 1250 EXPECT_FLOAT_EQ(expectation.x(), texture_rect.x());
1251 EXPECT_FLOAT_EQ(expectation.y(), texture_rect.y()); 1251 EXPECT_FLOAT_EQ(expectation.y(), texture_rect.y());
1252 EXPECT_FLOAT_EQ(expectation.width(), texture_rect.width()); 1252 EXPECT_FLOAT_EQ(expectation.width(), texture_rect.width());
1253 EXPECT_FLOAT_EQ(expectation.height(), texture_rect.height()); 1253 EXPECT_FLOAT_EQ(expectation.height(), texture_rect.height());
1254 1254
1255 EXPECT_FALSE(++iter); 1255 EXPECT_FALSE(++iter);
1256 } 1256 }
1257 1257
1258 TEST_F(PictureLayerTilingIteratorTest, EdgeCaseLargeIntBounds) {
1259 gfx::Size tile_size(256, 256);
1260 float scale = 7352.331055f;
1261 gfx::Size layer_bounds(292082, 26910);
1262 gfx::Rect coverage_rect(2104641536, 522015, 29440, 66172);
1263 Initialize(tile_size, scale, layer_bounds);
1264 int count = 0;
1265 for (PictureLayerTiling::CoverageIterator
1266 iter(tiling_.get(), scale, coverage_rect);
1267 iter && count < 200; ++count, ++iter) {
1268 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
1269 }
1270 }
1271
1272 TEST_F(PictureLayerTilingIteratorTest, EdgeCaseLargeIntBounds2) {
1273 gfx::RectF rect(2104670720.f, 522014.5f, 192.f, 1.f);
1274 gfx::Size tile_size(256, 256);
1275 float scale = 7352.331055f;
1276 gfx::Size layer_bounds(292082, 26910);
1277 gfx::Rect coverage_rect(2104670720, 522015, 192, 1);
1278 Initialize(tile_size, scale, layer_bounds);
1279 for (PictureLayerTiling::CoverageIterator iter(tiling_.get(), scale,
1280 coverage_rect);
1281 iter; ++iter) {
1282 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
1283 }
1284 }
1285
1258 } // namespace 1286 } // namespace
1259 } // namespace cc 1287 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698