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

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

Issue 816543004: Update from https://crrev.com/308996 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/layers/layer_impl.h ('k') | cc/layers/picture_layer.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_image_layer_impl.h" 5 #include "cc/layers/picture_image_layer_impl.h"
6 6
7 #include "cc/layers/append_quads_data.h" 7 #include "cc/layers/append_quads_data.h"
8 #include "cc/quads/draw_quad.h" 8 #include "cc/quads/draw_quad.h"
9 #include "cc/resources/tile_priority.h" 9 #include "cc/resources/tile_priority.h"
10 #include "cc/test/fake_impl_proxy.h" 10 #include "cc/test/fake_impl_proxy.h"
11 #include "cc/test/fake_layer_tree_host_impl.h" 11 #include "cc/test/fake_layer_tree_host_impl.h"
12 #include "cc/test/fake_output_surface.h" 12 #include "cc/test/fake_output_surface.h"
13 #include "cc/test/fake_picture_pile_impl.h" 13 #include "cc/test/fake_picture_pile_impl.h"
14 #include "cc/test/impl_side_painting_settings.h" 14 #include "cc/test/impl_side_painting_settings.h"
15 #include "cc/test/test_shared_bitmap_manager.h" 15 #include "cc/test/test_shared_bitmap_manager.h"
16 #include "cc/trees/layer_tree_impl.h" 16 #include "cc/trees/layer_tree_impl.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace cc { 19 namespace cc {
20 namespace { 20 namespace {
21 21
22 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { 22 class TestablePictureImageLayerImpl : public PictureImageLayerImpl {
23 public: 23 public:
24 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id) 24 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id)
25 : PictureImageLayerImpl(tree_impl, id, false) {} 25 : PictureImageLayerImpl(tree_impl, id, false) {}
26 using PictureLayerImpl::UpdateIdealScales; 26 using PictureLayerImpl::UpdateIdealScales;
27 using PictureLayerImpl::MaximumTilingContentsScale; 27 using PictureLayerImpl::MaximumTilingContentsScale;
28 using PictureLayerImpl::DoPostCommitInitializationIfNeeded;
29 28
30 PictureLayerTilingSet* tilings() { return tilings_.get(); } 29 PictureLayerTilingSet* tilings() { return tilings_.get(); }
31 30
32 friend class PictureImageLayerImplTest; 31 friend class PictureImageLayerImplTest;
33 }; 32 };
34 33
35 class PictureImageLayerImplTest : public testing::Test { 34 class PictureImageLayerImplTest : public testing::Test {
36 public: 35 public:
37 PictureImageLayerImplTest() 36 PictureImageLayerImplTest()
38 : proxy_(base::MessageLoopProxy::current()), 37 : proxy_(base::MessageLoopProxy::current()),
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 85
87 protected: 86 protected:
88 FakeImplProxy proxy_; 87 FakeImplProxy proxy_;
89 FakeLayerTreeHostImpl host_impl_; 88 FakeLayerTreeHostImpl host_impl_;
90 TestSharedBitmapManager shared_bitmap_manager_; 89 TestSharedBitmapManager shared_bitmap_manager_;
91 }; 90 };
92 91
93 TEST_F(PictureImageLayerImplTest, CalculateContentsScale) { 92 TEST_F(PictureImageLayerImplTest, CalculateContentsScale) {
94 scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE)); 93 scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE));
95 layer->SetDrawsContent(true); 94 layer->SetDrawsContent(true);
96 layer->DoPostCommitInitializationIfNeeded();
97 95
98 gfx::Rect viewport(100, 200); 96 gfx::Rect viewport(100, 200);
99 SetupDrawPropertiesAndUpdateTiles( 97 SetupDrawPropertiesAndUpdateTiles(
100 layer.get(), 2.f, 3.f, 4.f, 1.f, false, viewport); 98 layer.get(), 2.f, 3.f, 4.f, 1.f, false, viewport);
101 99
102 EXPECT_FLOAT_EQ(1.f, layer->contents_scale_x()); 100 EXPECT_FLOAT_EQ(1.f, layer->contents_scale_x());
103 EXPECT_FLOAT_EQ(1.f, layer->contents_scale_y()); 101 EXPECT_FLOAT_EQ(1.f, layer->contents_scale_y());
104 EXPECT_FLOAT_EQ(1.f, layer->MaximumTilingContentsScale()); 102 EXPECT_FLOAT_EQ(1.f, layer->MaximumTilingContentsScale());
105 } 103 }
106 104
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 active_layer->DidDraw(nullptr); 153 active_layer->DidDraw(nullptr);
156 154
157 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); 155 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material);
158 156
159 // Tiles are ready at correct scale, so should not set had_incomplete_tile. 157 // Tiles are ready at correct scale, so should not set had_incomplete_tile.
160 EXPECT_EQ(0, data.num_incomplete_tiles); 158 EXPECT_EQ(0, data.num_incomplete_tiles);
161 } 159 }
162 160
163 } // namespace 161 } // namespace
164 } // namespace cc 162 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698