| 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 "cc/test/geometry_test_utils.h" | 7 #include "cc/test/geometry_test_utils.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 virtual ~MockContentsScalingLayer() {} | 42 virtual ~MockContentsScalingLayer() {} |
| 43 | 43 |
| 44 gfx::RectF last_needs_display_rect_; | 44 gfx::RectF last_needs_display_rect_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 void CalcDrawProps(Layer* root, float device_scale) { | 47 void CalcDrawProps(Layer* root, float device_scale) { |
| 48 std::vector<scoped_refptr<Layer> > render_surface_layer_list; | 48 std::vector<scoped_refptr<Layer> > render_surface_layer_list; |
| 49 LayerTreeHostCommon::CalculateDrawProperties( | 49 LayerTreeHostCommon::calculateDrawProperties( |
| 50 root, | 50 root, |
| 51 gfx::Size(500, 500), | 51 gfx::Size(500, 500), |
| 52 device_scale, | 52 device_scale, |
| 53 1.f, | 53 1.f, |
| 54 1024, | 54 1024, |
| 55 false, | 55 false, |
| 56 &render_surface_layer_list); | 56 render_surface_layer_list); |
| 57 } | 57 } |
| 58 | 58 |
| 59 TEST(ContentsScalingLayerTest, CheckContentsBounds) { | 59 TEST(ContentsScalingLayerTest, CheckContentsBounds) { |
| 60 scoped_refptr<MockContentsScalingLayer> test_layer = | 60 scoped_refptr<MockContentsScalingLayer> test_layer = |
| 61 make_scoped_refptr(new MockContentsScalingLayer()); | 61 make_scoped_refptr(new MockContentsScalingLayer()); |
| 62 | 62 |
| 63 scoped_refptr<Layer> root = Layer::Create(); | 63 scoped_refptr<Layer> root = Layer::Create(); |
| 64 root->AddChild(test_layer); | 64 root->AddChild(test_layer); |
| 65 | 65 |
| 66 test_layer->SetBounds(gfx::Size(320, 240)); | 66 test_layer->SetBounds(gfx::Size(320, 240)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 EXPECT_EQ(20, test_layer->content_bounds().width()); | 79 EXPECT_EQ(20, test_layer->content_bounds().width()); |
| 80 EXPECT_EQ(40, test_layer->content_bounds().height()); | 80 EXPECT_EQ(40, test_layer->content_bounds().height()); |
| 81 | 81 |
| 82 CalcDrawProps(root, 1.33f); | 82 CalcDrawProps(root, 1.33f); |
| 83 EXPECT_EQ(14, test_layer->content_bounds().width()); | 83 EXPECT_EQ(14, test_layer->content_bounds().width()); |
| 84 EXPECT_EQ(27, test_layer->content_bounds().height()); | 84 EXPECT_EQ(27, test_layer->content_bounds().height()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace | 87 } // namespace |
| 88 } // namespace cc | 88 } // namespace cc |
| OLD | NEW |