Revert of Create a new AccountTrackerService (patchset #8 of https://codereview.chrom...
[chromium-blink-merge.git] / cc / test / layer_tree_host_common_test.h
blob67eb6cc58b3da0af29b229a57c1154352fc5c0ef
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.
5 #ifndef CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_
6 #define CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_
8 #include <vector>
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/layers/layer_lists.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace gfx {
15 class PointF;
16 class Point3F;
17 class Size;
18 class Transform;
21 namespace cc {
23 class Layer;
24 class LayerImpl;
25 class RenderSurfaceLayerList;
27 class LayerTreeHostCommonTestBase {
28 protected:
29 LayerTreeHostCommonTestBase();
30 virtual ~LayerTreeHostCommonTestBase();
32 template <typename LayerType>
33 void SetLayerPropertiesForTestingInternal(
34 LayerType* layer,
35 const gfx::Transform& transform,
36 const gfx::Point3F& transform_origin,
37 const gfx::PointF& position,
38 const gfx::Size& bounds,
39 bool flatten_transform,
40 bool is_3d_sorted) {
41 layer->SetTransform(transform);
42 layer->SetTransformOrigin(transform_origin);
43 layer->SetPosition(position);
44 layer->SetBounds(bounds);
45 layer->SetShouldFlattenTransform(flatten_transform);
46 layer->Set3dSortingContextId(is_3d_sorted ? 1 : 0);
49 void SetLayerPropertiesForTesting(Layer* layer,
50 const gfx::Transform& transform,
51 const gfx::Point3F& transform_origin,
52 const gfx::PointF& position,
53 const gfx::Size& bounds,
54 bool flatten_transform,
55 bool is_3d_sorted);
57 void SetLayerPropertiesForTesting(LayerImpl* layer,
58 const gfx::Transform& transform,
59 const gfx::Point3F& transform_origin,
60 const gfx::PointF& position,
61 const gfx::Size& bounds,
62 bool flatten_transform,
63 bool is_3d_sorted);
65 void ExecuteCalculateDrawProperties(Layer* root_layer,
66 float device_scale_factor,
67 float page_scale_factor,
68 Layer* page_scale_application_layer,
69 bool can_use_lcd_text);
71 void ExecuteCalculateDrawProperties(LayerImpl* root_layer,
72 float device_scale_factor,
73 float page_scale_factor,
74 LayerImpl* page_scale_application_layer,
75 bool can_use_lcd_text);
77 template <class LayerType>
78 void ExecuteCalculateDrawProperties(LayerType* root_layer) {
79 LayerType* page_scale_application_layer = NULL;
80 ExecuteCalculateDrawProperties(
81 root_layer, 1.f, 1.f, page_scale_application_layer, false);
84 template <class LayerType>
85 void ExecuteCalculateDrawProperties(LayerType* root_layer,
86 float device_scale_factor) {
87 LayerType* page_scale_application_layer = NULL;
88 ExecuteCalculateDrawProperties(root_layer,
89 device_scale_factor,
90 1.f,
91 page_scale_application_layer,
92 false);
95 template <class LayerType>
96 void ExecuteCalculateDrawProperties(LayerType* root_layer,
97 float device_scale_factor,
98 float page_scale_factor,
99 LayerType* page_scale_application_layer) {
100 ExecuteCalculateDrawProperties(root_layer,
101 device_scale_factor,
102 page_scale_factor,
103 page_scale_application_layer,
104 false);
107 RenderSurfaceLayerList* render_surface_layer_list() const {
108 return render_surface_layer_list_.get();
111 LayerImplList* render_surface_layer_list_impl() const {
112 return render_surface_layer_list_impl_.get();
115 int render_surface_layer_list_count() const {
116 return render_surface_layer_list_count_;
119 private:
120 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_;
121 scoped_ptr<std::vector<LayerImpl*> > render_surface_layer_list_impl_;
123 int render_surface_layer_list_count_;
126 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase,
127 public testing::Test {};
129 } // namespace cc
131 #endif // CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_