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

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

Issue 737943002: Update from https://crrev.com/304715 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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/resources/picture_layer_tiling_set.cc ('k') | cc/resources/picture_pile.h » ('j') | 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_set.h" 5 #include "cc/resources/picture_layer_tiling_set.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "cc/resources/resource_provider.h" 10 #include "cc/resources/resource_provider.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 424
425 TEST_F(PictureLayerTilingSetSyncTest, KeepExisting) { 425 TEST_F(PictureLayerTilingSetSyncTest, KeepExisting) {
426 float source_scales[] = {0.7f, 1.f, 1.1f, 2.f}; 426 float source_scales[] = {0.7f, 1.f, 1.1f, 2.f};
427 for (size_t i = 0; i < arraysize(source_scales); ++i) 427 for (size_t i = 0; i < arraysize(source_scales); ++i)
428 source_->AddTiling(source_scales[i], source_bounds_); 428 source_->AddTiling(source_scales[i], source_bounds_);
429 float target_scales[] = {0.5f, 1.f, 2.f}; 429 float target_scales[] = {0.5f, 1.f, 2.f};
430 for (size_t i = 0; i < arraysize(target_scales); ++i) 430 for (size_t i = 0; i < arraysize(target_scales); ++i)
431 target_->AddTiling(target_scales[i], target_bounds_); 431 target_->AddTiling(target_scales[i], target_bounds_);
432 432
433 PictureLayerTiling* tiling1 = source_->TilingAtScale(1.f); 433 PictureLayerTiling* tiling1 = source_->FindTilingWithScale(1.f);
434 ASSERT_TRUE(tiling1); 434 ASSERT_TRUE(tiling1);
435 tiling1->CreateAllTilesForTesting(); 435 tiling1->CreateAllTilesForTesting();
436 EXPECT_EQ(tiling1->contents_scale(), 1.f); 436 EXPECT_EQ(tiling1->contents_scale(), 1.f);
437 Tile* tile1 = FindTileAtOrigin(tiling1); 437 Tile* tile1 = FindTileAtOrigin(tiling1);
438 ASSERT_TRUE(tile1); 438 ASSERT_TRUE(tile1);
439 439
440 PictureLayerTiling* tiling2 = source_->TilingAtScale(2.f); 440 PictureLayerTiling* tiling2 = source_->FindTilingWithScale(2.f);
441 tiling2->CreateAllTilesForTesting(); 441 tiling2->CreateAllTilesForTesting();
442 ASSERT_TRUE(tiling2); 442 ASSERT_TRUE(tiling2);
443 EXPECT_EQ(tiling2->contents_scale(), 2.f); 443 EXPECT_EQ(tiling2->contents_scale(), 2.f);
444 Tile* tile2 = FindTileAtOrigin(tiling2); 444 Tile* tile2 = FindTileAtOrigin(tiling2);
445 ASSERT_TRUE(tile2); 445 ASSERT_TRUE(tile2);
446 446
447 gfx::Size new_bounds(15, 40); 447 gfx::Size new_bounds(15, 40);
448 SyncTilings(new_bounds); 448 SyncTilings(new_bounds);
449 VerifyTargetEqualsSource(new_bounds); 449 VerifyTargetEqualsSource(new_bounds);
450 450
451 EXPECT_EQ(tiling1, source_->TilingAtScale(1.f)); 451 EXPECT_EQ(tiling1, source_->FindTilingWithScale(1.f));
452 EXPECT_EQ(tile1, FindTileAtOrigin(tiling1)); 452 EXPECT_EQ(tile1, FindTileAtOrigin(tiling1));
453 EXPECT_FALSE(tiling1->live_tiles_rect().IsEmpty()); 453 EXPECT_FALSE(tiling1->live_tiles_rect().IsEmpty());
454 454
455 EXPECT_EQ(tiling2, source_->TilingAtScale(2.f)); 455 EXPECT_EQ(tiling2, source_->FindTilingWithScale(2.f));
456 EXPECT_EQ(tile2, FindTileAtOrigin(tiling2)); 456 EXPECT_EQ(tile2, FindTileAtOrigin(tiling2));
457 EXPECT_FALSE(tiling2->live_tiles_rect().IsEmpty()); 457 EXPECT_FALSE(tiling2->live_tiles_rect().IsEmpty());
458 } 458 }
459 459
460 TEST_F(PictureLayerTilingSetSyncTest, EmptySet) { 460 TEST_F(PictureLayerTilingSetSyncTest, EmptySet) {
461 float target_scales[] = {0.2f, 1.f}; 461 float target_scales[] = {0.2f, 1.f};
462 for (size_t i = 0; i < arraysize(target_scales); ++i) 462 for (size_t i = 0; i < arraysize(target_scales); ++i)
463 target_->AddTiling(target_scales[i], target_bounds_); 463 target_->AddTiling(target_scales[i], target_bounds_);
464 464
465 gfx::Size new_bounds(15, 40); 465 gfx::Size new_bounds(15, 40);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting(); 546 std::vector<Tile*> new_tiles = target_->tiling_at(0)->AllTilesForTesting();
547 for (size_t i = 0; i < original_tiles.size(); ++i) { 547 for (size_t i = 0; i < original_tiles.size(); ++i) {
548 std::vector<Tile*>::iterator find = 548 std::vector<Tile*>::iterator find =
549 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]); 549 std::find(new_tiles.begin(), new_tiles.end(), original_tiles[i]);
550 EXPECT_TRUE(find == new_tiles.end()); 550 EXPECT_TRUE(find == new_tiles.end());
551 } 551 }
552 } 552 }
553 553
554 } // namespace 554 } // namespace
555 } // namespace cc 555 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_layer_tiling_set.cc ('k') | cc/resources/picture_pile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698