| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ |
| 6 #define CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 |
| 13 namespace gfx { |
| 14 class PointF; |
| 15 class Size; |
| 16 class Transform; |
| 17 } |
| 18 |
| 19 namespace cc { |
| 20 |
| 21 class Layer; |
| 22 class LayerImpl; |
| 23 class RenderSurfaceLayerList; |
| 24 |
| 25 class LayerTreeHostCommonTestBase { |
| 26 protected: |
| 27 LayerTreeHostCommonTestBase(); |
| 28 virtual ~LayerTreeHostCommonTestBase(); |
| 29 |
| 30 template <typename LayerType> |
| 31 void SetLayerPropertiesForTestingInternal(LayerType* layer, |
| 32 const gfx::Transform& transform, |
| 33 const gfx::PointF& anchor, |
| 34 const gfx::PointF& position, |
| 35 const gfx::Size& bounds, |
| 36 bool flatten_transform, |
| 37 bool is_3d_sorted) { |
| 38 layer->SetTransform(transform); |
| 39 layer->SetAnchorPoint(anchor); |
| 40 layer->SetPosition(position); |
| 41 layer->SetBounds(bounds); |
| 42 layer->SetShouldFlattenTransform(flatten_transform); |
| 43 layer->SetIs3dSorted(is_3d_sorted); |
| 44 } |
| 45 |
| 46 void SetLayerPropertiesForTesting(Layer* layer, |
| 47 const gfx::Transform& transform, |
| 48 const gfx::PointF& anchor, |
| 49 const gfx::PointF& position, |
| 50 const gfx::Size& bounds, |
| 51 bool flatten_transform, |
| 52 bool is_3d_sorted); |
| 53 |
| 54 void SetLayerPropertiesForTesting(LayerImpl* layer, |
| 55 const gfx::Transform& transform, |
| 56 const gfx::PointF& anchor, |
| 57 const gfx::PointF& position, |
| 58 const gfx::Size& bounds, |
| 59 bool flatten_transform, |
| 60 bool is_3d_sorted); |
| 61 |
| 62 void ExecuteCalculateDrawProperties(Layer* root_layer, |
| 63 float device_scale_factor, |
| 64 float page_scale_factor, |
| 65 Layer* page_scale_application_layer, |
| 66 bool can_use_lcd_text); |
| 67 |
| 68 void ExecuteCalculateDrawProperties(LayerImpl* root_layer, |
| 69 float device_scale_factor, |
| 70 float page_scale_factor, |
| 71 LayerImpl* page_scale_application_layer, |
| 72 bool can_use_lcd_text); |
| 73 |
| 74 template <class LayerType> |
| 75 void ExecuteCalculateDrawProperties(LayerType* root_layer) { |
| 76 LayerType* page_scale_application_layer = NULL; |
| 77 ExecuteCalculateDrawProperties( |
| 78 root_layer, 1.f, 1.f, page_scale_application_layer, false); |
| 79 } |
| 80 |
| 81 template <class LayerType> |
| 82 void ExecuteCalculateDrawProperties(LayerType* root_layer, |
| 83 float device_scale_factor) { |
| 84 LayerType* page_scale_application_layer = NULL; |
| 85 ExecuteCalculateDrawProperties(root_layer, |
| 86 device_scale_factor, |
| 87 1.f, |
| 88 page_scale_application_layer, |
| 89 false); |
| 90 } |
| 91 |
| 92 template <class LayerType> |
| 93 void ExecuteCalculateDrawProperties(LayerType* root_layer, |
| 94 float device_scale_factor, |
| 95 float page_scale_factor, |
| 96 LayerType* page_scale_application_layer) { |
| 97 ExecuteCalculateDrawProperties(root_layer, |
| 98 device_scale_factor, |
| 99 page_scale_factor, |
| 100 page_scale_application_layer, |
| 101 false); |
| 102 } |
| 103 |
| 104 RenderSurfaceLayerList* render_surface_layer_list() const; |
| 105 std::vector<LayerImpl*>* render_surface_layer_list_impl() const; |
| 106 int render_surface_layer_list_count() const; |
| 107 |
| 108 private: |
| 109 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_; |
| 110 scoped_ptr<std::vector<LayerImpl*> > render_surface_layer_list_impl_; |
| 111 |
| 112 int render_surface_layer_list_count_; |
| 113 }; |
| 114 |
| 115 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase, |
| 116 public testing::Test { |
| 117 }; |
| 118 |
| 119 } // namespace cc |
| 120 |
| 121 #endif // CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_ |
| OLD | NEW |