OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #ifndef CC_TEST_LAYER_TREE_TEST_H_ | 5 #ifndef CC_TEST_LAYER_TREE_TEST_H_ |
6 #define CC_TEST_LAYER_TREE_TEST_H_ | 6 #define CC_TEST_LAYER_TREE_TEST_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "cc/animation/animation_delegate.h" | 10 #include "cc/animation/animation_delegate.h" |
11 #include "cc/layers/layer_settings.h" | |
12 #include "cc/test/proxy_impl_for_test.h" | 11 #include "cc/test/proxy_impl_for_test.h" |
13 #include "cc/test/proxy_main_for_test.h" | 12 #include "cc/test/proxy_main_for_test.h" |
14 #include "cc/test/remote_proto_channel_bridge.h" | 13 #include "cc/test/remote_proto_channel_bridge.h" |
15 #include "cc/test/test_hooks.h" | 14 #include "cc/test/test_hooks.h" |
16 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
17 #include "cc/trees/layer_tree_host_impl.h" | 16 #include "cc/trees/layer_tree_host_impl.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
19 | 18 |
20 namespace cc { | 19 namespace cc { |
21 class AnimationPlayer; | 20 class AnimationPlayer; |
(...skipping 12 matching lines...) Expand all Loading... |
34 class TestWebGraphicsContext3D; | 33 class TestWebGraphicsContext3D; |
35 class ThreadedChannelForTest; | 34 class ThreadedChannelForTest; |
36 | 35 |
37 // Creates the virtual viewport layer hierarchy under the given root_layer. | 36 // Creates the virtual viewport layer hierarchy under the given root_layer. |
38 // Convenient overload of the method below that creates a scrolling layer as | 37 // Convenient overload of the method below that creates a scrolling layer as |
39 // the outer viewport scroll layer. | 38 // the outer viewport scroll layer. |
40 void CreateVirtualViewportLayers(Layer* root_layer, | 39 void CreateVirtualViewportLayers(Layer* root_layer, |
41 const gfx::Size& inner_bounds, | 40 const gfx::Size& inner_bounds, |
42 const gfx::Size& outer_bounds, | 41 const gfx::Size& outer_bounds, |
43 const gfx::Size& scroll_bounds, | 42 const gfx::Size& scroll_bounds, |
44 LayerTreeHost* host, | 43 LayerTreeHost* host); |
45 const LayerSettings& layer_settings); | |
46 | 44 |
47 // Creates the virtual viewport layer hierarchy under the given root_layer. | 45 // Creates the virtual viewport layer hierarchy under the given root_layer. |
48 // Uses the given scroll layer as the content "outer viewport scroll layer". | 46 // Uses the given scroll layer as the content "outer viewport scroll layer". |
49 void CreateVirtualViewportLayers(Layer* root_layer, | 47 void CreateVirtualViewportLayers(Layer* root_layer, |
50 scoped_refptr<Layer> outer_scroll_layer, | 48 scoped_refptr<Layer> outer_scroll_layer, |
51 const gfx::Size& outer_bounds, | 49 const gfx::Size& outer_bounds, |
52 const gfx::Size& scroll_bounds, | 50 const gfx::Size& scroll_bounds, |
53 LayerTreeHost* host, | 51 LayerTreeHost* host); |
54 const LayerSettings& layer_settings); | |
55 | 52 |
56 class BeginTask; | 53 class BeginTask; |
57 class LayerTreeHostClientForTesting; | 54 class LayerTreeHostClientForTesting; |
58 class TimeoutTask; | 55 class TimeoutTask; |
59 | 56 |
60 // The LayerTreeTests runs with the main loop running. It instantiates a single | 57 // The LayerTreeTests runs with the main loop running. It instantiates a single |
61 // LayerTreeHostForTesting and associated LayerTreeHostImplForTesting and | 58 // LayerTreeHostForTesting and associated LayerTreeHostImplForTesting and |
62 // LayerTreeHostClientForTesting. | 59 // LayerTreeHostClientForTesting. |
63 // | 60 // |
64 // BeginTest() is called once the main message loop is running and the layer | 61 // BeginTest() is called once the main message loop is running and the layer |
(...skipping 24 matching lines...) Expand all Loading... |
89 void PostSetNeedsRedrawToMainThread(); | 86 void PostSetNeedsRedrawToMainThread(); |
90 void PostSetNeedsRedrawRectToMainThread(const gfx::Rect& damage_rect); | 87 void PostSetNeedsRedrawRectToMainThread(const gfx::Rect& damage_rect); |
91 void PostSetVisibleToMainThread(bool visible); | 88 void PostSetVisibleToMainThread(bool visible); |
92 void PostSetNextCommitForcesRedrawToMainThread(); | 89 void PostSetNextCommitForcesRedrawToMainThread(); |
93 void PostCompositeImmediatelyToMainThread(); | 90 void PostCompositeImmediatelyToMainThread(); |
94 void PostNextCommitWaitsForActivationToMainThread(); | 91 void PostNextCommitWaitsForActivationToMainThread(); |
95 | 92 |
96 void DoBeginTest(); | 93 void DoBeginTest(); |
97 void Timeout(); | 94 void Timeout(); |
98 | 95 |
99 const LayerSettings& layer_settings() { return layer_settings_; } | |
100 | |
101 protected: | 96 protected: |
102 LayerTreeTest(); | 97 LayerTreeTest(); |
103 | 98 |
104 virtual void InitializeSettings(LayerTreeSettings* settings) {} | 99 virtual void InitializeSettings(LayerTreeSettings* settings) {} |
105 virtual void InitializeLayerSettings(LayerSettings* layer_settings) {} | |
106 | 100 |
107 void RealEndTest(); | 101 void RealEndTest(); |
108 | 102 |
109 virtual void DispatchAddAnimationToPlayer( | 103 virtual void DispatchAddAnimationToPlayer( |
110 AnimationPlayer* player_to_receive_animation, | 104 AnimationPlayer* player_to_receive_animation, |
111 double animation_duration); | 105 double animation_duration); |
112 void DispatchSetDeferCommits(bool defer_commits); | 106 void DispatchSetDeferCommits(bool defer_commits); |
113 void DispatchSetNeedsCommit(); | 107 void DispatchSetNeedsCommit(); |
114 void DispatchSetNeedsUpdateLayers(); | 108 void DispatchSetNeedsUpdateLayers(); |
115 void DispatchSetNeedsRedraw(); | 109 void DispatchSetNeedsRedraw(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 return gfx::Vector2dF(layer_impl->synced_scroll_offset()->Delta().x(), | 185 return gfx::Vector2dF(layer_impl->synced_scroll_offset()->Delta().x(), |
192 layer_impl->synced_scroll_offset()->Delta().y()); | 186 layer_impl->synced_scroll_offset()->Delta().y()); |
193 else | 187 else |
194 return gfx::Vector2dF( | 188 return gfx::Vector2dF( |
195 layer_impl->synced_scroll_offset()->PendingDelta().get().x(), | 189 layer_impl->synced_scroll_offset()->PendingDelta().get().x(), |
196 layer_impl->synced_scroll_offset()->PendingDelta().get().y()); | 190 layer_impl->synced_scroll_offset()->PendingDelta().get().y()); |
197 } | 191 } |
198 | 192 |
199 private: | 193 private: |
200 LayerTreeSettings settings_; | 194 LayerTreeSettings settings_; |
201 LayerSettings layer_settings_; | |
202 | 195 |
203 CompositorMode mode_; | 196 CompositorMode mode_; |
204 | 197 |
205 scoped_ptr<LayerTreeHostClientForTesting> client_; | 198 scoped_ptr<LayerTreeHostClientForTesting> client_; |
206 scoped_ptr<LayerTreeHost> layer_tree_host_; | 199 scoped_ptr<LayerTreeHost> layer_tree_host_; |
207 | 200 |
208 // The LayerTreeHost created by the cc embedder on the client in remote mode. | 201 // The LayerTreeHost created by the cc embedder on the client in remote mode. |
209 scoped_ptr<LayerTreeHostForTesting> remote_client_layer_tree_host_; | 202 scoped_ptr<LayerTreeHostForTesting> remote_client_layer_tree_host_; |
210 | 203 |
211 FakeOutputSurface* output_surface_; | 204 FakeOutputSurface* output_surface_; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ | 278 #define SINGLE_AND_MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) \ |
286 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ | 279 SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TEST_FIXTURE_NAME); \ |
287 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) | 280 SINGLE_AND_MULTI_THREAD_DELEGATING_RENDERER_TEST_F(TEST_FIXTURE_NAME) |
288 | 281 |
289 // Some tests want to control when notify ready for activation occurs, | 282 // Some tests want to control when notify ready for activation occurs, |
290 // but this is not supported in the single-threaded case. | 283 // but this is not supported in the single-threaded case. |
291 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ | 284 #define MULTI_THREAD_BLOCKNOTIFY_TEST_F(TEST_FIXTURE_NAME) \ |
292 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) | 285 MULTI_THREAD_TEST_F(TEST_FIXTURE_NAME) |
293 | 286 |
294 #endif // CC_TEST_LAYER_TREE_TEST_H_ | 287 #endif // CC_TEST_LAYER_TREE_TEST_H_ |
OLD | NEW |