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

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: Created 3 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
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 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 expectation.Scale(1.5f / 1.56f); 1249 expectation.Scale(1.5f / 1.56f);
1250 expectation.Offset(0.5f, 0.5f); 1250 expectation.Offset(0.5f, 0.5f);
1251 EXPECT_FLOAT_EQ(expectation.x(), texture_rect.x()); 1251 EXPECT_FLOAT_EQ(expectation.x(), texture_rect.x());
1252 EXPECT_FLOAT_EQ(expectation.y(), texture_rect.y()); 1252 EXPECT_FLOAT_EQ(expectation.y(), texture_rect.y());
1253 EXPECT_FLOAT_EQ(expectation.width(), texture_rect.width()); 1253 EXPECT_FLOAT_EQ(expectation.width(), texture_rect.width());
1254 EXPECT_FLOAT_EQ(expectation.height(), texture_rect.height()); 1254 EXPECT_FLOAT_EQ(expectation.height(), texture_rect.height());
1255 1255
1256 EXPECT_FALSE(++iter); 1256 EXPECT_FALSE(++iter);
1257 } 1257 }
1258 1258
1259 TEST_F(PictureLayerTilingIteratorTest, EdgeCaseLargeIntBounds) {
1260 gfx::Size tile_size(256, 256);
1261 float scale = 7352.331055f;
1262 gfx::Size layer_bounds(292082, 26910);
1263 gfx::Rect coverage_rect(2104641536, 522015, 29440, 66172);
1264 Initialize(tile_size, scale, layer_bounds);
1265 int count = 0;
1266 for (PictureLayerTiling::CoverageIterator
1267 iter(tiling_.get(), scale, coverage_rect);
1268 iter && count < 200; ++count, ++iter) {
1269 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
1270 }
1271 }
1272
1273 TEST_F(PictureLayerTilingIteratorTest, EdgeCaseLargeIntBounds2) {
1274 gfx::RectF rect(2104670720.f, 522014.5f, 192.f, 1.f);
1275 gfx::Size tile_size(256, 256);
1276 float scale = 7352.331055f;
1277 gfx::Size layer_bounds(292082, 26910);
1278 gfx::Rect coverage_rect(2104670720, 522015, 192, 1);
1279 Initialize(tile_size, scale, layer_bounds);
1280 for (PictureLayerTiling::CoverageIterator iter(tiling_.get(), scale,
1281 coverage_rect);
1282 iter; ++iter) {
1283 EXPECT_FALSE(iter.geometry_rect().IsEmpty());
1284 }
1285 }
1286
1259 } // namespace 1287 } // namespace
1260 } // namespace cc 1288 } // namespace cc
OLDNEW
« cc/tiles/picture_layer_tiling.cc ('K') | « cc/tiles/picture_layer_tiling.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698