OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/contents_scaling_layer.h" | 5 #include "cc/layers/contents_scaling_layer.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "cc/test/fake_layer_tree_host.h" | 9 #include "cc/test/fake_layer_tree_host.h" |
10 #include "cc/test/geometry_test_utils.h" | 10 #include "cc/test/geometry_test_utils.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) { | 36 static void CalcDrawProps(FakeLayerTreeHost* host, float device_scale_factor) { |
37 RenderSurfaceLayerList render_surface_layer_list; | 37 RenderSurfaceLayerList render_surface_layer_list; |
38 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 38 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
39 host->root_layer(), gfx::Size(500, 500), &render_surface_layer_list); | 39 host->root_layer(), gfx::Size(500, 500), &render_surface_layer_list); |
40 inputs.device_scale_factor = device_scale_factor; | 40 inputs.device_scale_factor = device_scale_factor; |
41 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 41 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
42 } | 42 } |
43 | 43 |
44 TEST(ContentsScalingLayerTest, CheckContentsBounds) { | 44 TEST(ContentsScalingLayerTest, CheckContentsBounds) { |
45 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 45 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
46 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | |
47 | 46 |
48 scoped_refptr<MockContentsScalingLayer> test_layer = | 47 scoped_refptr<MockContentsScalingLayer> test_layer = |
49 make_scoped_refptr(new MockContentsScalingLayer()); | 48 make_scoped_refptr(new MockContentsScalingLayer()); |
50 | 49 |
51 scoped_refptr<Layer> root = Layer::Create(); | 50 scoped_refptr<Layer> root = Layer::Create(); |
52 root->AddChild(test_layer); | 51 root->AddChild(test_layer); |
53 host->SetRootLayer(root); | 52 host->SetRootLayer(root); |
54 | 53 |
55 test_layer->SetBounds(gfx::Size(320, 240)); | 54 test_layer->SetBounds(gfx::Size(320, 240)); |
56 | 55 |
(...skipping 12 matching lines...) Expand all Loading... |
69 EXPECT_EQ(20, test_layer->content_bounds().width()); | 68 EXPECT_EQ(20, test_layer->content_bounds().width()); |
70 EXPECT_EQ(40, test_layer->content_bounds().height()); | 69 EXPECT_EQ(40, test_layer->content_bounds().height()); |
71 | 70 |
72 CalcDrawProps(host.get(), 1.33f); | 71 CalcDrawProps(host.get(), 1.33f); |
73 EXPECT_EQ(14, test_layer->content_bounds().width()); | 72 EXPECT_EQ(14, test_layer->content_bounds().width()); |
74 EXPECT_EQ(27, test_layer->content_bounds().height()); | 73 EXPECT_EQ(27, test_layer->content_bounds().height()); |
75 } | 74 } |
76 | 75 |
77 } // namespace | 76 } // namespace |
78 } // namespace cc | 77 } // namespace cc |
OLD | NEW |