OLD | NEW |
---|---|
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 <map> | 5 #include <map> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "cc/resources/picture_pile.h" | 8 #include "cc/resources/picture_pile.h" |
9 #include "cc/test/fake_content_layer_client.h" | 9 #include "cc/test/fake_content_layer_client.h" |
10 #include "cc/test/fake_rendering_stats_instrumentation.h" | 10 #include "cc/test/fake_rendering_stats_instrumentation.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 EXPECT_EQ(gfx::Rect(0, 0, 1, 1).ToString(), invalidation.ToString()); | 357 EXPECT_EQ(gfx::Rect(0, 0, 1, 1).ToString(), invalidation.ToString()); |
358 | 358 |
359 // No invalidation, changing viewport. | 359 // No invalidation, changing viewport. |
360 invalidation = Region(); | 360 invalidation = Region(); |
361 UpdateAndExpandInvalidation( | 361 UpdateAndExpandInvalidation( |
362 &invalidation, tiling_size(), gfx::Rect(5, 5, 5, 5)); | 362 &invalidation, tiling_size(), gfx::Rect(5, 5, 5, 5)); |
363 EXPECT_TRUE(!pile_->recorded_viewport().IsEmpty()); | 363 EXPECT_TRUE(!pile_->recorded_viewport().IsEmpty()); |
364 EXPECT_EQ(Region().ToString(), invalidation.ToString()); | 364 EXPECT_EQ(Region().ToString(), invalidation.ToString()); |
365 } | 365 } |
366 | 366 |
367 TEST_F(PicturePileTest, BigFullLayerInvalidation) { | |
368 gfx::Size huge_layer_size(100000000, 100000000); | |
369 gfx::Rect viewport(300000, 400000, 5000, 6000); | |
370 | |
371 // Resize the pile. | |
372 Region invalidation; | |
373 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); | |
374 | |
375 // Invalidating a huge layer should be fast. | |
376 base::TimeTicks start = base::TimeTicks::Now(); | |
377 invalidation = gfx::Rect(huge_layer_size); | |
378 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); | |
379 base::TimeTicks end = base::TimeTicks::Now(); | |
380 base::TimeDelta length = end - start; | |
381 // This is verrrry generous to avoid flake. | |
382 EXPECT_LT(length.InSeconds(), 5); | |
383 } | |
384 | |
385 TEST_F(PicturePileTest, BigFullLayerInvalidationWithResizeGrow) { | |
386 gfx::Size huge_layer_size(100000000, 100000000); | |
387 gfx::Rect viewport(300000, 400000, 5000, 6000); | |
388 | |
389 // Resize the pile. | |
390 Region invalidation; | |
391 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); | |
392 | |
393 // Resize the pile even larger, while invalidating everything in the old size. | |
394 // Invalidating the whole thing should be fast. | |
395 base::TimeTicks start = base::TimeTicks::Now(); | |
396 gfx::Size bigger_layer_size(huge_layer_size.width() * 2, | |
397 huge_layer_size.height() * 2); | |
398 invalidation = gfx::Rect(huge_layer_size); | |
399 UpdateAndExpandInvalidation(&invalidation, bigger_layer_size, viewport); | |
400 base::TimeTicks end = base::TimeTicks::Now(); | |
401 base::TimeDelta length = end - start; | |
402 // This is verrrry generous to avoid flake. | |
403 EXPECT_LT(length.InSeconds(), 5); | |
404 } | |
405 | |
406 TEST_F(PicturePileTest, BigFullLayerInvalidationWithResizeShrink) { | |
407 gfx::Size huge_layer_size(100000000, 100000000); | |
408 gfx::Rect viewport(300000, 400000, 5000, 6000); | |
409 | |
410 // Resize the pile. | |
411 Region invalidation; | |
412 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); | |
413 | |
414 // Resize the pile smaller, while invalidating everything in the new size. | |
415 // Invalidating the whole thing should be fast. | |
416 base::TimeTicks start = base::TimeTicks::Now(); | |
417 gfx::Size smaller_layer_size(huge_layer_size.width() - 1000, | |
418 huge_layer_size.height() - 1000); | |
419 invalidation = gfx::Rect(smaller_layer_size); | |
420 UpdateAndExpandInvalidation(&invalidation, smaller_layer_size, viewport); | |
421 base::TimeTicks end = base::TimeTicks::Now(); | |
422 base::TimeDelta length = end - start; | |
423 // This is verrrry generous to avoid flake. | |
424 EXPECT_LT(length.InSeconds(), 5); | |
enne (OOO)
2014/10/11 00:26:33
Are there correctness tests you can do here too, l
danakj
2014/10/11 00:30:22
Hmm ya I guess that'd be good. I did break some LT
| |
425 } | |
426 | |
367 TEST_F(PicturePileTest, InvalidationOutsideRecordingRect) { | 427 TEST_F(PicturePileTest, InvalidationOutsideRecordingRect) { |
368 gfx::Size huge_layer_size(10000000, 20000000); | 428 gfx::Size huge_layer_size(10000000, 20000000); |
369 gfx::Rect viewport(300000, 400000, 5000, 6000); | 429 gfx::Rect viewport(300000, 400000, 5000, 6000); |
370 | 430 |
371 // Resize the pile and set up the interest rect. | 431 // Resize the pile and set up the interest rect. |
372 Region invalidation; | 432 Region invalidation; |
373 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); | 433 UpdateAndExpandInvalidation(&invalidation, huge_layer_size, viewport); |
374 | 434 |
375 // Invalidation inside the recording rect does not need to be expanded. | 435 // Invalidation inside the recording rect does not need to be expanded. |
376 invalidation = viewport; | 436 invalidation = viewport; |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1271 client_.add_draw_rect(tiling_rect(), paint); | 1331 client_.add_draw_rect(tiling_rect(), paint); |
1272 client_.add_draw_rect(tiling_rect(), paint); | 1332 client_.add_draw_rect(tiling_rect(), paint); |
1273 client_.add_draw_rect(tiling_rect(), paint); | 1333 client_.add_draw_rect(tiling_rect(), paint); |
1274 Region invalidation5(tiling_rect()); | 1334 Region invalidation5(tiling_rect()); |
1275 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect()); | 1335 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect()); |
1276 EXPECT_FALSE(pile_->is_solid_color()); | 1336 EXPECT_FALSE(pile_->is_solid_color()); |
1277 } | 1337 } |
1278 | 1338 |
1279 } // namespace | 1339 } // namespace |
1280 } // namespace cc | 1340 } // namespace cc |
OLD | NEW |