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

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

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 10 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
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | cc/resources/pixel_buffer_tile_task_worker_pool.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 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"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gfx/geometry/rect_conversions.h" 12 #include "ui/gfx/geometry/rect_conversions.h"
13 #include "ui/gfx/geometry/size_conversions.h" 13 #include "ui/gfx/geometry/size_conversions.h"
14 14
15 namespace cc { 15 namespace cc {
16 namespace { 16 namespace {
17 17
18 class PicturePileTestBase { 18 class PicturePileTestBase {
19 public: 19 public:
20 PicturePileTestBase() : min_scale_(0.125), frame_number_(0) {} 20 PicturePileTestBase()
21 : min_scale_(0.125),
22 pile_(min_scale_, gfx::Size(1000, 1000)),
23 frame_number_(0) {}
21 24
22 void InitializeData() { 25 void InitializeData() {
23 pile_.SetTileGridSize(gfx::Size(1000, 1000)); 26 pile_.SetTileGridSize(gfx::Size(1000, 1000));
24 pile_.SetMinContentsScale(min_scale_); 27 pile_.SetMinContentsScale(min_scale_);
25 client_ = FakeContentLayerClient(); 28 client_ = FakeContentLayerClient();
26 SetTilingSize(pile_.tiling().max_texture_size()); 29 SetTilingSize(pile_.tiling().max_texture_size());
27 } 30 }
28 31
29 void SetTilingSize(const gfx::Size& tiling_size) { 32 void SetTilingSize(const gfx::Size& tiling_size) {
30 Region invalidation; 33 Region invalidation;
(...skipping 15 matching lines...) Expand all
46 49
47 bool UpdateWholePile() { 50 bool UpdateWholePile() {
48 Region invalidation = tiling_rect(); 51 Region invalidation = tiling_rect();
49 bool result = UpdateAndExpandInvalidation(&invalidation, tiling_size(), 52 bool result = UpdateAndExpandInvalidation(&invalidation, tiling_size(),
50 tiling_rect()); 53 tiling_rect());
51 EXPECT_EQ(tiling_rect().ToString(), invalidation.ToString()); 54 EXPECT_EQ(tiling_rect().ToString(), invalidation.ToString());
52 return result; 55 return result;
53 } 56 }
54 57
55 FakeContentLayerClient client_; 58 FakeContentLayerClient client_;
59 float min_scale_;
56 FakePicturePile pile_; 60 FakePicturePile pile_;
57 float min_scale_;
58 int frame_number_; 61 int frame_number_;
59 }; 62 };
60 63
61 class PicturePileTest : public PicturePileTestBase, public testing::Test { 64 class PicturePileTest : public PicturePileTestBase, public testing::Test {
62 public: 65 public:
63 void SetUp() override { InitializeData(); } 66 void SetUp() override { InitializeData(); }
64 }; 67 };
65 68
66 TEST_F(PicturePileTest, InvalidationOnTileBorderOutsideInterestRect) { 69 TEST_F(PicturePileTest, InvalidationOnTileBorderOutsideInterestRect) {
67 // Don't expand the interest rect past what we invalidate. 70 // Don't expand the interest rect past what we invalidate.
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 EXPECT_TRUE(pile_.HasRecordings()); 1538 EXPECT_TRUE(pile_.HasRecordings());
1536 pile_.SetEmptyBounds(); 1539 pile_.SetEmptyBounds();
1537 EXPECT_FALSE(pile_.is_solid_color()); 1540 EXPECT_FALSE(pile_.is_solid_color());
1538 EXPECT_TRUE(pile_.GetSize().IsEmpty()); 1541 EXPECT_TRUE(pile_.GetSize().IsEmpty());
1539 EXPECT_TRUE(pile_.picture_map().empty()); 1542 EXPECT_TRUE(pile_.picture_map().empty());
1540 EXPECT_FALSE(pile_.HasRecordings()); 1543 EXPECT_FALSE(pile_.HasRecordings());
1541 } 1544 }
1542 1545
1543 } // namespace 1546 } // namespace
1544 } // namespace cc 1547 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile_impl.cc ('k') | cc/resources/pixel_buffer_tile_task_worker_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698