Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / test / layer_tree_host_common_test.h
blobec774348005989abf7c7fa57ec65313bb0722d25
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 "cc/test/fake_layer_tree_host_client.h"
13 #include "cc/trees/layer_tree_settings.h"
14 #include "cc/trees/property_tree.h"
15 #include "testing/gtest/include/gtest/gtest.h"
17 namespace gfx {
18 class PointF;
19 class Point3F;
20 class Size;
21 class Transform;
24 namespace cc {
26 class FakeLayerTreeHost;
27 class Layer;
28 class LayerImpl;
29 class RenderSurfaceLayerList;
31 class LayerTreeHostCommonTestBase {
32 protected:
33 LayerTreeHostCommonTestBase();
34 virtual ~LayerTreeHostCommonTestBase();
36 template <typename LayerType>
37 void SetLayerPropertiesForTestingInternal(
38 LayerType* layer,
39 const gfx::Transform& transform,
40 const gfx::Point3F& transform_origin,
41 const gfx::PointF& position,
42 const gfx::Size& bounds,
43 bool flatten_transform,
44 bool is_3d_sorted) {
45 layer->SetTransform(transform);
46 layer->SetTransformOrigin(transform_origin);
47 layer->SetPosition(position);
48 layer->SetBounds(bounds);
49 layer->SetShouldFlattenTransform(flatten_transform);
50 layer->Set3dSortingContextId(is_3d_sorted ? 1 : 0);
53 void SetLayerPropertiesForTesting(Layer* layer,
54 const gfx::Transform& transform,
55 const gfx::Point3F& transform_origin,
56 const gfx::PointF& position,
57 const gfx::Size& bounds,
58 bool flatten_transform,
59 bool is_3d_sorted);
61 void SetLayerPropertiesForTesting(LayerImpl* layer,
62 const gfx::Transform& transform,
63 const gfx::Point3F& transform_origin,
64 const gfx::PointF& position,
65 const gfx::Size& bounds,
66 bool flatten_transform,
67 bool is_3d_sorted,
68 bool create_render_surface);
70 void ExecuteCalculateDrawProperties(Layer* root_layer,
71 float device_scale_factor,
72 float page_scale_factor,
73 Layer* page_scale_application_layer,
74 bool can_use_lcd_text,
75 bool layers_always_allowed_lcd_text);
77 void ExecuteCalculateDrawProperties(LayerImpl* root_layer,
78 float device_scale_factor,
79 float page_scale_factor,
80 LayerImpl* page_scale_application_layer,
81 bool can_use_lcd_text,
82 bool layers_always_allowed_lcd_text);
84 template <class LayerType>
85 void ExecuteCalculateDrawProperties(LayerType* root_layer) {
86 LayerType* page_scale_application_layer = NULL;
87 ExecuteCalculateDrawProperties(root_layer, 1.f, 1.f,
88 page_scale_application_layer, false, false);
91 template <class LayerType>
92 void ExecuteCalculateDrawProperties(LayerType* root_layer,
93 float device_scale_factor) {
94 LayerType* page_scale_application_layer = NULL;
95 ExecuteCalculateDrawProperties(root_layer, device_scale_factor, 1.f,
96 page_scale_application_layer, false, false);
99 template <class LayerType>
100 void ExecuteCalculateDrawProperties(LayerType* root_layer,
101 float device_scale_factor,
102 float page_scale_factor,
103 LayerType* page_scale_application_layer) {
104 ExecuteCalculateDrawProperties(root_layer, device_scale_factor,
105 page_scale_factor,
106 page_scale_application_layer, false, false);
109 void ExecuteCalculateDrawPropertiesWithPropertyTrees(Layer* layer);
110 void ExecuteCalculateDrawPropertiesWithPropertyTrees(LayerImpl* layer);
112 RenderSurfaceLayerList* render_surface_layer_list() const {
113 return render_surface_layer_list_.get();
116 LayerImplList* render_surface_layer_list_impl() const {
117 return render_surface_layer_list_impl_.get();
120 int render_surface_layer_list_count() const {
121 return render_surface_layer_list_count_;
124 scoped_ptr<FakeLayerTreeHost> CreateFakeLayerTreeHost();
126 const LayerSettings& layer_settings() { return layer_settings_; }
128 private:
129 scoped_ptr<RenderSurfaceLayerList> render_surface_layer_list_;
130 scoped_ptr<std::vector<LayerImpl*>> render_surface_layer_list_impl_;
131 LayerSettings layer_settings_;
133 FakeLayerTreeHostClient client_;
134 int render_surface_layer_list_count_;
137 class LayerTreeHostCommonTest : public LayerTreeHostCommonTestBase,
138 public testing::Test {};
140 } // namespace cc
142 #endif // CC_TEST_LAYER_TREE_HOST_COMMON_TEST_H_