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

Side by Side Diff: cc/layers/picture_layer_impl_unittest.cc

Issue 202763002: Switch to use SharedBitmapManager all the time in cc_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_image_layer_impl_unittest.cc ('k') | cc/layers/picture_layer_unittest.cc » ('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 "cc/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "cc/layers/append_quads_data.h" 9 #include "cc/layers/append_quads_data.h"
10 #include "cc/layers/picture_layer.h" 10 #include "cc/layers/picture_layer.h"
11 #include "cc/test/fake_content_layer_client.h" 11 #include "cc/test/fake_content_layer_client.h"
12 #include "cc/test/fake_impl_proxy.h" 12 #include "cc/test/fake_impl_proxy.h"
13 #include "cc/test/fake_layer_tree_host_impl.h" 13 #include "cc/test/fake_layer_tree_host_impl.h"
14 #include "cc/test/fake_output_surface.h" 14 #include "cc/test/fake_output_surface.h"
15 #include "cc/test/fake_picture_layer_impl.h" 15 #include "cc/test/fake_picture_layer_impl.h"
16 #include "cc/test/fake_picture_pile_impl.h" 16 #include "cc/test/fake_picture_pile_impl.h"
17 #include "cc/test/geometry_test_utils.h" 17 #include "cc/test/geometry_test_utils.h"
18 #include "cc/test/gpu_rasterization_settings.h" 18 #include "cc/test/gpu_rasterization_settings.h"
19 #include "cc/test/hybrid_rasterization_settings.h" 19 #include "cc/test/hybrid_rasterization_settings.h"
20 #include "cc/test/impl_side_painting_settings.h" 20 #include "cc/test/impl_side_painting_settings.h"
21 #include "cc/test/mock_quad_culler.h" 21 #include "cc/test/mock_quad_culler.h"
22 #include "cc/test/test_shared_bitmap_manager.h"
22 #include "cc/test/test_web_graphics_context_3d.h" 23 #include "cc/test/test_web_graphics_context_3d.h"
23 #include "cc/trees/layer_tree_impl.h" 24 #include "cc/trees/layer_tree_impl.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 #include "ui/gfx/rect_conversions.h" 26 #include "ui/gfx/rect_conversions.h"
26 27
27 namespace cc { 28 namespace cc {
28 namespace { 29 namespace {
29 30
30 class MockCanvas : public SkCanvas { 31 class MockCanvas : public SkCanvas {
31 public: 32 public:
32 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {} 33 explicit MockCanvas(int w, int h) : SkCanvas(w, h) {}
33 34
34 virtual void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE { 35 virtual void drawRect(const SkRect& rect, const SkPaint& paint) OVERRIDE {
35 // Capture calls before SkCanvas quickReject() kicks in. 36 // Capture calls before SkCanvas quickReject() kicks in.
36 rects_.push_back(rect); 37 rects_.push_back(rect);
37 } 38 }
38 39
39 std::vector<SkRect> rects_; 40 std::vector<SkRect> rects_;
40 }; 41 };
41 42
42 class PictureLayerImplTest : public testing::Test { 43 class PictureLayerImplTest : public testing::Test {
43 public: 44 public:
44 PictureLayerImplTest() 45 PictureLayerImplTest()
45 : proxy_(base::MessageLoopProxy::current()), 46 : proxy_(base::MessageLoopProxy::current()),
46 host_impl_(ImplSidePaintingSettings(), &proxy_), 47 host_impl_(ImplSidePaintingSettings(),
48 &proxy_,
49 &shared_bitmap_manager_),
47 id_(7) {} 50 id_(7) {}
48 51
49 explicit PictureLayerImplTest(const LayerTreeSettings& settings) 52 explicit PictureLayerImplTest(const LayerTreeSettings& settings)
50 : proxy_(base::MessageLoopProxy::current()), 53 : proxy_(base::MessageLoopProxy::current()),
51 host_impl_(settings, &proxy_), 54 host_impl_(settings, &proxy_, &shared_bitmap_manager_),
52 id_(7) {} 55 id_(7) {}
53 56
54 virtual ~PictureLayerImplTest() { 57 virtual ~PictureLayerImplTest() {
55 } 58 }
56 59
57 virtual void SetUp() OVERRIDE { 60 virtual void SetUp() OVERRIDE {
58 InitializeRenderer(); 61 InitializeRenderer();
59 } 62 }
60 63
61 virtual void InitializeRenderer() { 64 virtual void InitializeRenderer() {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // at content scale 1.0, the playback canvas never receives content from 238 // at content scale 1.0, the playback canvas never receives content from
236 // neighboring tiles which indicates that the tile grid embedded in 239 // neighboring tiles which indicates that the tile grid embedded in
237 // SkPicture is perfectly aligned with the compositor's tiles. 240 // SkPicture is perfectly aligned with the compositor's tiles.
238 EXPECT_EQ(1u, mock_canvas.rects_.size()); 241 EXPECT_EQ(1u, mock_canvas.rects_.size());
239 EXPECT_RECT_EQ(*rect_iter, mock_canvas.rects_[0]); 242 EXPECT_RECT_EQ(*rect_iter, mock_canvas.rects_[0]);
240 rect_iter++; 243 rect_iter++;
241 } 244 }
242 } 245 }
243 246
244 FakeImplProxy proxy_; 247 FakeImplProxy proxy_;
248 TestSharedBitmapManager shared_bitmap_manager_;
245 FakeLayerTreeHostImpl host_impl_; 249 FakeLayerTreeHostImpl host_impl_;
246 int id_; 250 int id_;
247 FakePictureLayerImpl* pending_layer_; 251 FakePictureLayerImpl* pending_layer_;
248 FakePictureLayerImpl* active_layer_; 252 FakePictureLayerImpl* active_layer_;
249 253
250 private: 254 private:
251 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest); 255 DISALLOW_COPY_AND_ASSIGN(PictureLayerImplTest);
252 }; 256 };
253 257
254 TEST_F(PictureLayerImplTest, TileGridAlignment) { 258 TEST_F(PictureLayerImplTest, TileGridAlignment) {
(...skipping 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 // Should still have the high-res tiling. 1685 // Should still have the high-res tiling.
1682 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1686 EXPECT_EQ(1u, pending_layer_->tilings()->num_tilings());
1683 pending_layer_->CalculateContentsScale( 1687 pending_layer_->CalculateContentsScale(
1684 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds); 1688 1.f, 1.f, 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
1685 // Should still only have the high-res tiling. 1689 // Should still only have the high-res tiling.
1686 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings()); 1690 ASSERT_EQ(1u, pending_layer_->tilings()->num_tilings());
1687 } 1691 }
1688 1692
1689 } // namespace 1693 } // namespace
1690 } // namespace cc 1694 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_image_layer_impl_unittest.cc ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698