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_picture_pile.h" | 10 #include "cc/test/fake_picture_pile.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 FakeContentLayerClient client_; | 60 FakeContentLayerClient client_; |
61 FakePicturePile pile_; | 61 FakePicturePile pile_; |
62 SkColor background_color_; | 62 SkColor background_color_; |
63 float min_scale_; | 63 float min_scale_; |
64 int frame_number_; | 64 int frame_number_; |
65 bool contents_opaque_; | 65 bool contents_opaque_; |
66 }; | 66 }; |
67 | 67 |
68 class PicturePileTest : public PicturePileTestBase, public testing::Test { | 68 class PicturePileTest : public PicturePileTestBase, public testing::Test { |
69 public: | 69 public: |
70 virtual void SetUp() override { InitializeData(); } | 70 void SetUp() override { InitializeData(); } |
71 }; | 71 }; |
72 | 72 |
73 TEST_F(PicturePileTest, InvalidationOnTileBorderOutsideInterestRect) { | 73 TEST_F(PicturePileTest, InvalidationOnTileBorderOutsideInterestRect) { |
74 // Don't expand the interest rect past what we invalidate. | 74 // Don't expand the interest rect past what we invalidate. |
75 pile_.SetPixelRecordDistance(0); | 75 pile_.SetPixelRecordDistance(0); |
76 | 76 |
77 gfx::Size tile_size(100, 100); | 77 gfx::Size tile_size(100, 100); |
78 pile_.tiling().SetMaxTextureSize(tile_size); | 78 pile_.tiling().SetMaxTextureSize(tile_size); |
79 | 79 |
80 gfx::Size pile_size(400, 400); | 80 gfx::Size pile_size(400, 400); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 enum Corner { | 524 enum Corner { |
525 TOP_LEFT, | 525 TOP_LEFT, |
526 TOP_RIGHT, | 526 TOP_RIGHT, |
527 BOTTOM_LEFT, | 527 BOTTOM_LEFT, |
528 BOTTOM_RIGHT, | 528 BOTTOM_RIGHT, |
529 }; | 529 }; |
530 | 530 |
531 class PicturePileResizeCornerTest : public PicturePileTestBase, | 531 class PicturePileResizeCornerTest : public PicturePileTestBase, |
532 public testing::TestWithParam<Corner> { | 532 public testing::TestWithParam<Corner> { |
533 protected: | 533 protected: |
534 virtual void SetUp() override { InitializeData(); } | 534 void SetUp() override { InitializeData(); } |
535 | 535 |
536 static gfx::Rect CornerSinglePixelRect(Corner corner, const gfx::Size& s) { | 536 static gfx::Rect CornerSinglePixelRect(Corner corner, const gfx::Size& s) { |
537 switch (corner) { | 537 switch (corner) { |
538 case TOP_LEFT: | 538 case TOP_LEFT: |
539 return gfx::Rect(0, 0, 1, 1); | 539 return gfx::Rect(0, 0, 1, 1); |
540 case TOP_RIGHT: | 540 case TOP_RIGHT: |
541 return gfx::Rect(s.width() - 1, 0, 1, 1); | 541 return gfx::Rect(s.width() - 1, 0, 1, 1); |
542 case BOTTOM_LEFT: | 542 case BOTTOM_LEFT: |
543 return gfx::Rect(0, s.height() - 1, 1, 1); | 543 return gfx::Rect(0, s.height() - 1, 1, 1); |
544 case BOTTOM_RIGHT: | 544 case BOTTOM_RIGHT: |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 EXPECT_TRUE(pile_.HasRecordings()); | 1542 EXPECT_TRUE(pile_.HasRecordings()); |
1543 pile_.SetEmptyBounds(); | 1543 pile_.SetEmptyBounds(); |
1544 EXPECT_FALSE(pile_.is_solid_color()); | 1544 EXPECT_FALSE(pile_.is_solid_color()); |
1545 EXPECT_TRUE(pile_.GetSize().IsEmpty()); | 1545 EXPECT_TRUE(pile_.GetSize().IsEmpty()); |
1546 EXPECT_TRUE(pile_.picture_map().empty()); | 1546 EXPECT_TRUE(pile_.picture_map().empty()); |
1547 EXPECT_FALSE(pile_.HasRecordings()); | 1547 EXPECT_FALSE(pile_.HasRecordings()); |
1548 } | 1548 } |
1549 | 1549 |
1550 } // namespace | 1550 } // namespace |
1551 } // namespace cc | 1551 } // namespace cc |
OLD | NEW |