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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 FakeRenderingStatsInstrumentation stats_instrumentation_; | 89 FakeRenderingStatsInstrumentation stats_instrumentation_; |
90 scoped_refptr<TestPicturePile> pile_; | 90 scoped_refptr<TestPicturePile> pile_; |
91 SkColor background_color_; | 91 SkColor background_color_; |
92 float min_scale_; | 92 float min_scale_; |
93 int frame_number_; | 93 int frame_number_; |
94 bool contents_opaque_; | 94 bool contents_opaque_; |
95 }; | 95 }; |
96 | 96 |
97 class PicturePileTest : public PicturePileTestBase, public testing::Test { | 97 class PicturePileTest : public PicturePileTestBase, public testing::Test { |
98 public: | 98 public: |
99 virtual void SetUp() OVERRIDE { InitializeData(); } | 99 virtual void SetUp() override { InitializeData(); } |
100 }; | 100 }; |
101 | 101 |
102 TEST_F(PicturePileTest, SmallInvalidateInflated) { | 102 TEST_F(PicturePileTest, SmallInvalidateInflated) { |
103 // Invalidate something inside a tile. | 103 // Invalidate something inside a tile. |
104 Region invalidate_rect(gfx::Rect(50, 50, 1, 1)); | 104 Region invalidate_rect(gfx::Rect(50, 50, 1, 1)); |
105 UpdateAndExpandInvalidation(&invalidate_rect, tiling_size(), tiling_rect()); | 105 UpdateAndExpandInvalidation(&invalidate_rect, tiling_size(), tiling_rect()); |
106 EXPECT_EQ(gfx::Rect(50, 50, 1, 1).ToString(), invalidate_rect.ToString()); | 106 EXPECT_EQ(gfx::Rect(50, 50, 1, 1).ToString(), invalidate_rect.ToString()); |
107 | 107 |
108 EXPECT_EQ(1, pile_->tiling().num_tiles_x()); | 108 EXPECT_EQ(1, pile_->tiling().num_tiles_x()); |
109 EXPECT_EQ(1, pile_->tiling().num_tiles_y()); | 109 EXPECT_EQ(1, pile_->tiling().num_tiles_y()); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 enum Corner { | 395 enum Corner { |
396 TOP_LEFT, | 396 TOP_LEFT, |
397 TOP_RIGHT, | 397 TOP_RIGHT, |
398 BOTTOM_LEFT, | 398 BOTTOM_LEFT, |
399 BOTTOM_RIGHT, | 399 BOTTOM_RIGHT, |
400 }; | 400 }; |
401 | 401 |
402 class PicturePileResizeCornerTest : public PicturePileTestBase, | 402 class PicturePileResizeCornerTest : public PicturePileTestBase, |
403 public testing::TestWithParam<Corner> { | 403 public testing::TestWithParam<Corner> { |
404 protected: | 404 protected: |
405 virtual void SetUp() OVERRIDE { InitializeData(); } | 405 virtual void SetUp() override { InitializeData(); } |
406 | 406 |
407 static gfx::Rect CornerSinglePixelRect(Corner corner, const gfx::Size& s) { | 407 static gfx::Rect CornerSinglePixelRect(Corner corner, const gfx::Size& s) { |
408 switch (corner) { | 408 switch (corner) { |
409 case TOP_LEFT: | 409 case TOP_LEFT: |
410 return gfx::Rect(0, 0, 1, 1); | 410 return gfx::Rect(0, 0, 1, 1); |
411 case TOP_RIGHT: | 411 case TOP_RIGHT: |
412 return gfx::Rect(s.width() - 1, 0, 1, 1); | 412 return gfx::Rect(s.width() - 1, 0, 1, 1); |
413 case BOTTOM_LEFT: | 413 case BOTTOM_LEFT: |
414 return gfx::Rect(0, s.height() - 1, 1, 1); | 414 return gfx::Rect(0, s.height() - 1, 1, 1); |
415 case BOTTOM_RIGHT: | 415 case BOTTOM_RIGHT: |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 client_.add_draw_rect(tiling_rect(), paint); | 1271 client_.add_draw_rect(tiling_rect(), paint); |
1272 client_.add_draw_rect(tiling_rect(), paint); | 1272 client_.add_draw_rect(tiling_rect(), paint); |
1273 client_.add_draw_rect(tiling_rect(), paint); | 1273 client_.add_draw_rect(tiling_rect(), paint); |
1274 Region invalidation5(tiling_rect()); | 1274 Region invalidation5(tiling_rect()); |
1275 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect()); | 1275 UpdateAndExpandInvalidation(&invalidation5, tiling_size(), tiling_rect()); |
1276 EXPECT_FALSE(pile_->is_solid_color()); | 1276 EXPECT_FALSE(pile_->is_solid_color()); |
1277 } | 1277 } |
1278 | 1278 |
1279 } // namespace | 1279 } // namespace |
1280 } // namespace cc | 1280 } // namespace cc |
OLD | NEW |