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

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

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl.cc ('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/test/test_task_graph_runner.h"
16 #include "cc/trees/layer_tree_impl.h" 17 #include "cc/trees/layer_tree_impl.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace cc { 20 namespace cc {
20 namespace { 21 namespace {
21 22
22 class TestablePictureImageLayerImpl : public PictureImageLayerImpl { 23 class TestablePictureImageLayerImpl : public PictureImageLayerImpl {
23 public: 24 public:
24 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id) 25 TestablePictureImageLayerImpl(LayerTreeImpl* tree_impl, int id)
25 : PictureImageLayerImpl(tree_impl, id, false) {} 26 : PictureImageLayerImpl(tree_impl, id, false) {}
26 using PictureLayerImpl::UpdateIdealScales; 27 using PictureLayerImpl::UpdateIdealScales;
27 using PictureLayerImpl::MaximumTilingContentsScale; 28 using PictureLayerImpl::MaximumTilingContentsScale;
28 29
29 PictureLayerTilingSet* tilings() { return tilings_.get(); } 30 PictureLayerTilingSet* tilings() { return tilings_.get(); }
30 31
31 friend class PictureImageLayerImplTest; 32 friend class PictureImageLayerImplTest;
32 }; 33 };
33 34
34 class PictureImageLayerImplTest : public testing::Test { 35 class PictureImageLayerImplTest : public testing::Test {
35 public: 36 public:
36 PictureImageLayerImplTest() 37 PictureImageLayerImplTest()
37 : proxy_(base::MessageLoopProxy::current()), 38 : proxy_(base::MessageLoopProxy::current()),
38 host_impl_(ImplSidePaintingSettings(), 39 host_impl_(ImplSidePaintingSettings(),
39 &proxy_, 40 &proxy_,
40 &shared_bitmap_manager_) { 41 &shared_bitmap_manager_,
42 &task_graph_runner_) {
41 host_impl_.CreatePendingTree(); 43 host_impl_.CreatePendingTree();
42 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d()); 44 host_impl_.InitializeRenderer(FakeOutputSurface::Create3d());
43 } 45 }
44 46
45 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id, 47 scoped_ptr<TestablePictureImageLayerImpl> CreateLayer(int id,
46 WhichTree which_tree) { 48 WhichTree which_tree) {
47 LayerTreeImpl* tree = nullptr; 49 LayerTreeImpl* tree = nullptr;
48 switch (which_tree) { 50 switch (which_tree) {
49 case ACTIVE_TREE: 51 case ACTIVE_TREE:
50 tree = host_impl_.active_tree(); 52 tree = host_impl_.active_tree();
(...skipping 24 matching lines...) Expand all
75 maximum_animation_contents_scale; 77 maximum_animation_contents_scale;
76 layer->draw_properties().screen_space_transform_is_animating = 78 layer->draw_properties().screen_space_transform_is_animating =
77 animating_transform_to_screen; 79 animating_transform_to_screen;
78 layer->draw_properties().visible_content_rect = viewport_rect; 80 layer->draw_properties().visible_content_rect = viewport_rect;
79 bool resourceless_software_draw = false; 81 bool resourceless_software_draw = false;
80 layer->UpdateTiles(resourceless_software_draw); 82 layer->UpdateTiles(resourceless_software_draw);
81 } 83 }
82 84
83 protected: 85 protected:
84 FakeImplProxy proxy_; 86 FakeImplProxy proxy_;
87 TestSharedBitmapManager shared_bitmap_manager_;
88 TestTaskGraphRunner task_graph_runner_;
85 FakeLayerTreeHostImpl host_impl_; 89 FakeLayerTreeHostImpl host_impl_;
86 TestSharedBitmapManager shared_bitmap_manager_;
87 }; 90 };
88 91
89 TEST_F(PictureImageLayerImplTest, CalculateContentsScale) { 92 TEST_F(PictureImageLayerImplTest, CalculateContentsScale) {
90 scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE)); 93 scoped_ptr<TestablePictureImageLayerImpl> layer(CreateLayer(1, PENDING_TREE));
91 layer->SetDrawsContent(true); 94 layer->SetDrawsContent(true);
92 95
93 gfx::Rect viewport(100, 200); 96 gfx::Rect viewport(100, 200);
94 SetupDrawPropertiesAndUpdateTiles( 97 SetupDrawPropertiesAndUpdateTiles(
95 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);
96 99
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 active_layer->DidDraw(nullptr); 153 active_layer->DidDraw(nullptr);
151 154
152 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material); 155 EXPECT_EQ(DrawQuad::TILED_CONTENT, render_pass->quad_list.front()->material);
153 156
154 // 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.
155 EXPECT_EQ(0, data.num_incomplete_tiles); 158 EXPECT_EQ(0, data.num_incomplete_tiles);
156 } 159 }
157 160
158 } // namespace 161 } // namespace
159 } // namespace cc 162 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/painted_scrollbar_layer_impl.cc ('k') | cc/layers/picture_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698