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

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

Issue 714203006: cc: Remove PicturePileBase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments 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
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/test_picture_pile.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/gfx/geometry/rect_conversions.h" 12 #include "ui/gfx/geometry/rect_conversions.h"
12 #include "ui/gfx/geometry/size_conversions.h" 13 #include "ui/gfx/geometry/size_conversions.h"
13 14
14 namespace cc { 15 namespace cc {
15 namespace { 16 namespace {
16 17
17 class TestPicturePile : public PicturePile {
18 public:
19 ~TestPicturePile() override {}
20
21 using PicturePile::buffer_pixels;
22 using PicturePile::CanRasterSlowTileCheck;
23 using PicturePile::Clear;
24
25 PictureMap& picture_map() { return picture_map_; }
26 const gfx::Rect& recorded_viewport() const { return recorded_viewport_; }
27
28 bool CanRasterLayerRect(gfx::Rect layer_rect) {
29 layer_rect.Intersect(gfx::Rect(tiling_.tiling_size()));
30 if (recorded_viewport_.Contains(layer_rect))
31 return true;
32 return CanRasterSlowTileCheck(layer_rect);
33 }
34
35 bool HasRecordings() const { return has_any_recordings_; }
36
37 typedef PicturePile::PictureInfo PictureInfo;
38 typedef PicturePile::PictureMapKey PictureMapKey;
39 typedef PicturePile::PictureMap PictureMap;
40 };
41
42 class PicturePileTestBase { 18 class PicturePileTestBase {
43 public: 19 public:
44 PicturePileTestBase() 20 PicturePileTestBase()
45 : background_color_(SK_ColorBLUE), 21 : background_color_(SK_ColorBLUE),
46 min_scale_(0.125), 22 min_scale_(0.125),
47 frame_number_(0), 23 frame_number_(0),
48 contents_opaque_(false) {} 24 contents_opaque_(false) {}
49 25
50 void InitializeData() { 26 void InitializeData() {
51 pile_.SetTileGridSize(gfx::Size(1000, 1000)); 27 pile_.SetTileGridSize(gfx::Size(1000, 1000));
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 EXPECT_TRUE(pile_.HasRecordings()); 1542 EXPECT_TRUE(pile_.HasRecordings());
1567 pile_.SetEmptyBounds(); 1543 pile_.SetEmptyBounds();
1568 EXPECT_FALSE(pile_.is_solid_color()); 1544 EXPECT_FALSE(pile_.is_solid_color());
1569 EXPECT_TRUE(pile_.GetSize().IsEmpty()); 1545 EXPECT_TRUE(pile_.GetSize().IsEmpty());
1570 EXPECT_TRUE(pile_.picture_map().empty()); 1546 EXPECT_TRUE(pile_.picture_map().empty());
1571 EXPECT_FALSE(pile_.HasRecordings()); 1547 EXPECT_FALSE(pile_.HasRecordings());
1572 } 1548 }
1573 1549
1574 } // namespace 1550 } // namespace
1575 } // namespace cc 1551 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698